|
@@ -33,7 +33,7 @@ unit cresstr;
|
|
uses
|
|
uses
|
|
globals,aasm,verbose,files;
|
|
globals,aasm,verbose,files;
|
|
|
|
|
|
- Type
|
|
|
|
|
|
+ Type
|
|
PResourcestring = ^TResourceString;
|
|
PResourcestring = ^TResourceString;
|
|
TResourceString = record
|
|
TResourceString = record
|
|
Name : String;
|
|
Name : String;
|
|
@@ -48,14 +48,14 @@ unit cresstr;
|
|
resstrcount : longint = 0;
|
|
resstrcount : longint = 0;
|
|
resourcefilename = 'resource.rst';
|
|
resourcefilename = 'resource.rst';
|
|
|
|
|
|
- Var
|
|
|
|
|
|
+ Var
|
|
ResourceListRoot : PResourceString;
|
|
ResourceListRoot : PResourceString;
|
|
-
|
|
|
|
|
|
+
|
|
{ calcs the hash value for a give resourcestring, len is }
|
|
{ calcs the hash value for a give resourcestring, len is }
|
|
{ necessary because the resourcestring can contain #0 }
|
|
{ necessary because the resourcestring can contain #0 }
|
|
|
|
|
|
function calc_resstring_hashvalue(p : pchar;len : longint) : longint;
|
|
function calc_resstring_hashvalue(p : pchar;len : longint) : longint;
|
|
-
|
|
|
|
|
|
+
|
|
Var hash,g,I : longint;
|
|
Var hash,g,I : longint;
|
|
|
|
|
|
begin
|
|
begin
|
|
@@ -69,7 +69,7 @@ unit cresstr;
|
|
begin
|
|
begin
|
|
hash:=hash xor (g shr 24);
|
|
hash:=hash xor (g shr 24);
|
|
hash:=hash xor g;
|
|
hash:=hash xor g;
|
|
- end;
|
|
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
If Hash=0 then
|
|
If Hash=0 then
|
|
Calc_resstring_hashvalue:=Not(0)
|
|
Calc_resstring_hashvalue:=Not(0)
|
|
@@ -83,14 +83,15 @@ unit cresstr;
|
|
if not(assigned(resourcestringlist)) then
|
|
if not(assigned(resourcestringlist)) then
|
|
resourcestringlist:=new(paasmoutput,init);
|
|
resourcestringlist:=new(paasmoutput,init);
|
|
resourcestringlist^.insert(new(pai_const,init_32bit(resstrcount)));
|
|
resourcestringlist^.insert(new(pai_const,init_32bit(resstrcount)));
|
|
- resourcestringlist^.insert(new(pai_symbol,initname_global('RESOURCESTRINGLIST')));
|
|
|
|
|
|
+ resourcestringlist^.insert(new(pai_symbol,initname_global('RESOURCESTRINGLIST',0)));
|
|
|
|
+ resourcestringlist^.concat(new(pai_symbol_end,initname('RESOURCESTRINGLIST')));
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
Procedure AppendToResourceList(const name : string;p : pchar;len,hash : longint);
|
|
Procedure AppendToResourceList(const name : string;p : pchar;len,hash : longint);
|
|
-
|
|
|
|
|
|
+
|
|
Var R : PResourceString;
|
|
Var R : PResourceString;
|
|
-
|
|
|
|
|
|
+
|
|
begin
|
|
begin
|
|
inc(resstrcount);
|
|
inc(resstrcount);
|
|
New(R);
|
|
New(R);
|
|
@@ -117,8 +118,8 @@ unit cresstr;
|
|
if not(assigned(resourcestringlist)) then
|
|
if not(assigned(resourcestringlist)) then
|
|
resourcestringlist:=new(paasmoutput,init);
|
|
resourcestringlist:=new(paasmoutput,init);
|
|
|
|
|
|
- AppendToResourceList(current_module^.modulename^+'.'+Name,P,Len,Hash);
|
|
|
|
-
|
|
|
|
|
|
+ AppendToResourceList(current_module^.modulename^+'.'+Name,P,Len,Hash);
|
|
|
|
+
|
|
{ an empty ansi string is nil! }
|
|
{ an empty ansi string is nil! }
|
|
if (p=nil) or (len=0) then
|
|
if (p=nil) or (len=0) then
|
|
resourcestringlist^.concat(new(pai_const,init_32bit(0)))
|
|
resourcestringlist^.concat(new(pai_const,init_32bit(0)))
|
|
@@ -145,25 +146,25 @@ unit cresstr;
|
|
end;
|
|
end;
|
|
|
|
|
|
Procedure WriteResourceFile(Filename : String);
|
|
Procedure WriteResourceFile(Filename : String);
|
|
-
|
|
|
|
|
|
+
|
|
Type
|
|
Type
|
|
TMode = (quoted,unquoted);
|
|
TMode = (quoted,unquoted);
|
|
-
|
|
|
|
|
|
+
|
|
Var F : Text;
|
|
Var F : Text;
|
|
Mode : TMode;
|
|
Mode : TMode;
|
|
old : PresourceString;
|
|
old : PresourceString;
|
|
C : char;
|
|
C : char;
|
|
Col,i : longint;
|
|
Col,i : longint;
|
|
-
|
|
|
|
|
|
+
|
|
Procedure Add(Const S : String);
|
|
Procedure Add(Const S : String);
|
|
-
|
|
|
|
|
|
+
|
|
begin
|
|
begin
|
|
Write(F,S);
|
|
Write(F,S);
|
|
Col:=Col+length(s);
|
|
Col:=Col+length(s);
|
|
end;
|
|
end;
|
|
-
|
|
|
|
|
|
+
|
|
begin
|
|
begin
|
|
- If resstrCount=0 then
|
|
|
|
|
|
+ If resstrCount=0 then
|
|
exit;
|
|
exit;
|
|
FileName:=ForceExtension(lower(FileName),'.rst');
|
|
FileName:=ForceExtension(lower(FileName),'.rst');
|
|
message1 (general_i_writingresourcefile,filename);
|
|
message1 (general_i_writingresourcefile,filename);
|
|
@@ -189,7 +190,7 @@ unit cresstr;
|
|
C:=Value[i];
|
|
C:=Value[i];
|
|
If (ord(C)>31) and (Ord(c)<=128) and (c<>'''') then
|
|
If (ord(C)>31) and (Ord(c)<=128) and (c<>'''') then
|
|
begin
|
|
begin
|
|
- If mode=Quoted then
|
|
|
|
|
|
+ If mode=Quoted then
|
|
Add(c)
|
|
Add(c)
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
@@ -204,10 +205,10 @@ unit cresstr;
|
|
Add('''');
|
|
Add('''');
|
|
mode:=unquoted;
|
|
mode:=unquoted;
|
|
end;
|
|
end;
|
|
- Add('#'+tostr(ord(c)));
|
|
|
|
|
|
+ Add('#'+tostr(ord(c)));
|
|
end;
|
|
end;
|
|
If Col>72 then
|
|
If Col>72 then
|
|
- begin
|
|
|
|
|
|
+ begin
|
|
if mode=quoted then
|
|
if mode=quoted then
|
|
Write (F,'''');
|
|
Write (F,'''');
|
|
Writeln(F,'+');
|
|
Writeln(F,'+');
|
|
@@ -215,7 +216,7 @@ unit cresstr;
|
|
Mode:=unQuoted;
|
|
Mode:=unQuoted;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
- if mode=quoted then writeln (f,'''');
|
|
|
|
|
|
+ if mode=quoted then writeln (f,'''');
|
|
Writeln(f);
|
|
Writeln(f);
|
|
Old :=ResourceListRoot;
|
|
Old :=ResourceListRoot;
|
|
ResourceListRoot:=old^.Next;
|
|
ResourceListRoot:=old^.Next;
|
|
@@ -228,7 +229,10 @@ unit cresstr;
|
|
end.
|
|
end.
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.7 1999-07-26 09:42:00 florian
|
|
|
|
|
|
+ Revision 1.8 1999-07-29 20:54:01 peter
|
|
|
|
+ * write .size also
|
|
|
|
+
|
|
|
|
+ Revision 1.7 1999/07/26 09:42:00 florian
|
|
* bugs 494-496 fixed
|
|
* bugs 494-496 fixed
|
|
|
|
|
|
Revision 1.6 1999/07/25 19:27:15 michael
|
|
Revision 1.6 1999/07/25 19:27:15 michael
|