mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2026-01-07 13:00:39 +01:00
* new fixfilename, findfile for unix. Look first for lowercase, then
NormalCase and last for UPPERCASE names.
This commit is contained in:
parent
3ea409ab44
commit
a7fe3cb6b9
@ -78,9 +78,9 @@ var
|
||||
begin
|
||||
resbin:='';
|
||||
if utilsdirectory<>'' then
|
||||
resbin:=FindFile(target_res.resbin+source_os.exeext,utilsdirectory,resfound)+target_res.resbin+source_os.exeext;
|
||||
if resbin='' then
|
||||
resbin:=FindExe(target_res.resbin,resfound);
|
||||
resfound:=FindFile(target_res.resbin+source_os.exeext,utilsdirectory,resbin);
|
||||
if not resfound then
|
||||
resfound:=FindExe(target_res.resbin,resbin);
|
||||
{ get also the path to be searched for the windres.h }
|
||||
fsplit(resbin,respath,n,e);
|
||||
if (not resfound) and not(cs_link_extern in aktglobalswitches) then
|
||||
@ -142,7 +142,11 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 2000-12-25 00:07:25 peter
|
||||
Revision 1.7 2001-02-20 21:41:17 peter
|
||||
* new fixfilename, findfile for unix. Look first for lowercase, then
|
||||
NormalCase and last for UPPERCASE names.
|
||||
|
||||
Revision 1.6 2000/12/25 00:07:25 peter
|
||||
+ new tlinkedlist class (merge of old tstringqueue,tcontainer and
|
||||
tlinkedlist objects)
|
||||
|
||||
|
||||
@ -455,23 +455,24 @@ uses
|
||||
singlepathstring,
|
||||
filename : string;
|
||||
|
||||
Function UnitExists(const ext:string):boolean;
|
||||
Function UnitExists(const ext:string;var foundfile:string):boolean;
|
||||
begin
|
||||
Message1(unit_t_unitsearch,Singlepathstring+filename+ext);
|
||||
UnitExists:=FileExists(Singlepathstring+FileName+ext);
|
||||
UnitExists:=FindFile(FileName+ext,Singlepathstring,foundfile);
|
||||
end;
|
||||
|
||||
Function PPUSearchPath(const s:string):boolean;
|
||||
var
|
||||
found : boolean;
|
||||
found : boolean;
|
||||
hs : string;
|
||||
begin
|
||||
Found:=false;
|
||||
singlepathstring:=FixPath(s,false);
|
||||
{ Check for PPU file }
|
||||
Found:=UnitExists(target_info.unitext);
|
||||
Found:=UnitExists(target_info.unitext,hs);
|
||||
if Found then
|
||||
Begin
|
||||
SetFileName(SinglePathString+FileName,false);
|
||||
SetFileName(hs,false);
|
||||
Found:=OpenPPU;
|
||||
End;
|
||||
PPUSearchPath:=Found;
|
||||
@ -481,6 +482,7 @@ uses
|
||||
var
|
||||
found : boolean;
|
||||
ext : string[8];
|
||||
hs : string;
|
||||
begin
|
||||
Found:=false;
|
||||
singlepathstring:=FixPath(s,false);
|
||||
@ -489,13 +491,11 @@ uses
|
||||
do_compile:=true;
|
||||
recompile_reason:=rr_noppu;
|
||||
{Check for .pp file}
|
||||
Found:=UnitExists(target_os.sourceext);
|
||||
if Found then
|
||||
Ext:=target_os.sourceext
|
||||
else
|
||||
Found:=UnitExists(target_os.sourceext,hs);
|
||||
if not Found then
|
||||
begin
|
||||
{Check for .pas}
|
||||
Found:=UnitExists(target_os.pasext);
|
||||
{ Check for .pas }
|
||||
Found:=UnitExists(target_os.pasext,hs);
|
||||
if Found then
|
||||
Ext:=target_os.pasext;
|
||||
end;
|
||||
@ -503,9 +503,9 @@ uses
|
||||
if Found then
|
||||
begin
|
||||
sources_avail:=true;
|
||||
{Load Filenames when found}
|
||||
mainsource:=StringDup(SinglePathString+FileName+Ext);
|
||||
SetFileName(SinglePathString+FileName,false);
|
||||
{ Load Filenames when found }
|
||||
mainsource:=StringDup(hs);
|
||||
SetFileName(hs,false);
|
||||
end
|
||||
else
|
||||
sources_avail:=false;
|
||||
@ -873,7 +873,11 @@ uses
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 2000-12-25 00:07:25 peter
|
||||
Revision 1.7 2001-02-20 21:41:15 peter
|
||||
* new fixfilename, findfile for unix. Look first for lowercase, then
|
||||
NormalCase and last for UPPERCASE names.
|
||||
|
||||
Revision 1.6 2000/12/25 00:07:25 peter
|
||||
+ new tlinkedlist class (merge of old tstringqueue,tcontainer and
|
||||
tlinkedlist objects)
|
||||
|
||||
|
||||
@ -91,7 +91,7 @@ interface
|
||||
TSearchPathList = class(TStringList)
|
||||
procedure AddPath(s:string;addfirst:boolean);
|
||||
procedure AddList(list:TSearchPathList;addfirst:boolean);
|
||||
function FindFile(const f : string;var b : boolean) : string;
|
||||
function FindFile(const f : string;var foundfile:string):boolean;
|
||||
end;
|
||||
|
||||
var
|
||||
@ -254,8 +254,8 @@ interface
|
||||
function FixFileName(const s:string):string;
|
||||
procedure SplitBinCmd(const s:string;var bstr,cstr:string);
|
||||
procedure SynchronizeFileTime(const fn1,fn2:string);
|
||||
function FindFile(const f : string;path : string;var b : boolean) : string;
|
||||
function FindExe(bin:string;var found:boolean):string;
|
||||
function FindFile(const f : string;path : string;var foundfile:string):boolean;
|
||||
function FindExe(const bin:string;var foundfile:string):boolean;
|
||||
function GetShortName(const n:string):string;
|
||||
|
||||
Procedure Shell(const command:string);
|
||||
@ -619,29 +619,19 @@ implementation
|
||||
function FixFileName(const s:string):string;
|
||||
var
|
||||
i : longint;
|
||||
{$ifdef Linux}
|
||||
NoPath : boolean;
|
||||
{$endif Linux}
|
||||
begin
|
||||
{$ifdef Linux}
|
||||
NoPath:=true;
|
||||
{$endif Linux}
|
||||
for i:=length(s) downto 1 do
|
||||
begin
|
||||
case s[i] of
|
||||
{$ifdef Linux}
|
||||
'/','\' : begin
|
||||
FixFileName[i]:='/';
|
||||
NoPath:=false; {Skip lowercasing path: 'X11'<>'x11' }
|
||||
end;
|
||||
'A'..'Z' : if NoPath then
|
||||
FixFileName[i]:=char(byte(s[i])+32)
|
||||
else
|
||||
FixFileName[i]:=s[i];
|
||||
{$else}
|
||||
'/' : FixFileName[i]:='\';
|
||||
'A'..'Z' : FixFileName[i]:=char(byte(s[i])+32);
|
||||
{$endif}
|
||||
{$ifdef Unix}
|
||||
'/','\' :
|
||||
FixFileName[i]:='/';
|
||||
{$else Unix}
|
||||
'/' :
|
||||
FixFileName[i]:='\';
|
||||
'A'..'Z' :
|
||||
FixFileName[i]:=char(byte(s[i])+32);
|
||||
{$endif Unix}
|
||||
else
|
||||
FixFileName[i]:=s[i];
|
||||
end;
|
||||
@ -805,23 +795,45 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function TSearchPathList.FindFile(const f : string;var b : boolean) : string;
|
||||
function TSearchPathList.FindFile(const f : string;var foundfile:string):boolean;
|
||||
Var
|
||||
p : TStringListItem;
|
||||
begin
|
||||
FindFile:='';
|
||||
b:=false;
|
||||
FindFile:=false;
|
||||
p:=TStringListItem(first);
|
||||
while assigned(p) do
|
||||
begin
|
||||
If FileExists(p.Str+f) then
|
||||
{
|
||||
Search order for case sensitive systems:
|
||||
1. lowercase
|
||||
2. NormalCase
|
||||
3. UPPERCASE
|
||||
None case sensitive only lowercase
|
||||
}
|
||||
FoundFile:=p.Str+Lower(f);
|
||||
If FileExists(FoundFile) then
|
||||
begin
|
||||
FindFile:=p.Str;
|
||||
b:=true;
|
||||
FindFile:=true;
|
||||
exit;
|
||||
end;
|
||||
{$ifdef UNIX}
|
||||
FoundFile:=p.Str+f;
|
||||
If FileExists(FoundFile) then
|
||||
begin
|
||||
FindFile:=true;
|
||||
exit;
|
||||
end;
|
||||
FoundFile:=p.Str+Upper(f);
|
||||
If FileExists(FoundFile) then
|
||||
begin
|
||||
FindFile:=true;
|
||||
exit;
|
||||
end;
|
||||
{$endif UNIX}
|
||||
p:=TStringListItem(p.next);
|
||||
end;
|
||||
{ Return original filename if not found }
|
||||
FoundFile:=f;
|
||||
end;
|
||||
|
||||
|
||||
@ -877,40 +889,61 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function FindFile(const f : string;path : string;var b : boolean) : string;
|
||||
function FindFile(const f : string;path : string;var foundfile:string):boolean;
|
||||
Var
|
||||
singlepathstring : string;
|
||||
i : longint;
|
||||
begin
|
||||
{$ifdef unix}
|
||||
{$ifdef Unix}
|
||||
for i:=1 to length(path) do
|
||||
if path[i]=':' then
|
||||
path[i]:=';';
|
||||
{$endif}
|
||||
b:=false;
|
||||
FindFile:='';
|
||||
path[i]:=';';
|
||||
{$endif Unix}
|
||||
FindFile:=false;
|
||||
repeat
|
||||
i:=pos(';',path);
|
||||
if i=0 then
|
||||
i:=pos(';',path);
|
||||
if i=0 then
|
||||
i:=256;
|
||||
singlepathstring:=FixPath(copy(path,1,i-1),false);
|
||||
delete(path,1,i);
|
||||
If FileExists (singlepathstring+f) then
|
||||
singlepathstring:=FixPath(copy(path,1,i-1),false);
|
||||
delete(path,1,i);
|
||||
{
|
||||
Search order for case sensitive systems:
|
||||
1. lowercase
|
||||
2. NormalCase
|
||||
3. UPPERCASE
|
||||
None case sensitive only lowercase
|
||||
}
|
||||
FoundFile:=singlepathstring+Lower(f);
|
||||
If FileExists(FoundFile) then
|
||||
begin
|
||||
FindFile:=singlepathstring;
|
||||
b:=true;
|
||||
FindFile:=true;
|
||||
exit;
|
||||
end;
|
||||
{$ifdef UNIX}
|
||||
FoundFile:=singlepathstring+f;
|
||||
If FileExists(FoundFile) then
|
||||
begin
|
||||
FindFile:=true;
|
||||
exit;
|
||||
end;
|
||||
FoundFile:=singlepathstring+Upper(f);
|
||||
If FileExists(FoundFile) then
|
||||
begin
|
||||
FindFile:=true;
|
||||
exit;
|
||||
end;
|
||||
{$endif UNIX}
|
||||
until path='';
|
||||
FoundFile:=f;
|
||||
end;
|
||||
|
||||
function FindExe(bin:string;var found:boolean):string;
|
||||
|
||||
function FindExe(const bin:string;var foundfile:string):boolean;
|
||||
begin
|
||||
bin:=FixFileName(AddExtension(bin,source_os.exeext));
|
||||
{$ifdef delphi}
|
||||
FindExe:=FindFile(bin,'.;'+exepath+';'+dmisc.getenv('PATH'),found)+bin;
|
||||
FindExe:=FindFile(FixFileName(AddExtension(bin,source_os.exeext)),'.;'+exepath+';'+dmisc.getenv('PATH'),foundfile);
|
||||
{$else delphi}
|
||||
FindExe:=FindFile(bin,'.;'+exepath+';'+dos.getenv('PATH'),found)+bin;
|
||||
FindExe:=FindFile(FixFileName(AddExtension(bin,source_os.exeext)),'.;'+exepath+';'+dos.getenv('PATH'),foundfile);
|
||||
{$endif delphi}
|
||||
end;
|
||||
|
||||
@ -1182,9 +1215,6 @@ implementation
|
||||
var
|
||||
hs1 : namestr;
|
||||
hs2 : extstr;
|
||||
{$ifdef need_path_search}
|
||||
b : boolean;
|
||||
{$endif}
|
||||
begin
|
||||
{$ifdef delphi}
|
||||
exepath:=dmisc.getenv('PPC_EXEC_PATH');
|
||||
@ -1200,10 +1230,11 @@ implementation
|
||||
(length(hs1) - length(source_os.exeext)+1) then
|
||||
hs1 := hs1 + source_os.exeext;
|
||||
{$ifdef delphi}
|
||||
exepath := findfile(hs1,dmisc.getenv('PATH'),b);
|
||||
findfile(hs1,dmisc.getenv('PATH'),exepath);
|
||||
{$else delphi}
|
||||
exepath := findfile(hs1,dos.getenv('PATH'),b);
|
||||
findfile(hs1,dos.getenv('PATH'),exepath);
|
||||
{$endif delphi}
|
||||
exepath:=SplitPath(exepath);
|
||||
end;
|
||||
{$endif need_path_search}
|
||||
exepath:=FixPath(exepath,false);
|
||||
@ -1310,7 +1341,11 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.27 2001-02-09 23:05:45 peter
|
||||
Revision 1.28 2001-02-20 21:41:16 peter
|
||||
* new fixfilename, findfile for unix. Look first for lowercase, then
|
||||
NormalCase and last for UPPERCASE names.
|
||||
|
||||
Revision 1.27 2001/02/09 23:05:45 peter
|
||||
* default packenum=1 for tp7 mode
|
||||
|
||||
Revision 1.26 2001/02/05 20:47:00 peter
|
||||
|
||||
@ -255,9 +255,9 @@ begin
|
||||
FoundBin:='';
|
||||
Found:=false;
|
||||
if utilsdirectory<>'' then
|
||||
FoundBin:=FindFile(utilexe,utilsdirectory,Found)+utilexe;
|
||||
Found:=FindFile(utilexe,utilsdirectory,Foundbin);
|
||||
if (not Found) then
|
||||
FoundBin:=FindExe(utilexe,Found);
|
||||
Found:=FindExe(utilexe,Foundbin);
|
||||
if (not Found) and not(cs_link_extern in aktglobalswitches) then
|
||||
begin
|
||||
Message1(exec_w_util_not_found,utilexe);
|
||||
@ -273,6 +273,7 @@ end;
|
||||
function TLinker.FindObjectFile(s:string;const unitpath:string) : string;
|
||||
var
|
||||
found : boolean;
|
||||
foundfile : string;
|
||||
begin
|
||||
findobjectfile:='';
|
||||
if s='' then
|
||||
@ -294,24 +295,27 @@ begin
|
||||
6. exepath }
|
||||
found:=false;
|
||||
if unitpath<>'' then
|
||||
findobjectfile:=FindFile(s,unitpath,found)+s;
|
||||
found:=FindFile(s,unitpath,foundfile);
|
||||
if (not found) then
|
||||
findobjectfile:=FindFile(s,'.'+DirSep,found)+s;
|
||||
found:=FindFile(s,'.'+DirSep,foundfile);
|
||||
if (not found) then
|
||||
findobjectfile:=UnitSearchPath.FindFile(s,found)+s;
|
||||
found:=UnitSearchPath.FindFile(s,foundfile);
|
||||
if (not found) then
|
||||
findobjectfile:=current_module.localobjectsearchpath.FindFile(s,found)+s;
|
||||
found:=current_module.localobjectsearchpath.FindFile(s,foundfile);
|
||||
if (not found) then
|
||||
findobjectfile:=objectsearchpath.FindFile(s,found)+s;
|
||||
found:=objectsearchpath.FindFile(s,foundfile);
|
||||
if (not found) then
|
||||
findobjectfile:=FindFile(s,exepath,found)+s;
|
||||
found:=FindFile(s,exepath,foundfile);
|
||||
if not(cs_link_extern in aktglobalswitches) and (not found) then
|
||||
Message1(exec_w_objfile_not_found,s);
|
||||
findobjectfile:=foundfile;
|
||||
end;
|
||||
|
||||
|
||||
{ searches an library file }
|
||||
function TLinker.FindLibraryFile(s:string;const ext:string;var found : boolean) : string;
|
||||
var
|
||||
foundfile : string;
|
||||
begin
|
||||
found:=false;
|
||||
findlibraryfile:='';
|
||||
@ -330,14 +334,14 @@ begin
|
||||
2. local libary dir
|
||||
3. global libary dir
|
||||
4. exe path of the compiler }
|
||||
found:=false;
|
||||
findlibraryfile:=FindFile(s,'.'+DirSep,found)+s;
|
||||
found:=FindFile(s,'.'+DirSep,foundfile);
|
||||
if (not found) then
|
||||
findlibraryfile:=current_module.locallibrarysearchpath.FindFile(s,found)+s;
|
||||
found:=current_module.locallibrarysearchpath.FindFile(s,foundfile);
|
||||
if (not found) then
|
||||
findlibraryfile:=librarysearchpath.FindFile(s,found)+s;
|
||||
found:=librarysearchpath.FindFile(s,foundfile);
|
||||
if (not found) then
|
||||
findlibraryfile:=FindFile(s,exepath,found)+s;
|
||||
found:=FindFile(s,exepath,foundfile);
|
||||
findlibraryfile:=foundfile;
|
||||
end;
|
||||
|
||||
|
||||
@ -543,7 +547,11 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.12 2001-01-12 19:19:44 peter
|
||||
Revision 1.13 2001-02-20 21:41:17 peter
|
||||
* new fixfilename, findfile for unix. Look first for lowercase, then
|
||||
NormalCase and last for UPPERCASE names.
|
||||
|
||||
Revision 1.12 2001/01/12 19:19:44 peter
|
||||
* fixed searching for utils
|
||||
|
||||
Revision 1.11 2000/12/25 00:07:26 peter
|
||||
|
||||
@ -622,6 +622,7 @@ const
|
||||
|
||||
procedure dir_include(t:tdirectivetoken);
|
||||
var
|
||||
foundfile,
|
||||
hs : string;
|
||||
path : dirstr;
|
||||
name : namestr;
|
||||
@ -683,13 +684,14 @@ const
|
||||
2. local includepath
|
||||
3. global includepath }
|
||||
found:=false;
|
||||
foundfile:='';
|
||||
if path<>'' then
|
||||
path:=path+';';
|
||||
path:=FindFile(name+ext,path+current_scanner^.inputfile.path^+';.'+DirSep,found);
|
||||
found:=FindFile(name+ext,path+current_scanner^.inputfile.path^+';.'+DirSep,foundfile);
|
||||
if (not found) then
|
||||
path:=current_module.localincludesearchpath.FindFile(name+ext,found);
|
||||
found:=current_module.localincludesearchpath.FindFile(name+ext,foundfile);
|
||||
if (not found) then
|
||||
path:=includesearchpath.FindFile(name+ext,found);
|
||||
found:=includesearchpath.FindFile(name+ext,foundfile);
|
||||
{ save old postion and decrease linebreak }
|
||||
if c=newline then
|
||||
dec(current_scanner^.line_no);
|
||||
@ -697,7 +699,7 @@ const
|
||||
{ shutdown current file }
|
||||
current_scanner^.tempcloseinputfile;
|
||||
{ load new file }
|
||||
hp:=do_openinputfile(path+name+ext);
|
||||
hp:=do_openinputfile(foundfile);
|
||||
current_scanner^.addfile(hp);
|
||||
if not current_scanner^.openinputfile then
|
||||
Message1(scan_f_cannot_open_includefile,hs);
|
||||
@ -1393,7 +1395,11 @@ const
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.17 2001-01-20 18:32:52 hajny
|
||||
Revision 1.18 2001-02-20 21:41:18 peter
|
||||
* new fixfilename, findfile for unix. Look first for lowercase, then
|
||||
NormalCase and last for UPPERCASE names.
|
||||
|
||||
Revision 1.17 2001/01/20 18:32:52 hajny
|
||||
+ APPTYPE support under OS/2, app_fs, GetEnvPChar for OS/2
|
||||
|
||||
Revision 1.16 2001/01/13 00:09:21 peter
|
||||
|
||||
@ -1543,14 +1543,11 @@ implementation
|
||||
if (Source_Time=-1) then
|
||||
begin
|
||||
if is_main then
|
||||
temp_dir:=unitsearchpath.FindFile(hs,main_found)
|
||||
main_found:=unitsearchpath.FindFile(hs,temp_dir)
|
||||
else
|
||||
temp_dir:=includesearchpath.FindFile(hs,incfile_found);
|
||||
incfile_found:=includesearchpath.FindFile(hs,temp_dir);
|
||||
if incfile_found or main_found then
|
||||
begin
|
||||
hs:=temp_dir+hs;
|
||||
Source_Time:=GetNamedFileTime(hs);
|
||||
end
|
||||
Source_Time:=GetNamedFileTime(temp_dir);
|
||||
end;
|
||||
if Source_Time=-1 then
|
||||
begin
|
||||
@ -2372,7 +2369,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.24 2001-01-08 21:40:27 peter
|
||||
Revision 1.25 2001-02-20 21:41:16 peter
|
||||
* new fixfilename, findfile for unix. Look first for lowercase, then
|
||||
NormalCase and last for UPPERCASE names.
|
||||
|
||||
Revision 1.24 2001/01/08 21:40:27 peter
|
||||
* fixed crash with unsupported token overloading
|
||||
|
||||
Revision 1.23 2000/12/25 00:07:30 peter
|
||||
|
||||
@ -289,11 +289,9 @@ begin
|
||||
{ try to add crti and crtbegin if linking to C }
|
||||
if linklibc then
|
||||
begin
|
||||
s:=librarysearchpath.FindFile('crtbegin.o',found)+'crtbegin.o';
|
||||
if found then
|
||||
if librarysearchpath.FindFile('crtbegin.o',s) then
|
||||
LinkRes.AddFileName(s);
|
||||
s:=librarysearchpath.FindFile('crti.o',found)+'crti.o';
|
||||
if found then
|
||||
if librarysearchpath.FindFile('crti.o',s) then
|
||||
LinkRes.AddFileName(s);
|
||||
end;
|
||||
{ main objectfiles }
|
||||
@ -306,11 +304,9 @@ begin
|
||||
{ objects which must be at the end }
|
||||
if linklibc then
|
||||
begin
|
||||
s:=librarysearchpath.FindFile('crtend.o',found)+'crtend.o';
|
||||
if found then
|
||||
if librarysearchpath.FindFile('crtend.o',s) then
|
||||
LinkRes.AddFileName(s);
|
||||
s:=librarysearchpath.FindFile('crtn.o',found)+'crtn.o';
|
||||
if found then
|
||||
if librarysearchpath.FindFile('crtn.o',s) then
|
||||
LinkRes.AddFileName(s);
|
||||
end;
|
||||
LinkRes.Add(')');
|
||||
@ -449,7 +445,11 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 2000-12-30 22:53:25 peter
|
||||
Revision 1.7 2001-02-20 21:41:17 peter
|
||||
* new fixfilename, findfile for unix. Look first for lowercase, then
|
||||
NormalCase and last for UPPERCASE names.
|
||||
|
||||
Revision 1.6 2000/12/30 22:53:25 peter
|
||||
* export with the case provided in the exports section
|
||||
|
||||
Revision 1.5 2000/12/25 00:07:30 peter
|
||||
|
||||
@ -286,11 +286,9 @@ begin
|
||||
{ try to add crti and crtbegin if linking to C }
|
||||
if linklibc then
|
||||
begin
|
||||
s:=librarysearchpath.FindFile('crtbegin.o',found)+'crtbegin.o';
|
||||
if found then
|
||||
if librarysearchpath.FindFile('crtbegin.o',s) then
|
||||
LinkRes.AddFileName(s);
|
||||
s:=librarysearchpath.FindFile('crti.o',found)+'crti.o';
|
||||
if found then
|
||||
if librarysearchpath.FindFile('crti.o',s) then
|
||||
LinkRes.AddFileName(s);
|
||||
end;
|
||||
{ main objectfiles }
|
||||
@ -303,11 +301,9 @@ begin
|
||||
{ objects which must be at the end }
|
||||
if linklibc then
|
||||
begin
|
||||
s:=librarysearchpath.FindFile('crtend.o',found)+'crtend.o';
|
||||
if found then
|
||||
if librarysearchpath.FindFile('crtend.o',s) then
|
||||
LinkRes.AddFileName(s);
|
||||
s:=librarysearchpath.FindFile('crtn.o',found)+'crtn.o';
|
||||
if found then
|
||||
if librarysearchpath.FindFile('crtn.o',s) then
|
||||
LinkRes.AddFileName(s);
|
||||
end;
|
||||
LinkRes.Add(')');
|
||||
@ -447,7 +443,11 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.10 2000-12-30 22:53:25 peter
|
||||
Revision 1.11 2001-02-20 21:41:17 peter
|
||||
* new fixfilename, findfile for unix. Look first for lowercase, then
|
||||
NormalCase and last for UPPERCASE names.
|
||||
|
||||
Revision 1.10 2000/12/30 22:53:25 peter
|
||||
* export with the case provided in the exports section
|
||||
|
||||
Revision 1.9 2000/12/25 00:07:30 peter
|
||||
|
||||
@ -325,7 +325,7 @@ begin
|
||||
if i>0 then
|
||||
Delete(S,i,255);
|
||||
S := S + '.imp';
|
||||
S := librarysearchpath.FindFile(S,found)+S;
|
||||
librarysearchpath.FindFile(S,s);
|
||||
LinkRes.Add('IMPORT @'+s);
|
||||
end
|
||||
end;
|
||||
@ -349,7 +349,7 @@ begin
|
||||
if i>0 then
|
||||
Delete(S,i,255);
|
||||
S := S + '.imp';
|
||||
S := librarysearchpath.FindFile(S,found)+S;
|
||||
librarysearchpath.FindFile(S,s);
|
||||
LinkRes.Add('IMPORT @'+s);
|
||||
LinkRes.Add('MODULE '+s2);
|
||||
end
|
||||
@ -422,7 +422,11 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.5 2000-12-25 00:07:30 peter
|
||||
Revision 1.6 2001-02-20 21:41:16 peter
|
||||
* new fixfilename, findfile for unix. Look first for lowercase, then
|
||||
NormalCase and last for UPPERCASE names.
|
||||
|
||||
Revision 1.5 2000/12/25 00:07:30 peter
|
||||
+ new tlinkedlist class (merge of old tstringqueue,tcontainer and
|
||||
tlinkedlist objects)
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@ interface
|
||||
procedure importprocedure(const func,module:string;index:longint;const name:string);override;
|
||||
procedure importvariable(const varname,module:string;const name:string);override;
|
||||
procedure generatelib;override;
|
||||
procedure generatenasmlib;virtual;
|
||||
procedure generatesmartlib;override;
|
||||
end;
|
||||
|
||||
@ -48,6 +49,7 @@ interface
|
||||
procedure exportprocedure(hp : texported_item);override;
|
||||
procedure exportvar(hp : texported_item);override;
|
||||
procedure generatelib;override;
|
||||
procedure generatenasmlib;virtual;
|
||||
end;
|
||||
|
||||
tlinkerwin32=class(tlinker)
|
||||
@ -101,13 +103,13 @@ implementation
|
||||
1. Current dir
|
||||
2. Library Path
|
||||
3. windir,windir/system,windir/system32 }
|
||||
FoundDll:=FindFile(s,'.'+DirSep,found)+s;
|
||||
Found:=FindFile(s,'.'+DirSep,founddll);
|
||||
if (not found) then
|
||||
FoundDll:=includesearchpath.FindFile(s,found)+s;
|
||||
Found:=includesearchpath.FindFile(s,founddll);
|
||||
if (not found) then
|
||||
begin
|
||||
sysdir:=FixPath(GetEnv('windir'),false);
|
||||
FoundDll:=FindFile(s,sysdir+';'+sysdir+'system'+DirSep+';'+sysdir+'system32'+DirSep,found)+s;
|
||||
Found:=FindFile(s,sysdir+';'+sysdir+'system'+DirSep+';'+sysdir+'system32'+DirSep,founddll);
|
||||
end;
|
||||
if (not found) then
|
||||
begin
|
||||
@ -191,6 +193,33 @@ implementation
|
||||
hp1.imported_items.concat(hp2);
|
||||
end;
|
||||
|
||||
procedure timportlibwin32.generatenasmlib;
|
||||
var
|
||||
hp1 : timportlist;
|
||||
hp2 : timported_item;
|
||||
p : pchar;
|
||||
begin
|
||||
importssection.concat(tai_section.create(sec_code));
|
||||
hp1:=timportlist(current_module.imports.first);
|
||||
while assigned(hp1) do
|
||||
begin
|
||||
hp2:=timported_item(hp1.imported_items.first);
|
||||
while assigned(hp2) do
|
||||
begin
|
||||
if (aktoutputformat=as_i386_tasm) or
|
||||
(aktoutputformat=as_i386_masm) then
|
||||
p:=strpnew(#9+'EXTRN '+hp2.func^)
|
||||
else
|
||||
p:=strpnew(#9+'EXTERN '+hp2.func^);
|
||||
importssection.concat(tai_direct.create(p));
|
||||
p:=strpnew(#9+'import '+hp2.func^+' '+hp1.dllname^+' '+hp2.name^);
|
||||
importssection.concat(tai_direct.create(p));
|
||||
hp2:=timported_item(hp2.next);
|
||||
end;
|
||||
hp1:=timportlist(hp1.next);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure timportlibwin32.generatesmartlib;
|
||||
var
|
||||
@ -200,6 +229,12 @@ implementation
|
||||
lidata4,lidata5 : pasmlabel;
|
||||
r : preference;
|
||||
begin
|
||||
if (aktoutputformat<>as_i386_asw) and
|
||||
(aktoutputformat<>as_i386_pecoff) then
|
||||
begin
|
||||
generatenasmlib;
|
||||
exit;
|
||||
end;
|
||||
hp1:=timportlist(current_module.imports.first);
|
||||
while assigned(hp1) do
|
||||
begin
|
||||
@ -305,6 +340,12 @@ implementation
|
||||
l1,l2,l3,l4 : pasmlabel;
|
||||
r : preference;
|
||||
begin
|
||||
if (aktoutputformat<>as_i386_asw) and
|
||||
(aktoutputformat<>as_i386_pecoff) then
|
||||
begin
|
||||
generatenasmlib;
|
||||
exit;
|
||||
end;
|
||||
hp1:=timportlist(current_module.imports.first);
|
||||
while assigned(hp1) do
|
||||
begin
|
||||
@ -490,6 +531,12 @@ implementation
|
||||
address_table,name_table_pointers,
|
||||
name_table,ordinal_table : TAAsmoutput;
|
||||
begin
|
||||
if (aktoutputformat<>as_i386_asw) and
|
||||
(aktoutputformat<>as_i386_pecoff) then
|
||||
begin
|
||||
generatenasmlib;
|
||||
exit;
|
||||
end;
|
||||
|
||||
hp:=texported_item(current_module._exports.first);
|
||||
if not assigned(hp) then
|
||||
@ -637,6 +684,21 @@ implementation
|
||||
temtexport.free;
|
||||
end;
|
||||
|
||||
procedure texportlibwin32.generatenasmlib;
|
||||
var
|
||||
hp : texported_item;
|
||||
p : pchar;
|
||||
begin
|
||||
exportssection.concat(tai_section.create(sec_code));
|
||||
hp:=texported_item(current_module._exports.first);
|
||||
while assigned(hp) do
|
||||
begin
|
||||
p:=strpnew(#9+'export '+hp.sym^.mangledname+' '+hp.name^+' '+tostr(hp.index));
|
||||
exportssection.concat(tai_direct.create(p));
|
||||
hp:=texported_item(hp.next);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
TLINKERWIN32
|
||||
@ -830,7 +892,6 @@ function TLinkerWin32.MakeExecutable:boolean;
|
||||
var
|
||||
binstr,
|
||||
cmdstr : string;
|
||||
found,
|
||||
success : boolean;
|
||||
i : longint;
|
||||
AsBinStr : string[80];
|
||||
@ -847,7 +908,7 @@ begin
|
||||
AppTypeStr:='';
|
||||
ImageBaseStr:='';
|
||||
StripStr:='';
|
||||
AsBinStr:=FindExe('asw',found);
|
||||
FindExe('asw',AsBinStr);
|
||||
if RelocSection then
|
||||
{ Using short form to avoid problems with 128 char limitation under Dos. }
|
||||
RelocStr:='-b base.$$$';
|
||||
@ -910,7 +971,6 @@ Function TLinkerWin32.MakeSharedLibrary:boolean;
|
||||
var
|
||||
binstr,
|
||||
cmdstr : string;
|
||||
found,
|
||||
success : boolean;
|
||||
i : longint;
|
||||
AsBinStr : string[80];
|
||||
@ -928,7 +988,7 @@ begin
|
||||
AppTypeStr:='';
|
||||
ImageBaseStr:='';
|
||||
StripStr:='';
|
||||
AsBinStr:=FindExe('asw',found);
|
||||
FindExe('asw',AsBinStr);
|
||||
if RelocSection then
|
||||
{ Using short form to avoid problems with 128 char limitation under Dos. }
|
||||
RelocStr:='-b base.$$$';
|
||||
@ -1194,7 +1254,11 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.9 2001-01-13 00:09:22 peter
|
||||
Revision 1.10 2001-02-20 21:41:16 peter
|
||||
* new fixfilename, findfile for unix. Look first for lowercase, then
|
||||
NormalCase and last for UPPERCASE names.
|
||||
|
||||
Revision 1.9 2001/01/13 00:09:22 peter
|
||||
* made Pavel O. happy ;)
|
||||
|
||||
Revision 1.8 2000/12/30 22:53:25 peter
|
||||
|
||||
Loading…
Reference in New Issue
Block a user