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;
{$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
thread is acceptable. If this is the case, returns it unaltered.
Otherwise it should return an acceptable value.

View File

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

View File

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