|
@@ -1,11 +1,9 @@
|
|
{%MainUnit rcparser.pas}
|
|
{%MainUnit rcparser.pas}
|
|
|
|
|
|
-{$modeswitch advancedrecords}
|
|
|
|
-
|
|
|
|
interface
|
|
interface
|
|
|
|
|
|
uses
|
|
uses
|
|
- SysUtils, Classes, StrUtils, lexlib, yacclib, resource,
|
|
|
|
|
|
+ SysUtils, Classes, StrUtils, Contnrs, lexlib, yacclib, resource,
|
|
acceleratorsresource, groupiconresource, stringtableresource,
|
|
acceleratorsresource, groupiconresource, stringtableresource,
|
|
bitmapresource, versionresource, versiontypes, groupcursorresource;
|
|
bitmapresource, versionresource, versiontypes, groupcursorresource;
|
|
|
|
|
|
@@ -17,6 +15,7 @@ var
|
|
yyfilename: AnsiString;
|
|
yyfilename: AnsiString;
|
|
yyparseresult: YYSType;
|
|
yyparseresult: YYSType;
|
|
|
|
|
|
|
|
+procedure DisposePools;
|
|
procedure SetDefaults;
|
|
procedure SetDefaults;
|
|
procedure PragmaCodePage(cp: string);
|
|
procedure PragmaCodePage(cp: string);
|
|
|
|
|
|
@@ -137,11 +136,19 @@ begin
|
|
Result.v:= str_to_cbase(s);
|
|
Result.v:= str_to_cbase(s);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+type
|
|
|
|
+ PStrPoolItem = ^TStrPoolItem;
|
|
|
|
+ TStrPoolItem = record
|
|
|
|
+ str: PUnicodeString;
|
|
|
|
+ next: PStrPoolItem;
|
|
|
|
+ end;
|
|
|
|
+
|
|
const
|
|
const
|
|
MAX_RCSTR_LEN = 4096;
|
|
MAX_RCSTR_LEN = 4096;
|
|
var
|
|
var
|
|
strbuf: array[0..MAX_RCSTR_LEN + 1] of char;
|
|
strbuf: array[0..MAX_RCSTR_LEN + 1] of char;
|
|
strbuflen: Integer;
|
|
strbuflen: Integer;
|
|
|
|
+ stringpool: PStrPoolItem = nil;
|
|
|
|
|
|
procedure strbuf_begin();
|
|
procedure strbuf_begin();
|
|
begin
|
|
begin
|
|
@@ -161,10 +168,17 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure string_new(var str: rcstrtype; val: UnicodeString; cp: TSystemCodePage);
|
|
procedure string_new(var str: rcstrtype; val: UnicodeString; cp: TSystemCodePage);
|
|
|
|
+var
|
|
|
|
+ s: PStrPoolItem;
|
|
begin
|
|
begin
|
|
New(str.v);
|
|
New(str.v);
|
|
str.v^:= val;
|
|
str.v^:= val;
|
|
str.cp:= cp;
|
|
str.cp:= cp;
|
|
|
|
+
|
|
|
|
+ New(s);
|
|
|
|
+ s^.next:= stringpool;
|
|
|
|
+ s^.str:= str.v;
|
|
|
|
+ stringpool:= s;
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure string_new_uni(var str: rcstrtype; val: PAnsiChar; len: integer; cp: TSystemCodePage; escapes: boolean);
|
|
procedure string_new_uni(var str: rcstrtype; val: PAnsiChar; len: integer; cp: TSystemCodePage; escapes: boolean);
|
|
@@ -273,6 +287,8 @@ begin
|
|
r.LangID:= language;
|
|
r.LangID:= language;
|
|
aktresources.Add(r);
|
|
aktresources.Add(r);
|
|
aktresource:= r;
|
|
aktresource:= r;
|
|
|
|
+ aId.Free;
|
|
|
|
+ aType.Free;
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure create_resource(aId, aType: TResourceDesc); overload;
|
|
procedure create_resource(aId, aType: TResourceDesc); overload;
|
|
@@ -398,4 +414,15 @@ begin
|
|
PragmaCodePage('DEFAULT');
|
|
PragmaCodePage('DEFAULT');
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure DisposePools;
|
|
|
|
+var
|
|
|
|
+ s: PStrPoolItem;
|
|
|
|
+begin
|
|
|
|
+ while stringpool <> nil do begin
|
|
|
|
+ s:= stringpool;
|
|
|
|
+ stringpool:= s^.next;
|
|
|
|
+ dispose(s^.str);
|
|
|
|
+ dispose(s);
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
|