mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-01-06 00:29:41 +00:00
Add some comments in initialization code.
This commit is contained in:
parent
51951721c5
commit
c1a188aa95
13
Parser.pas
13
Parser.pas
@ -2402,7 +2402,6 @@ var
|
|||||||
braces := true;
|
braces := true;
|
||||||
end; {if}
|
end; {if}
|
||||||
|
|
||||||
{handle arrays}
|
|
||||||
while tp^.kind = definedType do
|
while tp^.kind = definedType do
|
||||||
tp := tp^.dType;
|
tp := tp^.dType;
|
||||||
kind := tp^.kind;
|
kind := tp^.kind;
|
||||||
@ -2412,13 +2411,15 @@ var
|
|||||||
if not (braces or nestedDesignator) then
|
if not (braces or nestedDesignator) then
|
||||||
goto 1;
|
goto 1;
|
||||||
startingDisp := disp;
|
startingDisp := disp;
|
||||||
|
|
||||||
|
{handle arrays}
|
||||||
if kind = arrayType then begin
|
if kind = arrayType then begin
|
||||||
ktp := tp^.atype;
|
ktp := tp^.atype;
|
||||||
while ktp^.kind = definedType do
|
while ktp^.kind = definedType do
|
||||||
ktp := ktp^.dType;
|
ktp := ktp^.dType;
|
||||||
kind := ktp^.kind;
|
kind := ktp^.kind;
|
||||||
|
|
||||||
{handle string constants}
|
{handle arrays initialized with a string constant}
|
||||||
if (token.kind = stringConst) and (kind = scalarType) then begin
|
if (token.kind = stringConst) and (kind = scalarType) then begin
|
||||||
stringElementType := StringType(token.prefix)^.aType;
|
stringElementType := StringType(token.prefix)^.aType;
|
||||||
if ((ktp^.baseType in [cgByte,cgUByte]) and (stringElementType^.size=1))
|
if ((ktp^.baseType in [cgByte,cgUByte]) and (stringElementType^.size=1))
|
||||||
@ -2489,6 +2490,7 @@ var
|
|||||||
if token.kind <> rbracech then
|
if token.kind <> rbracech then
|
||||||
repeat
|
repeat
|
||||||
hasNestedDesignator := false;
|
hasNestedDesignator := false;
|
||||||
|
{handle designators}
|
||||||
if token.kind in [lbrackch,dotch] then begin
|
if token.kind in [lbrackch,dotch] then begin
|
||||||
if not (braces or (nestedDesignator and (disp=startingDisp)))
|
if not (braces or (nestedDesignator and (disp=startingDisp)))
|
||||||
then begin
|
then begin
|
||||||
@ -2526,6 +2528,7 @@ var
|
|||||||
end; {if}
|
end; {if}
|
||||||
end; {if}
|
end; {if}
|
||||||
end; {if}
|
end; {if}
|
||||||
|
|
||||||
disp := startingDisp + count * ktp^.size;
|
disp := startingDisp + count * ktp^.size;
|
||||||
InitializeTerm(ktp, 0, 0, false, hasNestedDesignator);
|
InitializeTerm(ktp, 0, 0, false, hasNestedDesignator);
|
||||||
if disp > maxDisp then
|
if disp > maxDisp then
|
||||||
@ -2576,6 +2579,8 @@ var
|
|||||||
|
|
||||||
{handle structures and unions}
|
{handle structures and unions}
|
||||||
else if kind in [structType, unionType] then begin
|
else if kind in [structType, unionType] then begin
|
||||||
|
|
||||||
|
{handle initialization with an expression of struct/union type}
|
||||||
if not braces then
|
if not braces then
|
||||||
if not nestedDesignator then
|
if not nestedDesignator then
|
||||||
if not isStatic then
|
if not isStatic then
|
||||||
@ -2596,6 +2601,8 @@ var
|
|||||||
goto 1;
|
goto 1;
|
||||||
end; {if}
|
end; {if}
|
||||||
end; {if}
|
end; {if}
|
||||||
|
|
||||||
|
{handle struct/union initialization with an initializer list}
|
||||||
if braces or (not main) then begin
|
if braces or (not main) then begin
|
||||||
ip := tp^.fieldList;
|
ip := tp^.fieldList;
|
||||||
maxDisp := disp;
|
maxDisp := disp;
|
||||||
@ -2606,6 +2613,7 @@ var
|
|||||||
if token.kind = rbracech then {fill remainder with zeros}
|
if token.kind = rbracech then {fill remainder with zeros}
|
||||||
goto 2;
|
goto 2;
|
||||||
hasNestedDesignator := false;
|
hasNestedDesignator := false;
|
||||||
|
{handle designators}
|
||||||
if token.kind in [dotch,lbrackch] then begin
|
if token.kind in [dotch,lbrackch] then begin
|
||||||
if not (braces or (nestedDesignator and (disp=startingDisp)))
|
if not (braces or (nestedDesignator and (disp=startingDisp)))
|
||||||
then begin
|
then begin
|
||||||
@ -2658,6 +2666,7 @@ var
|
|||||||
goto 2;
|
goto 2;
|
||||||
end; {else}
|
end; {else}
|
||||||
end; {if}
|
end; {if}
|
||||||
|
|
||||||
if (ip = nil) or (ip^.itype^.size = 0) then
|
if (ip = nil) or (ip^.itype^.size = 0) then
|
||||||
goto 2;
|
goto 2;
|
||||||
disp := startingDisp + ip^.disp;
|
disp := startingDisp + ip^.disp;
|
||||||
|
Loading…
Reference in New Issue
Block a user