Adjustments so that the resource string related tables are provided inside the system unit (both for indirect and direct entry targets).

rtl/inc/system.inc:
  + new variables that hold pointers to the tables
  + new procedure SetupEntryInformation() that should be used in the entry points of indirect entry targets to setup cross target fields
  + for direct entry targets the two resource string tables are imported here and supplied as initialization to the table pointers
objpas/objpas.pp:
  * adjust table declarations so that the pointers provided from the System unit are used
  * adjust usages of the tables as they are now pointers
win32/system.pp:
  * Exe_Entry: use SetupEntryInformation()
win/syswin.inc:
  * Dll_Entry: use SetupEntryInformation()

git-svn-id: trunk@33028 -
This commit is contained in:
svenbarth 2016-01-29 17:19:33 +00:00
parent 7b67ead440
commit e3060130a4
4 changed files with 36 additions and 10 deletions

View File

@ -105,6 +105,30 @@ var
EntryInformation: TEntryInformation; EntryInformation: TEntryInformation;
{$endif FPC_HAS_INDIRECT_MAIN_INFORMATION} {$endif FPC_HAS_INDIRECT_MAIN_INFORMATION}
var
{$ifdef FPC_HAS_INDIRECT_MAIN_INFORMATION}
{$ifdef FPC_HAS_RESSTRINITS}
FPCResStrInitTables : Pointer;public name '_FPC_ResStrInitTables';
{$endif FPC_HAS_RESSTRINITS}
FPCResourceStringTables : Pointer;public name '_FPC_ResourceStringTables';
{$else FPC_HAS_INDIRECT_MAIN_INFORMATION}
{$ifdef FPC_HAS_RESSTRINITS}
FPCResStrInitTablesVar : record end; external name 'FPC_RESSTRINITTABLES';
FPCResStrInitTables : Pointer = @FPCResStrInitTablesVar;public name '_FPC_ResStrInitTables';
{$endif FPC_HAS_RESSTRINITS}
FPCResourceStringTablesVar : record end; External Name 'FPC_RESOURCESTRINGTABLES';
FPCResourceStringTables : Pointer = @FPCResourceStringTablesVar;public name '_FPC_ResourceStringTables';
{$endif FPC_HAS_INDIRECT_MAIN_INFORMATION}
{$ifdef FPC_HAS_INDIRECT_MAIN_INFORMATION}
procedure SetupEntryInformation(const info: TEntryInformation);
begin
EntryInformation := info;
FPCResStrInitTables := info.ResStrInitTables;
FPCResourceStringTables := info.ResourceStringTables;
end;
{$endif FPC_HAS_INDIRECT_MAIN_INFORMATION}
{ checks whether the given suggested size for the stack of the current { checks whether the given suggested size for the stack of the current
thread is acceptable. If this is the case, returns it unaltered. thread is acceptable. If this is the case, returns it unaltered.
Otherwise it should return an acceptable value. Otherwise it should return an acceptable value.

View File

@ -320,6 +320,7 @@ Type
TableEnd : PResourceStringRecord; TableEnd : PResourceStringRecord;
end; end;
end; end;
PResourceStringTableList = ^TResourceStringTableList;
{ Support for string constants initialized with resourcestrings } { Support for string constants initialized with resourcestrings }
{$ifdef FPC_HAS_RESSTRINITS} {$ifdef FPC_HAS_RESSTRINITS}
@ -333,18 +334,19 @@ Type
Count: {$ifdef VER2_6}longint{$else}sizeint{$endif}; Count: {$ifdef VER2_6}longint{$else}sizeint{$endif};
Tables: packed array[1..{$ifdef cpu16}8191{$else cpu16}32767{$endif cpu16}] of PResStrInitEntry; Tables: packed array[1..{$ifdef cpu16}8191{$else cpu16}32767{$endif cpu16}] of PResStrInitEntry;
end; end;
PResStrInitTable = ^TResStrInitTable;
var var
ResStrInitTable : TResStrInitTable; external name 'FPC_RESSTRINITTABLES'; ResStrInitTable : PResStrInitTable; external name '_FPC_ResStrInitTables';
procedure UpdateResourceStringRefs; procedure UpdateResourceStringRefs;
var var
i: integer; i: integer;
ptable: PResStrInitEntry; ptable: PResStrInitEntry;
begin begin
for i:=1 to ResStrInitTable.Count do for i:=1 to ResStrInitTable^.Count do
begin begin
ptable:=ResStrInitTable.Tables[i]; ptable:=ResStrInitTable^.Tables[i];
while Assigned(ptable^.Addr) do while Assigned(ptable^.Addr) do
begin begin
AnsiString(ptable^.Addr^):=ptable^.Data^.CurrentValue; AnsiString(ptable^.Addr^):=ptable^.Data^.CurrentValue;
@ -355,7 +357,7 @@ end;
{$endif FPC_HAS_RESSTRINITS} {$endif FPC_HAS_RESSTRINITS}
Var Var
ResourceStringTable : TResourceStringTableList; External Name 'FPC_RESOURCESTRINGTABLES'; ResourceStringTable : PResourceStringTableList; External Name '_FPC_ResourceStringTables';
Procedure SetResourceStrings (SetFunction : TResourceIterator;arg:pointer); Procedure SetResourceStrings (SetFunction : TResourceIterator;arg:pointer);
Var Var
@ -363,7 +365,7 @@ Var
i : integer; i : integer;
s : AnsiString; s : AnsiString;
begin begin
With ResourceStringTable do With ResourceStringTable^ do
begin begin
For i:=0 to Count-1 do For i:=0 to Count-1 do
begin begin
@ -392,7 +394,7 @@ Var
s, s,
UpUnitName : AnsiString; UpUnitName : AnsiString;
begin begin
With ResourceStringTable do With ResourceStringTable^ do
begin begin
UpUnitName:=UpCase(UnitName); UpUnitName:=UpCase(UnitName);
For i:=0 to Count-1 do For i:=0 to Count-1 do
@ -424,7 +426,7 @@ Var
ResStr : PResourceStringRecord; ResStr : PResourceStringRecord;
i : integer; i : integer;
begin begin
With ResourceStringTable do With ResourceStringTable^ do
begin begin
For i:=0 to Count-1 do For i:=0 to Count-1 do
begin begin
@ -446,7 +448,7 @@ Var
ResStr : PResourceStringRecord; ResStr : PResourceStringRecord;
i : integer; i : integer;
begin begin
With ResourceStringTable do With ResourceStringTable^ do
begin begin
For i:=0 to Count-1 do For i:=0 to Count-1 do
begin begin

View File

@ -359,7 +359,7 @@ Var
function Dll_entry{$ifdef FPC_HAS_INDIRECT_MAIN_INFORMATION}(const info : TEntryInformation){$endif FPC_HAS_INDIRECT_MAIN_INFORMATION} : longbool; [public,alias:'_FPC_DLL_Entry']; function Dll_entry{$ifdef FPC_HAS_INDIRECT_MAIN_INFORMATION}(const info : TEntryInformation){$endif FPC_HAS_INDIRECT_MAIN_INFORMATION} : longbool; [public,alias:'_FPC_DLL_Entry'];
begin begin
{$ifdef FPC_HAS_INDIRECT_MAIN_INFORMATION} {$ifdef FPC_HAS_INDIRECT_MAIN_INFORMATION}
EntryInformation:=info; SetupEntryInformation(info);
{$endif FPC_HAS_INDIRECT_MAIN_INFORMATION} {$endif FPC_HAS_INDIRECT_MAIN_INFORMATION}
IsLibrary:=true; IsLibrary:=true;
DllInitState:=DLLreason; DllInitState:=DLLreason;

View File

@ -186,7 +186,7 @@ procedure Exe_entry(const info : TEntryInformation);[public,alias:'_FPC_EXE_Entr
var var
xframe: TEXCEPTION_FRAME; xframe: TEXCEPTION_FRAME;
begin begin
EntryInformation:=info; SetupEntryInformation(info);
IsLibrary:=false; IsLibrary:=false;
{ install the handlers for exe only ? { install the handlers for exe only ?
or should we install them for DLL also ? (PM) } or should we install them for DLL also ? (PM) }