mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-06-06 12:29:33 +00:00
Allow string constants with up to 32760 bytes.
This allows the length of the string plus a few extra bytes used internally to be represented by a 16-bit integer. Since the size limit for memory allocations has been raised, there is no good reason to impose a shorter limit on strings. Note that C99 and later specify a minimum translation limit for string constants of at least 4095 characters.
This commit is contained in:
parent
26d0f2ad35
commit
73d194c12f
|
@ -78,7 +78,7 @@ const
|
||||||
maxLine = 255; {max length of a line}
|
maxLine = 255; {max length of a line}
|
||||||
maxPath = 255; {max length of a path name}
|
maxPath = 255; {max length of a path name}
|
||||||
{NOTE: maxPath is used in Scanner.asm}
|
{NOTE: maxPath is used in Scanner.asm}
|
||||||
longstringlen = 4000; {max length of a string constant}
|
longstringlen = 32760; {max length of a string constant}
|
||||||
|
|
||||||
minChar = 0; {min ordinal value of source character}
|
minChar = 0; {min ordinal value of source character}
|
||||||
maxChar = 255; {max ordinal value of source character}
|
maxChar = 255; {max ordinal value of source character}
|
||||||
|
|
10
Scanner.pas
10
Scanner.pas
|
@ -4388,17 +4388,17 @@ procedure NextToken;
|
||||||
label 1,2,3,4,5,6;
|
label 1,2,3,4,5,6;
|
||||||
|
|
||||||
type
|
type
|
||||||
three = (s100,s1000,s4000); {these declarations are used for a}
|
three = (s100,s1000,sMAX); {these declarations are used for a}
|
||||||
gstringPtr = ^gstringRecord; { variable length string record }
|
gstringPtr = ^gstringRecord; { variable length string record }
|
||||||
gstringRecord = record
|
gstringRecord = record
|
||||||
case three of
|
case three of
|
||||||
s100: (len1: integer;
|
s100: (len1: integer;
|
||||||
str1: packed array[1..100] of char;
|
str1: packed array[1..100] of char;
|
||||||
);
|
);
|
||||||
s1000: (len2: integer;
|
s1000: (len2: integer;
|
||||||
str2: packed array[1..1000] of char;
|
str2: packed array[1..1000] of char;
|
||||||
);
|
);
|
||||||
s4000: (len3: integer;
|
sMAX: (len3: integer;
|
||||||
str3: packed array[1..longstringlen] of char;
|
str3: packed array[1..longstringlen] of char;
|
||||||
);
|
);
|
||||||
end;
|
end;
|
||||||
|
@ -5000,7 +5000,7 @@ case charKinds[ord(ch)] of
|
||||||
end {if}
|
end {if}
|
||||||
else if i = 1001 then begin
|
else if i = 1001 then begin
|
||||||
sPtr^.len2 := 1000;
|
sPtr^.len2 := 1000;
|
||||||
new(tsPtr,s4000);
|
new(tsPtr,sMAX);
|
||||||
CopyLongString(pointer(tsPtr), pointer(sPtr));
|
CopyLongString(pointer(tsPtr), pointer(sPtr));
|
||||||
dispose(sPtr);
|
dispose(sPtr);
|
||||||
sPtr := tsPtr;
|
sPtr := tsPtr;
|
||||||
|
@ -5021,7 +5021,7 @@ case charKinds[ord(ch)] of
|
||||||
Error(167);
|
Error(167);
|
||||||
end; {if}
|
end; {if}
|
||||||
i := 1;
|
i := 1;
|
||||||
new(sPtr,s4000);
|
new(sPtr,sMAX);
|
||||||
while not (charKinds[ord(ch)] in [ch_string,ch_eol,ch_eof]) do begin
|
while not (charKinds[ord(ch)] in [ch_string,ch_eol,ch_eof]) do begin
|
||||||
if i > longstringlen-8 then begin {leave space for char and null}
|
if i > longstringlen-8 then begin {leave space for char and null}
|
||||||
i := 1;
|
i := 1;
|
||||||
|
|
2
cc.notes
2
cc.notes
|
@ -120,7 +120,7 @@ Character and string constants may now have prefixes indicating they should use
|
||||||
|
|
||||||
p. 238
|
p. 238
|
||||||
|
|
||||||
The limit on the total length of string constants in a single function has been raised to 12500 characters.
|
The limit on the length of a single string constant is now 32760 bytes. The limit on the total length of string constants in a single function is now 12500 bytes (larger string constants can be used to initialize static arrays).
|
||||||
|
|
||||||
p. 239
|
p. 239
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user