summaryrefslogtreecommitdiff
path: root/packages/fcl-res
diff options
context:
space:
mode:
authorsvenbarth <svenbarth@3ad0048d-3df7-0310-abae-a5850022a9f2>2020-08-12 19:05:51 +0000
committersvenbarth <svenbarth@3ad0048d-3df7-0310-abae-a5850022a9f2>2020-08-12 19:05:51 +0000
commita00166a05b666a2b4523c51bd5dabe98bc31c64a (patch)
tree5cc5d7bd4e8d474a7dbe266b803ae4f12f92c72d /packages/fcl-res
parentf892ef6ebf794df59ef80b4ad4b4885f575e41c4 (diff)
downloadfpc-a00166a05b666a2b4523c51bd5dabe98bc31c64a.tar.gz
fcl-res: fix strings, literal RCDATA
Reintegrate fpcres-rc branch by Martok git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@46383 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/fcl-res')
-rw-r--r--packages/fcl-res/src/rcparser.pas294
-rw-r--r--packages/fcl-res/src/rcparser.y6
-rw-r--r--packages/fcl-res/src/rcparserfn.inc14
-rw-r--r--packages/fcl-res/src/rcreader.pp2
4 files changed, 168 insertions, 148 deletions
diff --git a/packages/fcl-res/src/rcparser.pas b/packages/fcl-res/src/rcparser.pas
index 7e79ffeb77..b68016041a 100644
--- a/packages/fcl-res/src/rcparser.pas
+++ b/packages/fcl-res/src/rcparser.pas
@@ -378,11 +378,16 @@ begin
end;
100 : begin
+ yyval.yyTMemoryStream:= yyv[yysp-0].yyTMemoryStream;
+
+ end;
+ 101 : begin
+
yyval.yyTMemoryStream:= yyv[yysp-1].yyTMemoryStream;
raw_write_string(yyval.yyTMemoryStream, yyv[yysp-0].yyrcstrtype);
end;
- 101 : begin
+ 102 : begin
yyval.yyTMemoryStream:= yyv[yysp-1].yyTMemoryStream;
raw_write_int(yyval.yyTMemoryStream, yyv[yysp-0].yyrcnumtype);
@@ -402,10 +407,10 @@ type YYARec = record
const
-yynacts = 639;
+yynacts = 643;
yyngotos = 141;
yynstates = 180;
-yynrules = 101;
+yynrules = 102;
yya : array [1..yynacts] of YYARec = (
{ 0: }
@@ -1086,6 +1091,8 @@ yya : array [1..yynacts] of YYARec = (
( sym: 261; act: 23 ),
( sym: 262; act: 24 ),
( sym: 263; act: 25 ),
+ ( sym: 44; act: -100 ),
+ ( sym: 265; act: -100 ),
{ 113: }
( sym: 44; act: 129 ),
( sym: 265; act: 130 ),
@@ -1143,6 +1150,8 @@ yya : array [1..yynacts] of YYARec = (
( sym: 261; act: 23 ),
( sym: 262; act: 24 ),
( sym: 263; act: 25 ),
+ ( sym: 44; act: -100 ),
+ ( sym: 265; act: -100 ),
{ 139: }
( sym: 264; act: 145 ),
{ 140: }
@@ -1681,8 +1690,8 @@ yyd : array [0..yynstates-1] of Integer = (
{ 124: } -43,
{ 125: } 0,
{ 126: } -97,
-{ 127: } -100,
-{ 128: } -101,
+{ 127: } -101,
+{ 128: } -102,
{ 129: } -98,
{ 130: } -41,
{ 131: } -18,
@@ -1850,73 +1859,73 @@ yyal : array [0..yynstates-1] of Integer = (
{ 110: } 560,
{ 111: } 560,
{ 112: } 560,
-{ 113: } 566,
-{ 114: } 568,
-{ 115: } 570,
-{ 116: } 571,
-{ 117: } 572,
-{ 118: } 572,
-{ 119: } 572,
-{ 120: } 572,
-{ 121: } 572,
-{ 122: } 572,
-{ 123: } 572,
-{ 124: } 578,
-{ 125: } 578,
-{ 126: } 582,
-{ 127: } 582,
-{ 128: } 582,
-{ 129: } 582,
-{ 130: } 582,
-{ 131: } 582,
-{ 132: } 582,
-{ 133: } 584,
-{ 134: } 585,
-{ 135: } 586,
-{ 136: } 586,
-{ 137: } 591,
-{ 138: } 591,
-{ 139: } 597,
-{ 140: } 598,
-{ 141: } 599,
-{ 142: } 600,
-{ 143: } 601,
-{ 144: } 601,
-{ 145: } 601,
-{ 146: } 601,
-{ 147: } 602,
-{ 148: } 603,
-{ 149: } 604,
-{ 150: } 606,
-{ 151: } 607,
-{ 152: } 608,
-{ 153: } 609,
-{ 154: } 610,
-{ 155: } 610,
-{ 156: } 615,
-{ 157: } 615,
-{ 158: } 616,
-{ 159: } 617,
-{ 160: } 618,
-{ 161: } 619,
-{ 162: } 620,
-{ 163: } 620,
-{ 164: } 620,
-{ 165: } 620,
-{ 166: } 622,
-{ 167: } 623,
-{ 168: } 623,
-{ 169: } 624,
-{ 170: } 625,
-{ 171: } 627,
-{ 172: } 628,
-{ 173: } 628,
-{ 174: } 628,
-{ 175: } 633,
-{ 176: } 634,
-{ 177: } 635,
-{ 178: } 635,
-{ 179: } 640
+{ 113: } 568,
+{ 114: } 570,
+{ 115: } 572,
+{ 116: } 573,
+{ 117: } 574,
+{ 118: } 574,
+{ 119: } 574,
+{ 120: } 574,
+{ 121: } 574,
+{ 122: } 574,
+{ 123: } 574,
+{ 124: } 580,
+{ 125: } 580,
+{ 126: } 584,
+{ 127: } 584,
+{ 128: } 584,
+{ 129: } 584,
+{ 130: } 584,
+{ 131: } 584,
+{ 132: } 584,
+{ 133: } 586,
+{ 134: } 587,
+{ 135: } 588,
+{ 136: } 588,
+{ 137: } 593,
+{ 138: } 593,
+{ 139: } 601,
+{ 140: } 602,
+{ 141: } 603,
+{ 142: } 604,
+{ 143: } 605,
+{ 144: } 605,
+{ 145: } 605,
+{ 146: } 605,
+{ 147: } 606,
+{ 148: } 607,
+{ 149: } 608,
+{ 150: } 610,
+{ 151: } 611,
+{ 152: } 612,
+{ 153: } 613,
+{ 154: } 614,
+{ 155: } 614,
+{ 156: } 619,
+{ 157: } 619,
+{ 158: } 620,
+{ 159: } 621,
+{ 160: } 622,
+{ 161: } 623,
+{ 162: } 624,
+{ 163: } 624,
+{ 164: } 624,
+{ 165: } 624,
+{ 166: } 626,
+{ 167: } 627,
+{ 168: } 627,
+{ 169: } 628,
+{ 170: } 629,
+{ 171: } 631,
+{ 172: } 632,
+{ 173: } 632,
+{ 174: } 632,
+{ 175: } 637,
+{ 176: } 638,
+{ 177: } 639,
+{ 178: } 639,
+{ 179: } 644
);
yyah : array [0..yynstates-1] of Integer = (
@@ -2032,74 +2041,74 @@ yyah : array [0..yynstates-1] of Integer = (
{ 109: } 559,
{ 110: } 559,
{ 111: } 559,
-{ 112: } 565,
-{ 113: } 567,
-{ 114: } 569,
-{ 115: } 570,
-{ 116: } 571,
-{ 117: } 571,
-{ 118: } 571,
-{ 119: } 571,
-{ 120: } 571,
-{ 121: } 571,
-{ 122: } 571,
-{ 123: } 577,
-{ 124: } 577,
-{ 125: } 581,
-{ 126: } 581,
-{ 127: } 581,
-{ 128: } 581,
-{ 129: } 581,
-{ 130: } 581,
-{ 131: } 581,
-{ 132: } 583,
-{ 133: } 584,
-{ 134: } 585,
-{ 135: } 585,
-{ 136: } 590,
-{ 137: } 590,
-{ 138: } 596,
-{ 139: } 597,
-{ 140: } 598,
-{ 141: } 599,
-{ 142: } 600,
-{ 143: } 600,
-{ 144: } 600,
-{ 145: } 600,
-{ 146: } 601,
-{ 147: } 602,
-{ 148: } 603,
-{ 149: } 605,
-{ 150: } 606,
-{ 151: } 607,
-{ 152: } 608,
-{ 153: } 609,
-{ 154: } 609,
-{ 155: } 614,
-{ 156: } 614,
-{ 157: } 615,
-{ 158: } 616,
-{ 159: } 617,
-{ 160: } 618,
-{ 161: } 619,
-{ 162: } 619,
-{ 163: } 619,
-{ 164: } 619,
-{ 165: } 621,
-{ 166: } 622,
-{ 167: } 622,
-{ 168: } 623,
-{ 169: } 624,
-{ 170: } 626,
-{ 171: } 627,
-{ 172: } 627,
-{ 173: } 627,
-{ 174: } 632,
-{ 175: } 633,
-{ 176: } 634,
-{ 177: } 634,
-{ 178: } 639,
-{ 179: } 639
+{ 112: } 567,
+{ 113: } 569,
+{ 114: } 571,
+{ 115: } 572,
+{ 116: } 573,
+{ 117: } 573,
+{ 118: } 573,
+{ 119: } 573,
+{ 120: } 573,
+{ 121: } 573,
+{ 122: } 573,
+{ 123: } 579,
+{ 124: } 579,
+{ 125: } 583,
+{ 126: } 583,
+{ 127: } 583,
+{ 128: } 583,
+{ 129: } 583,
+{ 130: } 583,
+{ 131: } 583,
+{ 132: } 585,
+{ 133: } 586,
+{ 134: } 587,
+{ 135: } 587,
+{ 136: } 592,
+{ 137: } 592,
+{ 138: } 600,
+{ 139: } 601,
+{ 140: } 602,
+{ 141: } 603,
+{ 142: } 604,
+{ 143: } 604,
+{ 144: } 604,
+{ 145: } 604,
+{ 146: } 605,
+{ 147: } 606,
+{ 148: } 607,
+{ 149: } 609,
+{ 150: } 610,
+{ 151: } 611,
+{ 152: } 612,
+{ 153: } 613,
+{ 154: } 613,
+{ 155: } 618,
+{ 156: } 618,
+{ 157: } 619,
+{ 158: } 620,
+{ 159: } 621,
+{ 160: } 622,
+{ 161: } 623,
+{ 162: } 623,
+{ 163: } 623,
+{ 164: } 623,
+{ 165: } 625,
+{ 166: } 626,
+{ 167: } 626,
+{ 168: } 627,
+{ 169: } 628,
+{ 170: } 630,
+{ 171: } 631,
+{ 172: } 631,
+{ 173: } 631,
+{ 174: } 636,
+{ 175: } 637,
+{ 176: } 638,
+{ 177: } 638,
+{ 178: } 643,
+{ 179: } 643
);
yygl : array [0..yynstates-1] of Integer = (
@@ -2568,8 +2577,9 @@ yyr : array [1..yynrules] of YYRRec = (
{ 97: } ( len: 2; sym: -9 ),
{ 98: } ( len: 0; sym: -41 ),
{ 99: } ( len: 4; sym: -9 ),
-{ 100: } ( len: 1; sym: -10 ),
-{ 101: } ( len: 1; sym: -10 )
+{ 100: } ( len: 0; sym: -10 ),
+{ 101: } ( len: 1; sym: -10 ),
+{ 102: } ( len: 1; sym: -10 )
);
diff --git a/packages/fcl-res/src/rcparser.y b/packages/fcl-res/src/rcparser.y
index 36a8fb3c07..515f4f53e0 100644
--- a/packages/fcl-res/src/rcparser.y
+++ b/packages/fcl-res/src/rcparser.y
@@ -207,7 +207,11 @@ raw_data
;
raw_item
- : long_string
+ : /* empty */
+ {
+ $$:= $<TMemoryStream>0;
+ }
+ | long_string
{
$$:= $<TMemoryStream>0;
raw_write_string($$, $1);
diff --git a/packages/fcl-res/src/rcparserfn.inc b/packages/fcl-res/src/rcparserfn.inc
index 33f70c9093..3636bb2790 100644
--- a/packages/fcl-res/src/rcparserfn.inc
+++ b/packages/fcl-res/src/rcparserfn.inc
@@ -17,6 +17,7 @@ var
yyfilename: AnsiString;
yyparseresult: YYSType;
+procedure SetDefaults;
procedure PragmaCodePage(cp: string);
{$DEFINE INC_HEADER}
@@ -199,8 +200,7 @@ begin
wc:= @uni[1];
rc:= val;
endin:= @val[len];
- while rc <= endin do begin // val must contain the final #0!
- // treat as null-terminated - nulls may exist *after* this proc, but not before
+ while rc < endin do begin
if (rc^ = '\') then begin
inc(rc);
case rc^ of
@@ -247,8 +247,8 @@ begin
inc(wc);
inc(rc);
end;
- i:= (PtrUInt(wc) - PtrUInt(@uni[1])) div 2; // includes final wc that was not written to
- SetLength(uni, i - 1);
+ i:= (PtrUInt(wc) - PtrUInt(@uni[1])) div SizeOf(WideChar);
+ SetLength(uni, i);
end;
string_new(str, uni, cp);
end;
@@ -384,4 +384,10 @@ begin
TVersionResource(aktresource).VarFileInfo.Add(ti);
end;
+procedure SetDefaults;
+begin
+ language:= $0409; // MS RC starts up as en-US
+ PragmaCodePage('DEFAULT');
+end;
+
diff --git a/packages/fcl-res/src/rcreader.pp b/packages/fcl-res/src/rcreader.pp
index e03bdbb4f4..dad2c020b6 100644
--- a/packages/fcl-res/src/rcreader.pp
+++ b/packages/fcl-res/src/rcreader.pp
@@ -86,7 +86,7 @@ begin
Reset(lexlib.yyinput);
try
rcparser.yyfilename:= '#MAIN.RC';
- rcparser.PragmaCodePage('DEFAULT');
+ rcparser.SetDefaults;
SetTextCodePage(lexlib.yyinput, rcparser.opt_code_page);
rcparser.yinclude.init();
rcparser.yinclude.WorkDir:= aLocation;