* searchpaths changed to stringqueue object

This commit is contained in:
peter 1999-11-12 11:03:49 +00:00
parent 4d3b187b4c
commit e169c592f8
16 changed files with 454 additions and 350 deletions

View File

@ -155,7 +155,7 @@ begin
lastas:=ord(target_asm.id);
{ is an assembler passed ? }
if utilsdirectory<>'' then
LastASBin:=Search(target_asm.asmbin+source_os.exeext,utilsdirectory,asfound)+
LastASBin:=FindFile(target_asm.asmbin+source_os.exeext,utilsdirectory,asfound)+
target_asm.asmbin+source_os.exeext;
if LastASBin='' then
LastASBin:=FindExe(target_asm.asmbin,asfound);
@ -564,7 +564,10 @@ end;
end.
{
$Log$
Revision 1.57 1999-11-08 10:37:12 peter
Revision 1.58 1999-11-12 11:03:49 peter
* searchpaths changed to stringqueue object
Revision 1.57 1999/11/08 10:37:12 peter
* filename fixes for win32 imports for units with multiple needed dll's
Revision 1.56 1999/11/06 14:34:17 peter

View File

@ -151,6 +151,8 @@ unit cobjects;
destructor Done;
function Empty:boolean;
function Get:string;
function Find(const s:string):PStringqueueItem;
function Delete(const s:string):boolean;
procedure Insert(const s:string);
procedure Concat(const s:string);
procedure Clear;
@ -663,6 +665,44 @@ begin
end;
function TStringQueue.Find(const s:string):PStringqueueItem;
var
p : PStringqueueItem;
begin
p:=first;
while assigned(p) do
begin
if p^.data^=s then
break;
p:=p^.next;
end;
Find:=p;
end;
function TStringQueue.Delete(const s:string):boolean;
var
prev,p : PStringqueueItem;
begin
Delete:=false;
prev:=nil;
p:=first;
while assigned(p) do
begin
if p^.data^=s then
begin
if assigned(prev) then
prev^.next:=p^.next;
dispose(p);
Delete:=true;
exit;
end;
prev:=p;
p:=p^.next;
end;
end;
procedure TStringQueue.Insert(const s:string);
var
newnode : pstringqueueitem;
@ -2277,7 +2317,10 @@ end;
end.
{
$Log$
Revision 1.44 1999-11-06 14:34:20 peter
Revision 1.45 1999-11-12 11:03:49 peter
* searchpaths changed to stringqueue object
Revision 1.44 1999/11/06 14:34:20 peter
* truncated log to 20 revs
Revision 1.43 1999/10/26 12:30:41 peter

View File

@ -121,7 +121,7 @@ uses
dos,
{$endif Delphi}
verbose,comphook,systems,
globals,options,parser,symtable,link,import,export,tokens;
cobjects,globals,options,parser,symtable,link,import,export,tokens;
function Compile(const cmd:string):longint;
@ -210,7 +210,7 @@ begin
CompilerInitedAfterArgs:=true;
end;
procedure minimal_stop;
procedure minimal_stop;{$ifndef fpc}far;{$endif}
begin
DoneCompiler;
olddo_stop;
@ -219,6 +219,18 @@ end;
function Compile(const cmd:string):longint;
procedure writepathlist(w:tmsgconst;l:TSearchPathList);
var
hp : pstringqueueitem;
begin
hp:=l.first;
while assigned(hp) do
begin
Message1(w,hp^.data^);
hp:=hp^.next;
end;
end;
function getrealtime : real;
var
h,m,s,s100 : word;
@ -248,10 +260,10 @@ begin
Message1(general_d_sourceos,source_os.name);
Message1(general_i_targetos,target_os.name);
Message1(general_t_exepath,exepath);
Message1(general_t_unitpath,unitsearchpath);
Message1(general_t_includepath,includesearchpath);
Message1(general_t_librarypath,librarysearchpath);
Message1(general_t_objectpath,objectsearchpath);
WritePathList(general_t_unitpath,unitsearchpath);
WritePathList(general_t_includepath,includesearchpath);
WritePathList(general_t_librarypath,librarysearchpath);
WritePathList(general_t_objectpath,objectsearchpath);
{$ifdef TP}
{$ifndef Delphi}
Comment(V_Info,'Memory: '+tostr(MemAvail)+' Bytes Free');
@ -310,7 +322,10 @@ end;
end.
{
$Log$
Revision 1.38 1999-11-09 23:47:53 pierre
Revision 1.39 1999-11-12 11:03:50 peter
* searchpaths changed to stringqueue object
Revision 1.38 1999/11/09 23:47:53 pierre
+ minimal_stop to avoid memory loss with -iTO switch
Revision 1.37 1999/11/06 14:34:20 peter

View File

@ -53,14 +53,14 @@ var
begin
if utilsdirectory<>'' then
begin
respath:=Search(target_res.resbin+source_os.exeext,
respath:=FindFile(target_res.resbin+source_os.exeext,
utilsdirectory,resfound);
end
else
{$ifdef Delphi}
respath:=Search(target_res.resbin+source_os.exeext,'.;'+exepath+';'+dmisc.getenv('PATH'),resfound);
respath:=FindFile(target_res.resbin+source_os.exeext,'.;'+exepath+';'+dmisc.getenv('PATH'),resfound);
{$else Delphi}
respath:=Search(target_res.resbin+source_os.exeext,'.;'+exepath+';'+dos.getenv('PATH'),resfound);
respath:=FindFile(target_res.resbin+source_os.exeext,'.;'+exepath+';'+dos.getenv('PATH'),resfound);
{$endif Delphi}
resbin:=respath+target_res.resbin+source_os.exeext;
if (not resfound) and not(cs_link_extern in aktglobalswitches) then
@ -111,7 +111,10 @@ end;
end.
{
$Log$
Revision 1.6 1999-07-18 10:19:49 florian
Revision 1.7 1999-11-12 11:03:50 peter
* searchpaths changed to stringqueue object
Revision 1.6 1999/07/18 10:19:49 florian
* made it compilable with Dlephi 4 again
+ fixed problem with large stack allocations on win32

View File

@ -203,7 +203,7 @@ unit files;
localunitsearchpath, { local searchpaths }
localobjectsearchpath,
localincludesearchpath,
locallibrarysearchpath : pstring;
locallibrarysearchpath : TSearchPathList;
path, { path where the module is find/created }
outpath,
@ -971,76 +971,84 @@ end;
UnitExists:=FileExists(Singlepathstring+FileName+ext);
end;
Function SearchPath(unitpath:string):boolean;
Function SearchPath(const s:string):boolean;
var
found : boolean;
start,i : longint;
ext : string[8];
begin
start:=1;
Found:=false;
repeat
{ Create current path to check }
i:=pos(';',unitpath);
if i=0 then
i:=length(unitpath)+1;
singlepathstring:=FixPath(copy(unitpath,start,i-start),false);
delete(unitpath,start,i-start+1);
if not onlysource then
begin
{ Check for PPL file }
if not Found then
begin
Found:=UnitExists(target_info.unitlibext);
if Found then
Begin
SetFileName(SinglePathString+FileName,false);
Found:=OpenPPU;
End;
end;
{ Check for PPU file }
if not Found then
begin
Found:=UnitExists(target_info.unitext);
if Found then
Begin
SetFileName(SinglePathString+FileName,false);
Found:=OpenPPU;
End;
end;
end;
{ Check for Sources }
if not Found then
begin
ppufile:=nil;
do_compile:=true;
recompile_reason:=rr_noppu;
{Check for .pp file}
Found:=UnitExists(target_os.sourceext);
if Found then
Ext:=target_os.sourceext
else
begin
{Check for .pas}
Found:=UnitExists(target_os.pasext);
if Found then
Ext:=target_os.pasext;
end;
stringdispose(mainsource);
if Found then
begin
sources_avail:=true;
{Load Filenames when found}
mainsource:=StringDup(SinglePathString+FileName+Ext);
SetFileName(SinglePathString+FileName,false);
end
else
sources_avail:=false;
end;
until Found or (unitpath='');
singlepathstring:=FixPath(s,false);
if not onlysource then
begin
{ Check for PPL file }
if not Found then
begin
Found:=UnitExists(target_info.unitlibext);
if Found then
Begin
SetFileName(SinglePathString+FileName,false);
Found:=OpenPPU;
End;
end;
{ Check for PPU file }
if not Found then
begin
Found:=UnitExists(target_info.unitext);
if Found then
Begin
SetFileName(SinglePathString+FileName,false);
Found:=OpenPPU;
End;
end;
end;
{ Check for Sources }
if not Found then
begin
ppufile:=nil;
do_compile:=true;
recompile_reason:=rr_noppu;
{Check for .pp file}
Found:=UnitExists(target_os.sourceext);
if Found then
Ext:=target_os.sourceext
else
begin
{Check for .pas}
Found:=UnitExists(target_os.pasext);
if Found then
Ext:=target_os.pasext;
end;
stringdispose(mainsource);
if Found then
begin
sources_avail:=true;
{Load Filenames when found}
mainsource:=StringDup(SinglePathString+FileName+Ext);
SetFileName(SinglePathString+FileName,false);
end
else
sources_avail:=false;
end;
SearchPath:=Found;
end;
Function SearchPathList(list:TSearchPathList):boolean;
var
hp : PStringQueueItem;
found : boolean;
begin
found:=false;
hp:=list.First;
while assigned(hp) do
begin
found:=SearchPath(hp^.data^);
if found then
break;
hp:=hp^.next;
end;
SearchPathList:=found;
end;
var
fnd : boolean;
begin
@ -1050,10 +1058,10 @@ end;
2. local unit path
3. global unit path }
fnd:=SearchPath('.');
if (not fnd) and assigned(current_module^.LocalUnitSearchPath) then
fnd:=SearchPath(current_module^.LocalUnitSearchPath^);
if (not fnd) then
fnd:=SearchPath(UnitSearchPath);
fnd:=SearchPathList(current_module^.LocalUnitSearchPath);
if (not fnd) then
fnd:=SearchPathList(UnitSearchPath);
{ try to find a file with the first 8 chars of the modulename, like
dos }
@ -1061,10 +1069,10 @@ end;
begin
filename:=copy(filename,1,8);
fnd:=SearchPath('.');
if (not fnd) and assigned(current_module^.LocalUnitSearchPath) then
fnd:=SearchPath(current_module^.LocalUnitSearchPath^);
if (not fnd) then
fnd:=SearchPathList(current_module^.LocalUnitSearchPath);
if not fnd then
fnd:=SearchPath(UnitSearchPath);
fnd:=SearchPathList(UnitSearchPath);
end;
search_unit:=fnd;
end;
@ -1183,10 +1191,10 @@ end;
{$endif}
path:=nil;
setfilename(p+n,true);
localunitsearchpath:=nil;
localobjectsearchpath:=nil;
localincludesearchpath:=nil;
locallibrarysearchpath:=nil;
localunitsearchpath.init;
localobjectsearchpath.init;
localincludesearchpath.init;
locallibrarysearchpath.init;
used_units.init;
dependent_units.init;
new(sourcefiles,init);
@ -1273,10 +1281,10 @@ end;
stringdispose(modulename);
stringdispose(mainsource);
stringdispose(asmprefix);
stringdispose(localunitsearchpath);
stringdispose(localobjectsearchpath);
stringdispose(localincludesearchpath);
stringdispose(locallibrarysearchpath);
localunitsearchpath.done;
localobjectsearchpath.done;
localincludesearchpath.done;
locallibrarysearchpath.done;
{$ifdef MEMDEBUG}
d.init('symtable');
{$endif}
@ -1344,7 +1352,10 @@ end;
end.
{
$Log$
Revision 1.108 1999-11-06 14:34:20 peter
Revision 1.109 1999-11-12 11:03:50 peter
* searchpaths changed to stringqueue object
Revision 1.108 1999/11/06 14:34:20 peter
* truncated log to 20 revs
Revision 1.107 1999/11/04 23:13:25 peter

View File

@ -73,6 +73,13 @@ unit globals;
gpcmodeswitches : tmodeswitches=
[m_gpc,m_all];
type
TSearchPathList = object(TStringQueue)
procedure AddPath(s:string;addfirst:boolean);
procedure AddList(list:TSearchPathList;addfirst:boolean);
function FindFile(const f : string;var b : boolean) : string;
end;
var
{ specified inputfile }
inputdir : dirstr;
@ -100,7 +107,7 @@ unit globals;
librarysearchpath,
unitsearchpath,
objectsearchpath,
includesearchpath : TSearchPathString;
includesearchpath : TSearchPathList;
{ deffile }
usewindowapi : boolean;
@ -223,25 +230,23 @@ unit globals;
procedure DefaultReplacements(var s:string);
function path_absolute(const s : string) : boolean;
Function FileExists ( Const F : String) : Boolean;
Function RemoveFile(const f:string):boolean;
Function RemoveDir(d:string):boolean;
Function GetFileTime ( Var F : File) : Longint;
Function GetNamedFileTime ( Const F : String) : Longint;
Function SplitFileName(const s:string):string;
Function SplitName(const s:string):string;
Function SplitExtension(Const HStr:String):String;
Function AddExtension(Const HStr,ext:String):String;
Function ForceExtension(Const HStr,ext:String):String;
Function FixPath(s:string;allowdot:boolean):string;
function FixFileName(const s:string):string;
function path_absolute(const s : string) : boolean;
Function FileExists ( Const F : String) : Boolean;
Function RemoveFile(const f:string):boolean;
Function RemoveDir(d:string):boolean;
Function GetFileTime ( Var F : File) : Longint;
Function GetNamedFileTime ( Const F : String) : Longint;
Function SplitFileName(const s:string):string;
Function SplitName(const s:string):string;
Function SplitExtension(Const HStr:String):String;
Function AddExtension(Const HStr,ext:String):String;
Function ForceExtension(Const HStr,ext:String):String;
Function FixPath(s:string;allowdot:boolean):string;
function FixFileName(const s:string):string;
procedure SplitBinCmd(const s:string;var bstr,cstr:string);
procedure AddPathToList(var list:TSearchPathString;s:string;first:boolean);
function getpathfromlist(var list:TSearchPathString):string;
function search(const f : string;path : TSearchPathString;var b : boolean) : string;
procedure SynchronizeFileTime(const fn1,fn2:string);
function FindExe(bin:string;var found:boolean):string;
function FindFile(const f : string;path : string;var b : boolean) : string;
function FindExe(bin:string;var found:boolean):string;
Procedure Shell(const command:string);
procedure InitGlobals;
@ -995,26 +1000,20 @@ unit globals;
procedure AddPathToList(var list:TSearchPathString;s:string;first:boolean);
procedure TSearchPathList.AddPath(s:string;addfirst:boolean);
var
LastAdd,
starti,i,j : longint;
Found : boolean;
j : longint;
CurrentDir,
CurrPath,
AddList : string;
CurrPath : string;
hp : PStringQueueItem;
begin
if s='' then
exit;
{ Support default macro's }
DefaultReplacements(s);
{ Fix List }
if (list<>'') and (list[length(list)]<>';') then
list:=list+';';
{ get current dir }
GetDir(0,CurrentDir);
CurrentDir:=FixPath(CurrentDir,false);
AddList:='';
LastAdd:=1;
repeat
j:=Pos(';',s);
if j=0 then
@ -1022,90 +1021,88 @@ unit globals;
{Get Pathname}
CurrPath:=FixPath(Copy(s,1,j-1),false);
if CurrPath='' then
CurrPath:='.'+DirSep+';'
CurrPath:='.'+DirSep
else
begin
CurrPath:=FixPath(FExpand(CurrPath),false)+';';
CurrPath:=FixPath(FExpand(CurrPath),false);
if (Copy(CurrPath,1,length(CurrentDir))=CurrentDir) then
CurrPath:='.'+DirSep+Copy(CurrPath,length(CurrentDir)+1,255);
end;
Delete(s,1,j);
{Check if already in path}
found:=false;
i:=0;
starti:=1;
while (not found) and (i<length(list)) do
System.Delete(s,1,j);
if addfirst then
begin
inc(i);
if (list[i]=';') then
begin
found:=(CurrPath=Copy(List,starti,i-starti+1));
if Found then
begin
if First then
Delete(List,Starti,i-starti+1); {The new entry is placed first}
end
else
starti:=i+1;
end;
end;
if First then
begin
Insert(CurrPath,List,LastAdd);
inc(LastAdd,Length(CurrPath));
Delete(currPath);
Insert(currPath);
end
else
if not Found then
List:=List+CurrPath
begin
{ Check if already in path, then we don't add it }
hp:=Find(currPath);
if not assigned(hp) then
Concat(currPath);
end;
until (s='');
end;
function getpathfromlist(var list:TSearchPathString):string;
procedure TSearchPathList.AddList(list:TSearchPathList;addfirst:boolean);
var
s : string;
i : longint;
hl : TSearchPathList;
hp,hp2 : PStringQueueItem;
begin
s:='';
while (list<>'') do
if list.empty then
exit;
{ create temp and reverse the list }
if addfirst then
begin
i:=Pos(';',list);
If i=0 then
i:=255;
S:=Copy(list,1,i-1);
Delete (list,1,i);
if (S<>'') then
break;
hl.Init;
hp:=list.first;
while assigned(hp) do
begin
hl.insert(hp^.data^);
hp:=hp^.next;
end;
while not hl.empty do
begin
s:=hl.Get;
Delete(s);
Insert(s);
end;
hl.done;
end
else
begin
hp:=list.first;
while assigned(hp) do
begin
hp2:=Find(hp^.data^);
{ Check if already in path, then we don't add it }
if not assigned(hp2) then
Concat(hp^.data^);
hp:=hp^.next;
end;
end;
GetPathFromList:=s;
end;
function search(const f : string;path : TSearchPathString;var b : boolean) : string;
Var
singlepathstring : string;
i : longint;
function TSearchPathList.FindFile(const f : string;var b : boolean) : string;
Var
p : PStringQueueItem;
begin
{$ifdef linux}
for i:=1 to length(path) do
if path[i]=':' then
path[i]:=';';
{$endif}
FindFile:='';
b:=false;
search:='';
repeat
i:=pos(';',path);
if i=0 then
i:=255;
singlepathstring:=FixPath(copy(path,1,i-1),false);
delete(path,1,i);
If FileExists (singlepathstring+f) then
p:=first;
while assigned(p) do
begin
If FileExists(p^.data^+f) then
begin
Search:=singlepathstring;
FindFile:=p^.data^;
b:=true;
exit;
end;
until path='';
p:=p^.next;
end;
end;
@ -1184,13 +1181,40 @@ unit globals;
end;
end;
function FindFile(const f : string;path : string;var b : boolean) : string;
Var
singlepathstring : string;
i : longint;
begin
{$ifdef linux}
for i:=1 to length(path) do
if path[i]=':' then
path[i]:=';';
{$endif}
b:=false;
FindFile:='';
repeat
i:=pos(';',path);
if i=0 then
i:=255;
singlepathstring:=FixPath(copy(path,1,i-1),false);
delete(path,1,i);
If FileExists (singlepathstring+f) then
begin
FindFile:=singlepathstring;
b:=true;
exit;
end;
until path='';
end;
function FindExe(bin:string;var found:boolean):string;
begin
bin:=FixFileName(bin)+source_os.exeext;
{$ifdef delphi}
FindExe:=Search(bin,'.;'+exepath+';'+dmisc.getenv('PATH'),found)+bin;
FindExe:=FindFile(bin,'.;'+exepath+';'+dmisc.getenv('PATH'),found)+bin;
{$else delphi}
FindExe:=Search(bin,'.;'+exepath+';'+dos.getenv('PATH'),found)+bin;
FindExe:=FindFile(bin,'.;'+exepath+';'+dos.getenv('PATH'),found)+bin;
{$endif delphi}
end;
@ -1246,11 +1270,10 @@ end;
initdefines.done;
if assigned(DLLImageBase) then
StringDispose(DLLImageBase);
{ necessary to release AnsiString memory !! }
librarysearchpath:='';
unitsearchpath:='';
objectsearchpath:='';
includesearchpath:='';
librarysearchpath.Done;
unitsearchpath.Done;
objectsearchpath.Done;
includesearchpath.Done;
end;
procedure InitGlobals;
@ -1267,9 +1290,15 @@ end;
OutputExeDir:='';
OutputUnitDir:='';
{ Utils directory }
{ Utils directory }
utilsdirectory:='';
{ Search Paths }
librarysearchpath.Init;
unitsearchpath.Init;
includesearchpath.Init;
objectsearchpath.Init;
{ Def file }
usewindowapi:=false;
description:='Compiled by FPC '+version_string+' - '+target_cpu_string;
@ -1321,7 +1350,10 @@ begin
end.
{
$Log$
Revision 1.32 1999-11-09 23:34:46 pierre
Revision 1.33 1999-11-12 11:03:50 peter
* searchpaths changed to stringqueue object
Revision 1.32 1999/11/09 23:34:46 pierre
+ resolving_forward boolean used for references
Revision 1.31 1999/11/09 13:00:38 peter
@ -1335,7 +1367,7 @@ end.
* truncated log to 20 revs
Revision 1.28 1999/11/04 10:55:31 peter
* TSearchPathString for the string type of the searchpaths, which is
* TSearchPathList for the string type of the searchpaths, which is
ansistring under FPC/Delphi
Revision 1.27 1999/10/26 12:30:41 peter

View File

@ -25,18 +25,6 @@ interface
const
maxidlen = 64;
type
{ Compiler dependent types }
{$ifdef TP}
TSearchPathString = string;
{$endif}
{$ifdef FPC}
TSearchPathString = ansistring;
{$endif}
{$ifdef Delphi}
TSearchPathString = ansistring;
{$endif}
type
{ System independent float names }
{$ifdef i386}
@ -192,7 +180,10 @@ begin
end.
{
$Log$
Revision 1.23 1999-11-09 13:00:38 peter
Revision 1.24 1999-11-12 11:03:50 peter
* searchpaths changed to stringqueue object
Revision 1.23 1999/11/09 13:00:38 peter
* define FPC_DELPHI,FPC_OBJFPC,FPC_TP,FPC_GPC
* initial support for ansistring default with modes

View File

@ -244,7 +244,7 @@ var
begin
LastBin:='';
if utilsdirectory<>'' then
LastBin:=Search(s+source_os.exeext,utilsdirectory,ldfound)+s+source_os.exeext;
LastBin:=FindFile(s+source_os.exeext,utilsdirectory,ldfound)+s+source_os.exeext;
if LastBin='' then
LastBin:=FindExe(s,ldfound);
if (not ldfound) and not(cs_link_extern in aktglobalswitches) then
@ -281,15 +281,15 @@ begin
4. global object path
5. exepath }
found:=false;
findobjectfile:=search(s,'.',found)+s;
findobjectfile:=FindFile(s,'.',found)+s;
if (not found) then
findobjectfile:=search(s,unitsearchpath,found)+s;
if (not found) and assigned(current_module^.localobjectsearchpath) then
findobjectfile:=search(s,current_module^.localobjectsearchpath^,found)+s;
findobjectfile:=UnitSearchPath.FindFile(s,found)+s;
if (not found) then
findobjectfile:=search(s,objectsearchpath,found)+s;
findobjectfile:=current_module^.localobjectsearchpath.FindFile(s,found)+s;
if (not found) then
findobjectfile:=search(s,exepath,found)+s;
findobjectfile:=objectsearchpath.FindFile(s,found)+s;
if (not found) then
findobjectfile:=FindFile(s,exepath,found)+s;
if not(cs_link_extern in aktglobalswitches) and (not found) then
Message1(exec_w_objfile_not_found,s);
end;
@ -316,13 +316,13 @@ begin
3. global libary dir
4. exe path of the compiler }
found:=false;
findlibraryfile:=search(s,'.',found)+s;
if (not found) and assigned(current_module^.locallibrarysearchpath) then
findlibraryfile:=search(s,current_module^.locallibrarysearchpath^,found)+s;
findlibraryfile:=FindFile(s,'.',found)+s;
if (not found) then
findlibraryfile:=search(s,librarysearchpath,found)+s;
findlibraryfile:=current_module^.locallibrarysearchpath.FindFile(s,found)+s;
if (not found) then
findlibraryfile:=search(s,exepath,found)+s;
findlibraryfile:=librarysearchpath.FindFile(s,found)+s;
if (not found) then
findlibraryfile:=FindFile(s,exepath,found)+s;
if not(cs_link_extern in aktglobalswitches) and (not found) then
Message1(exec_w_libfile_not_found,s);
end;
@ -525,7 +525,10 @@ end;
end.
{
$Log$
Revision 1.76 1999-11-06 14:34:21 peter
Revision 1.77 1999-11-12 11:03:50 peter
* searchpaths changed to stringqueue object
Revision 1.76 1999/11/06 14:34:21 peter
* truncated log to 20 revs
Revision 1.75 1999/10/26 12:25:04 peter

View File

@ -25,7 +25,7 @@ unit options;
interface
uses
globtype,verbose;
globtype,globals,verbose;
type
POption=^TOption;
@ -37,7 +37,7 @@ type
ParaIncludePath,
ParaUnitPath,
ParaObjectPath,
ParaLibraryPath : TSearchPathString;
ParaLibraryPath : TSearchPathList;
Constructor Init;
Destructor Done;
procedure WriteLogo;
@ -65,7 +65,7 @@ uses
dos,
{$endif Delphi}
version,systems,
cobjects,globals,
cobjects,
symtable,scanner,link,messages
{$ifdef BrowserLog}
,browlog
@ -498,27 +498,27 @@ begin
'e' : SetRedirectFile(More);
'E' : OutputExeDir:=FixPath(More,true);
'i' : if firstpass then
AddPathToList(includesearchpath,More,false)
includesearchpath.AddPath(More,false)
else
AddPathToList(ParaIncludePath,More,false);
ParaIncludePath.AddPath(More,false);
'g' : Message2(option_obsolete_switch_use_new,'-Fg','-Fl');
'l' : if firstpass then
AddPathToList(LibrarySearchPath,More,false)
LibrarySearchPath.AddPath(More,false)
else
AddPathToList(ParaLibraryPath,More,false);
ParaLibraryPath.AddPath(More,false);
'L' : if More<>'' then
ParaDynamicLinker:=More
else
IllegalPara(opt);
'o' : if firstpass then
AddPathToList(objectsearchpath,More,false)
ObjectSearchPath.AddPath(More,false)
else
AddPathToList(ParaObjectPath,More,false);
ParaObjectPath.AddPath(More,false);
'r' : Msgfilename:=More;
'u' : if firstpass then
AddPathToList(unitsearchpath,More,false)
unitsearchpath.AddPath(More,false)
else
AddPathToList(ParaUnitPath,More,false);
ParaUnitPath.AddPath(More,false);
'U' : OutputUnitDir:=FixPath(More,true);
else
IllegalPara(opt);
@ -582,9 +582,9 @@ begin
end;
end;
'I' : if firstpass then
AddPathToList(includesearchpath,More,false)
includesearchpath.AddPath(More,false)
else
AddPathToList(ParaIncludePath,More,false);
ParaIncludePath.AddPath(More,false);
'k' : if more<>'' then
ParaLinkOptions:=ParaLinkOptions+' '+More
else
@ -999,15 +999,19 @@ begin
NoPressEnter:=false;
FirstPass:=false;
FileLevel:=0;
ParaIncludePath:='';
ParaObjectPath:='';
ParaUnitPath:='';
ParaLibraryPath:='';
ParaIncludePath.Init;
ParaObjectPath.Init;
ParaUnitPath.Init;
ParaLibraryPath.Init;
end;
destructor TOption.Done;
begin
ParaIncludePath.Done;
ParaObjectPath.Done;
ParaUnitPath.Done;
ParaLibraryPath.Done;
end;
@ -1204,30 +1208,30 @@ begin
end;
{ Add paths specified with parameters to the searchpaths }
AddPathToList(UnitSearchPath,Option^.ParaUnitPath,true);
AddPathToList(ObjectSearchPath,Option^.ParaObjectPath,true);
AddPathToList(IncludeSearchPath,Option^.ParaIncludePath,true);
AddPathToList(LibrarySearchPath,Option^.ParaLibraryPath,true);
UnitSearchPath.AddList(Option^.ParaUnitPath,true);
ObjectSearchPath.AddList(Option^.ParaObjectPath,true);
IncludeSearchPath.AddList(Option^.ParaIncludePath,true);
LibrarySearchPath.AddList(Option^.ParaLibraryPath,true);
{ add unit environment and exepath to the unit search path }
if inputdir<>'' then
AddPathToList(Unitsearchpath,inputdir,true);
Unitsearchpath.AddPath(inputdir,true);
{$ifdef Delphi}
AddPathToList(UnitSearchPath,dmisc.getenv(target_info.unit_env),false);
UnitSearchPath.AddPath(dmisc.getenv(target_info.unit_env),false);
{$else}
AddPathToList(UnitSearchPath,dos.getenv(target_info.unit_env),false);
UnitSearchPath.AddPath(dos.getenv(target_info.unit_env),false);
{$endif Delphi}
{$ifdef linux}
AddPathToList(UnitSearchPath,'/usr/lib/fpc/'+version_string+'/units/'+lower(target_info.short_name),false);
AddPathToList(UnitSearchPath,'/usr/lib/fpc/'+version_string+'/rtl/'+lower(target_info.short_name),false);
UnitSearchPath.AddPath('/usr/lib/fpc/'+version_string+'/units/'+lower(target_info.short_name),false);
UnitSearchPath.AddPath('/usr/lib/fpc/'+version_string+'/rtl/'+lower(target_info.short_name),false);
{$else}
AddPathToList(UnitSearchPath,ExePath+'../units/'+lower(target_info.short_name),false);
AddPathToList(UnitSearchPath,ExePath+'../rtl/'+lower(target_info.short_name),false);
UnitSearchPath.AddPath(ExePath+'../units/'+lower(target_info.short_name),false);
UnitSearchPath.AddPath(ExePath+'../rtl/'+lower(target_info.short_name),false);
{$endif}
AddPathToList(UnitSearchPath,ExePath,false);
UnitSearchPath.AddPath(ExePath,false);
{ Add unit dir to the object and library path }
AddPathToList(objectsearchpath,unitsearchpath,false);
AddPathToList(librarysearchpath,unitsearchpath,false);
objectsearchpath.AddList(unitsearchpath,false);
librarysearchpath.AddList(unitsearchpath,false);
{ switch assembler if it's binary and we got -a on the cmdline }
if (cs_asm_leave in initglobalswitches) and
@ -1256,7 +1260,10 @@ end;
end.
{
$Log$
Revision 1.34 1999-11-09 23:06:45 peter
Revision 1.35 1999-11-12 11:03:50 peter
* searchpaths changed to stringqueue object
Revision 1.34 1999/11/09 23:06:45 peter
* esi_offset -> selfpointer_offset to be newcg compatible
* hcogegen -> cgbase fixes for newcg

View File

@ -650,11 +650,11 @@ const
2. local includepath
3. global includepath }
found:=false;
path:=search(name+ext,path+';'+current_scanner^.inputfile^.path^+';.',found);
if (not found) and assigned(current_module^.localincludesearchpath) then
path:=search(name+ext,current_module^.localincludesearchpath^,found);
path:=FindFile(name+ext,path+';'+current_scanner^.inputfile^.path^+';.',found);
if (not found) then
path:=search(name+ext,includesearchpath,found);
path:=current_module^.localincludesearchpath.FindFile(name+ext,found);
if (not found) then
path:=includesearchpath.FindFile(name+ext,found);
{ shutdown current file }
current_scanner^.tempcloseinputfile;
{ load new file }
@ -734,9 +734,7 @@ const
else
begin
current_scanner^.skipspace;
if assigned(current_module^.localunitsearchpath) then
stringdispose(current_module^.localunitsearchpath);
current_module^.localunitsearchpath:=stringdup(current_scanner^.readcomment);
current_module^.localunitsearchpath.AddPath(current_scanner^.readcomment,false);
end;
end;
@ -748,9 +746,7 @@ const
else
begin
current_scanner^.skipspace;
if assigned(current_module^.localincludesearchpath) then
stringdispose(current_module^.localincludesearchpath);
current_module^.localincludesearchpath:=stringdup(current_scanner^.readcomment);
current_module^.localincludesearchpath.AddPath(current_scanner^.readcomment,false);
end;
end;
@ -762,9 +758,7 @@ const
else
begin
current_scanner^.skipspace;
if assigned(current_module^.locallibrarysearchpath) then
stringdispose(current_module^.locallibrarysearchpath);
current_module^.locallibrarysearchpath:=stringdup(current_scanner^.readcomment);
current_module^.locallibrarysearchpath.AddPath(current_scanner^.readcomment,false);
end;
end;
@ -776,9 +770,7 @@ const
else
begin
current_scanner^.skipspace;
if assigned(current_module^.localobjectsearchpath) then
stringdispose(current_module^.localobjectsearchpath);
current_module^.localobjectsearchpath:=stringdup(current_scanner^.readcomment);
current_module^.localobjectsearchpath.AddPath(current_scanner^.readcomment,false);
end;
end;
@ -1163,7 +1155,10 @@ const
{
$Log$
Revision 1.66 1999-11-06 14:34:26 peter
Revision 1.67 1999-11-12 11:03:50 peter
* searchpaths changed to stringqueue object
Revision 1.66 1999/11/06 14:34:26 peter
* truncated log to 20 revs
Revision 1.65 1999/10/30 12:32:30 peter

View File

@ -611,9 +611,9 @@
if (Source_Time=-1) then
begin
if is_main then
temp:=search(hs,unitsearchpath,main_found)
temp:=unitsearchpath.FindFile(hs,main_found)
else
temp:=search(hs,includesearchpath,incfile_found);
temp:=includesearchpath.FindFile(hs,incfile_found);
{$ifdef ORDERSOURCES}
if is_main then
begin
@ -756,7 +756,10 @@
{
$Log$
Revision 1.53 1999-11-06 14:34:27 peter
Revision 1.54 1999-11-12 11:03:50 peter
* searchpaths changed to stringqueue object
Revision 1.53 1999/11/06 14:34:27 peter
* truncated log to 20 revs
Revision 1.52 1999/11/05 17:18:03 pierre

View File

@ -72,8 +72,8 @@ Function TLinkergo32v1.WriteResponseFile(isdll:boolean) : Boolean;
Var
linkres : TLinkRes;
i : longint;
HPath : TSearchPathString;
s,s2 : string;
HPath : PStringQueueItem;
s : string;
linklibc : boolean;
begin
WriteResponseFile:=False;
@ -82,20 +82,17 @@ begin
LinkRes.Init(Info.ResName);
{ Write path to search libraries }
if assigned(current_module^.locallibrarysearchpath) then
HPath:=current_module^.locallibrarysearchpath.First;
while assigned(HPath) do
begin
HPath:=current_module^.locallibrarysearchpath^;
while HPath<>'' do
begin
s2:=GetPathFromList(HPath);
LinkRes.Add('-L'+s2);
end;
LinkRes.Add('-L'+HPath^.Data^);
HPath:=HPath^.Next;
end;
HPath:=LibrarySearchPath;
while HPath<>'' do
HPath:=LibrarySearchPath.First;
while assigned(HPath) do
begin
s2:=GetPathFromList(HPath);
LinkRes.Add('-L'+s2);
LinkRes.Add('-L'+HPath^.Data^);
HPath:=HPath^.Next;
end;
{ add objectfiles, start with prt0 always }
@ -189,7 +186,10 @@ end;
end.
{
$Log$
Revision 1.3 1999-11-04 10:55:31 peter
Revision 1.4 1999-11-12 11:03:50 peter
* searchpaths changed to stringqueue object
Revision 1.3 1999/11/04 10:55:31 peter
* TSearchPathString for the string type of the searchpaths, which is
ansistring under FPC/Delphi

View File

@ -71,8 +71,8 @@ Function TLinkerGo32v2.WriteResponseFile(isdll:boolean) : Boolean;
Var
linkres : TLinkRes;
i : longint;
HPath : TSearchPathString;
s,s2 : string;
HPath : PStringQueueItem;
s : string;
linklibc : boolean;
begin
WriteResponseFile:=False;
@ -81,20 +81,17 @@ begin
LinkRes.Init(Info.ResName);
{ Write path to search libraries }
if assigned(current_module^.locallibrarysearchpath) then
HPath:=current_module^.locallibrarysearchpath.First;
while assigned(HPath) do
begin
HPath:=current_module^.locallibrarysearchpath^;
while HPath<>'' do
begin
s2:=GetPathFromList(HPath);
LinkRes.Add('-L'+s2);
end;
LinkRes.Add('-L'+HPath^.Data^);
HPath:=HPath^.Next;
end;
HPath:=LibrarySearchPath;
while HPath<>'' do
HPath:=LibrarySearchPath.First;
while assigned(HPath) do
begin
s2:=GetPathFromList(HPath);
LinkRes.Add('-L'+s2);
LinkRes.Add('-L'+HPath^.Data^);
HPath:=HPath^.Next;
end;
{ add objectfiles, start with prt0 always }
@ -291,7 +288,10 @@ end;
end.
{
$Log$
Revision 1.3 1999-11-04 10:55:31 peter
Revision 1.4 1999-11-12 11:03:50 peter
* searchpaths changed to stringqueue object
Revision 1.3 1999/11/04 10:55:31 peter
* TSearchPathString for the string type of the searchpaths, which is
ansistring under FPC/Delphi

View File

@ -195,7 +195,7 @@ end;
Constructor TLinkerLinux.Init;
begin
Inherited Init;
AddPathToList(LibrarySearchPath,'/lib;/usr/lib;/usr/X11R6/lib',true);
LibrarySearchPath.AddPath('/lib;/usr/lib;/usr/X11R6/lib',true);
end;
@ -235,8 +235,8 @@ Var
cprtobj,
gprtobj,
prtobj : string[80];
HPath : TSearchPathString;
s,s2 : string;
HPath : PStringQueueItem;
s : string;
found,
linkdynamic,
linklibc : boolean;
@ -271,20 +271,17 @@ begin
LinkRes.Init(Info.ResName);
{ Write path to search libraries }
if assigned(current_module^.locallibrarysearchpath) then
HPath:=current_module^.locallibrarysearchpath.First;
while assigned(HPath) do
begin
HPath:=current_module^.locallibrarysearchpath^;
while HPath<>'' do
begin
s2:=GetPathFromList(HPath);
LinkRes.Add('SEARCH_DIR('+s2+')');
end;
LinkRes.Add('SEARCH_DIR('+HPath^.Data^+')');
HPath:=HPath^.Next;
end;
HPath:=LibrarySearchPath;
while HPath<>'' do
HPath:=LibrarySearchPath.First;
while assigned(HPath) do
begin
s2:=GetPathFromList(HPath);
LinkRes.Add('SEARCH_DIR('+s2+')');
LinkRes.Add('SEARCH_DIR('+HPath^.Data^+')');
HPath:=HPath^.Next;
end;
LinkRes.Add('INPUT(');
@ -293,10 +290,10 @@ begin
LinkRes.AddFileName(FindObjectFile(prtobj));
{ try to add crti and crtbegin, they are normally not required, but
adding can sometimes be usefull }
s:=search('crtbegin.o',librarysearchpath,found)+'crtbegin.o';
s:=librarysearchpath.FindFile('crtbegin.o',found)+'crtbegin.o';
if found then
LinkRes.AddFileName(s);
s:=search('crti.o',librarysearchpath,found)+'crti.o';
s:=librarysearchpath.FindFile('crti.o',found)+'crti.o';
if found then
LinkRes.AddFileName(s);
{ main objectfiles }
@ -307,10 +304,10 @@ begin
LinkRes.AddFileName(s);
end;
{ objects which must be at the end }
s:=search('crtend.o',librarysearchpath,found)+'crtend.o';
s:=librarysearchpath.FindFile('crtend.o',found)+'crtend.o';
if found then
LinkRes.AddFileName(s);
s:=search('crtn.o',librarysearchpath,found)+'crtn.o';
s:=librarysearchpath.FindFile('crtn.o',found)+'crtn.o';
if found then
LinkRes.AddFileName(s);
@ -375,7 +372,8 @@ begin
DynLinkStr:='';
if (cs_link_strip in aktglobalswitches) then
StripStr:='-s';
If (Info.DynamicLinker<>'') and (not SharedLibFiles.Empty) then
If (cs_profile in aktmoduleswitches) or
((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then
DynLinkStr:='-dynamic-linker='+Info.DynamicLinker;
{ Write used files and libraries }
@ -437,7 +435,10 @@ end;
end.
{
$Log$
Revision 1.3 1999-11-05 13:15:00 florian
Revision 1.4 1999-11-12 11:03:50 peter
* searchpaths changed to stringqueue object
Revision 1.3 1999/11/05 13:15:00 florian
* some fixes to get the new cg compiling again
Revision 1.2 1999/11/04 10:55:31 peter

View File

@ -65,7 +65,7 @@ implementation
{$else Delphi}
dos,
{$endif Delphi}
globtype,strings,comphook,systems,
globtype,strings,cobjects,comphook,systems,
globals,verbose,files,script;
const profile_flag:boolean=false;
@ -370,8 +370,8 @@ Function TLinkeros2.WriteResponseFile(isdll:boolean) : Boolean;
Var
linkres : TLinkRes;
i : longint;
HPath : TSearchPathString;
s,s2 : string;
HPath : PStringQueueItem;
s : string;
begin
WriteResponseFile:=False;
@ -379,20 +379,17 @@ begin
LinkRes.Init(Info.ResName);
{ Write path to search libraries }
if assigned(current_module^.locallibrarysearchpath) then
HPath:=current_module^.locallibrarysearchpath.First;
while assigned(HPath) do
begin
HPath:=current_module^.locallibrarysearchpath^;
while HPath<>'' do
begin
s2:=GetPathFromList(HPath);
LinkRes.Add('-L'+s2);
end;
LinkRes.Add('-L'+HPath^.Data^);
HPath:=HPath^.Next;
end;
HPath:=LibrarySearchPath;
while HPath<>'' do
HPath:=LibrarySearchPath.First;
while assigned(HPath) do
begin
s2:=GetPathFromList(HPath);
LinkRes.Add('-L'+s2);
LinkRes.Add('-L'+HPath^.Data^);
HPath:=HPath^.Next;
end;
{ add objectfiles, start with prt0 always }
@ -416,13 +413,10 @@ begin
end;
{ Write staticlibraries }
if not StaticLibFiles.Empty then
While not StaticLibFiles.Empty do
begin
While not StaticLibFiles.Empty do
begin
S:=StaticLibFiles.Get;
LinkRes.AddFileName(s)
end;
S:=StaticLibFiles.Get;
LinkRes.AddFileName(s)
end;
{ Write and Close response }
@ -491,7 +485,10 @@ end;
end.
{
$Log$
Revision 1.2 1999-11-04 10:55:31 peter
Revision 1.3 1999-11-12 11:03:50 peter
* searchpaths changed to stringqueue object
Revision 1.2 1999/11/04 10:55:31 peter
* TSearchPathString for the string type of the searchpaths, which is
ansistring under FPC/Delphi

View File

@ -642,8 +642,8 @@ Function TLinkerWin32.WriteResponseFile(isdll:boolean) : Boolean;
Var
linkres : TLinkRes;
i : longint;
HPath : TSearchPathString;
s,s2 : string;
HPath : PStringQueueItem;
s : string;
linklibc : boolean;
begin
WriteResponseFile:=False;
@ -652,20 +652,17 @@ begin
LinkRes.Init(Info.ResName);
{ Write path to search libraries }
if assigned(current_module^.locallibrarysearchpath) then
HPath:=current_module^.locallibrarysearchpath.First;
while assigned(HPath) do
begin
HPath:=current_module^.locallibrarysearchpath^;
while HPath<>'' do
begin
s2:=GetPathFromList(HPath);
LinkRes.Add('SEARCH_DIR('+s2+')');
end;
LinkRes.Add('SEARCH_DIR('+HPath^.Data^+')');
HPath:=HPath^.Next;
end;
HPath:=LibrarySearchPath;
while HPath<>'' do
HPath:=LibrarySearchPath.First;
while assigned(HPath) do
begin
s2:=GetPathFromList(HPath);
LinkRes.Add('SEARCH_DIR('+s2+')');
LinkRes.Add('SEARCH_DIR('+HPath^.Data^+')');
HPath:=HPath^.Next;
end;
{ add objectfiles, start with prt0 always }
@ -1047,7 +1044,10 @@ end;
end.
{
$Log$
Revision 1.5 1999-11-04 10:55:31 peter
Revision 1.6 1999-11-12 11:03:50 peter
* searchpaths changed to stringqueue object
Revision 1.5 1999/11/04 10:55:31 peter
* TSearchPathString for the string type of the searchpaths, which is
ansistring under FPC/Delphi