* USE_SYSUTILS merged successfully : cycles with and without defines

* Need to be optimized in performance
This commit is contained in:
mazen 2004-10-14 18:16:17 +00:00
parent a4c5a55d1b
commit e90d8a42e3
17 changed files with 566 additions and 835 deletions

View File

@ -361,7 +361,11 @@ end;
Function def_GetNamedFileTime (Const F : String) : Longint;
var
L : Longint;
{$IFDEF USE_SYSUTILS}
info : TSearchRec;
{$ELSE USE_SYSUTILS}
info : SearchRec;
{$ENDIF USE_SYSUTILS}
begin
l:=-1;
{$IFDEF USE_SYSUTILS}
@ -379,7 +383,11 @@ end;
end.
{
$Log$
Revision 1.29 2004-10-14 17:10:15 mazen
Revision 1.30 2004-10-14 18:16:17 mazen
* USE_SYSUTILS merged successfully : cycles with and without defines
* Need to be optimized in performance
Revision 1.29 2004/10/14 17:10:15 mazen
* use SysUtils unit instead of Dos Unit
+ overload Replace to use AnsiString

View File

@ -74,8 +74,8 @@ var
{$IFDEF USE_SYSUTILS}
{$ELSE USE_SYSUTILS}
e : extstr;
s,
{$ENDIF USE_SYSUTILS}
s,
resobj,
resbin : string;
resfound,
@ -182,7 +182,11 @@ end;
end.
{
$Log$
Revision 1.21 2004-10-14 16:38:38 mazen
Revision 1.22 2004-10-14 18:16:17 mazen
* USE_SYSUTILS merged successfully : cycles with and without defines
* Need to be optimized in performance
Revision 1.21 2004/10/14 16:38:38 mazen
* Merge is complete for this file, cycles !
Revision 1.20 2004/06/20 08:55:29 florian

View File

@ -164,6 +164,7 @@ implementation
uses
{$IFDEF USE_SYSUTILS}
SysUtils,
GlobType,
{$ELSE USE_SYSUTILS}
dos,
{$ENDIF USE_SYSUTILS}
@ -189,7 +190,7 @@ uses
begin
{$IFDEF USE_SYSUTILS}
name:=stringdup(SplitFileName(fn));
path:=stringdupSplitPath(fn));
path:=stringdup(SplitPath(fn));
{$ELSE USE_SYSUTILS}
FSplit(fn,p,n,e);
name:=stringdup(n+e);
@ -740,7 +741,11 @@ uses
end.
{
$Log$
Revision 1.27 2004-10-14 17:26:04 mazen
Revision 1.28 2004-10-14 18:16:17 mazen
* USE_SYSUTILS merged successfully : cycles with and without defines
* Need to be optimized in performance
Revision 1.27 2004/10/14 17:26:04 mazen
* use SysUtils unit instead of Dos Unit
Revision 1.26 2004/08/02 07:15:54 michael

View File

@ -175,6 +175,7 @@ implementation
uses
{$IFDEF USE_SYSUTILS}
SysUtils,
GlobType,
{$ELSE USE_SYSUTILS}
dos,
{$ENDIF USE_SYSUTILS}
@ -700,7 +701,11 @@ implementation
end.
{
$Log$
Revision 1.47 2004-10-14 17:30:09 mazen
Revision 1.48 2004-10-14 18:16:17 mazen
* USE_SYSUTILS merged successfully : cycles with and without defines
* Need to be optimized in performance
Revision 1.47 2004/10/14 17:30:09 mazen
* use SysUtils unit instead of Dos Unit
Revision 1.46 2004/08/30 20:23:33 peter

View File

@ -40,13 +40,12 @@ interface
Baseunix,unix,
{$endif}
{$endif}
{$ifdef Delphi}
{$IFDEF USE_SYSUTILS}
SysUtils,
dmisc,
{$else}
{$ELSE USE_SYSUTILS}
strings,
dos,
{$endif}
{$ENDIF USE_SYSUTILS}
cutils,cclasses,
globtype,version,systems,cpuinfo;
@ -304,7 +303,7 @@ interface
function FixFileName(const s:string):string;
function TargetFixPath(s:string;allowdot:boolean):string;
function TargetFixFileName(const s:string):string;
procedure SplitBinCmd(const s:string;var bstr,cstr:string);
procedure SplitBinCmd(const s:string;var bstr: String;var cstr:TCmdStr);
function FindFile(const f : string;path : string;var foundfile:string):boolean;
function FindFilePchar(const f : string;path : pchar;var foundfile:string):boolean;
function FindExe(const bin:string;var foundfile:string):boolean;
@ -401,11 +400,11 @@ implementation
var
hour,min,sec,hsec : word;
begin
{$ifdef delphi}
dmisc.gettime(hour,min,sec,hsec);
{$else delphi}
{$IFDEF USE_SYSUTILS}
DecodeTime(Time,hour,min,sec,hsec);
{$ELSE USE_SYSUTILS}
dos.gettime(hour,min,sec,hsec);
{$endif delphi}
{$ENDIF USE_SYSUTILS}
gettimestr:=L0(Hour)+':'+L0(min)+':'+L0(sec);
end;
@ -415,13 +414,17 @@ implementation
get the current date in a string YY/MM/DD
}
var
{$IFDEF USE_SYSUTILS}
Year,Month,Day: Word;
{$ELSE USE_SYSUTILS}
Year,Month,Day,Wday : Word;
{$ENDIF USE_SYSUTILS}
begin
{$ifdef delphi}
dmisc.getdate(year,month,day,wday);
{$else}
{$IFDEF USE_SYSUTILS}
DecodeDate(Date,year,month,day);
{$ELSE USE_SYSUTILS}
dos.getdate(year,month,day,wday);
{$endif}
{$ENDIF USE_SYSUTILS}
getdatestr:=L0(Year)+'/'+L0(Month)+'/'+L0(Day);
end;
@ -431,15 +434,30 @@ implementation
convert dos datetime t to a string YY/MM/DD HH:MM:SS
}
var
{$IFDEF USE_SYSUTILS}
DT : TDateTime;
{$ELSE USE_SYSUTILS}
DT : DateTime;
{$ENDIF USE_SYSUTILS}
Year,Month,Day: Word;
hour,min,sec,hsec : word;
begin
if t=-1 then
begin
FileTimeString:='Not Found';
Result := 'Not Found';
exit;
end;
{$IFDEF USE_SYSUTILS}
DT := FileDateToDateTime(t);
DecodeTime(DT,hour,min,sec,hsec);
DecodeDate(DT,year,month,day);
{$ELSE USE_SYSUTILS}
unpacktime(t,DT);
filetimestring:=L0(dt.Year)+'/'+L0(dt.Month)+'/'+L0(dt.Day)+' '+L0(dt.Hour)+':'+L0(dt.min)+':'+L0(dt.sec);
Year := DT.Year;
Month := DT.Month;
Hour := DT.Hour;
{$ENDIF USE_SYSUTILS}
Result := L0(Year)+'/'+L0(Month)+'/'+L0(Day)+' '+L0(Hour)+':'+L0(min)+':'+L0(sec);
end;
@ -525,27 +543,26 @@ implementation
Function FileExists ( Const F : String) : Boolean;
Var
res : boolean;
{$ifndef delphi}
{$IFDEF USE_SYSUTILS}
{$ELSE USE_SYSUTILS}
var
Info : SearchRec;
{$endif}
{$ENDIF USE_SYSUTILS}
begin
{$ifdef delphi}
res:=sysutils.FileExists(f);
{$else}
{$IFDEF USE_SYSUTILS}
Result:=SysUtils.FileExists(f);
{$ELSE USE_SYSUTILS}
findfirst(F,readonly+archive+hidden,info);
res:=(doserror=0);
result:=(doserror=0);
findclose(Info);
{$endif delphi}
{$ENDIF USE_SYSUTILS}
if assigned({$ifndef FPCPROVCAR}@{$endif}do_comment) then
begin
if res then
if Result then
do_comment(V_Tried,'Searching file '+F+'... found')
else
do_comment(V_Tried,'Searching file '+F+'... not found');
end;
FileExists:=res;
end;
@ -606,7 +623,10 @@ implementation
Function PathExists ( F : String) : Boolean;
Var
{$IFDEF USE_SYSUTILS}
{$ELSE USE_SYSUTILS}
FF : file;
{$ENDIF USE_SYSUTILS}
A: word;
I: longint;
begin
@ -621,9 +641,13 @@ implementation
and (((I = 0) and (Length (F) > 1)) or (I <> Length (F) - 1))
then
Delete (F, Length (F), 1);
{$IFDEF USE_SYSUTILS}
PathExists := FileGetAttr(F) and faDirectory = faDirectory;
{$ELSE USE_SYSUTILS}
Assign (FF, FExpand (F));
GetFAttr (FF, A);
PathExists := (DosError = 0) and (A and Directory = Directory);
{$ENDIF USE_SYSUTILS}
end;
@ -662,13 +686,20 @@ implementation
Function SplitFileName(const s:string):string;
{$IFDEF USE_SYSUTILS}
{$ELSE USE_SYSUTILS}
var
p : dirstr;
n : namestr;
e : extstr;
{$ENDIF USE_SYSUTILS}
begin
{$IFDEF USE_SYSUTILS}
SplitFileName:=ExtractFileName(s);
{$ELSE USE_SYSUTILS}
FSplit(s,p,n,e);
SplitFileName:=n+e;
{$ENDIF USE_SYSUTILS}
end;
@ -973,7 +1004,7 @@ implementation
end;
procedure SplitBinCmd(const s:string;var bstr,cstr:string);
procedure SplitBinCmd(const s:string;var bstr:String;var cstr:TCmdStr);
var
i : longint;
begin
@ -1002,7 +1033,11 @@ implementation
CurrentDir,
currPath : string;
subdirfound : boolean;
{$IFDEF USE_SYSUTILS}
dir : TSearchRec;
{$ELSE USE_SYSUTILS}
dir : searchrec;
{$ENDIF USE_SYSUTILS}
hp : TStringListItem;
procedure AddCurrPath;
@ -1077,8 +1112,28 @@ implementation
else
hs:=currpath;
hsd:=SplitPath(hs);
{$IFDEF USE_SYSUTILS}
{$ELSE USE_SYSUTILS}
findfirst(hs,directory,dir);
{$ENDIF USE_SYSUTILS}
subdirfound:=false;
{$IFDEF USE_SYSUTILS}
if findfirst(hs,faDirectory,dir) = 0
then repeat
if (dir.name<>'.') and
(dir.name<>'..') and
((dir.attr and faDirectory)<>0) then
begin
subdirfound:=true;
currpath:=hsd+dir.name+source_info.dirsep;
hp:=Find(currPath);
if not assigned(hp) then
AddCurrPath;
end;
if not subdirfound then
WarnNonExistingPath(currpath);
until findnext(dir) <> 0;
{$ELSE USE_SYSUTILS}
while doserror=0 do
begin
if (dir.name<>'.') and
@ -1095,6 +1150,7 @@ implementation
if not subdirfound then
WarnNonExistingPath(currpath);
end;
{$ENDIF USE_SYSUTILS}
FindClose(dir);
end
else
@ -1383,23 +1439,31 @@ implementation
{$else}
{$ifdef amiga}
begin
{$IFDEF USE_SYSUTILS}
result := ExecuteProcess('',command);
{$ELSE USE_SYSUTILS}
exec('',command);
if (doserror <> 0) then
result := doserror
else
result := dosexitcode;
end;
{$ENDIF USE_SYSUTILS}
{$else}
var
comspec : string;
begin
comspec:=getenv('COMSPEC');
{$IFDEF USE_SYSUTILS}
result := ExecuteProcess(comspec,' /C '+command);
{$ELSE USE_SYSUTILS}
Exec(comspec,' /C '+command);
if (doserror <> 0) then
result := doserror
else
result := dosexitcode;
end;
{$ENDIF USE_SYSUTILS}
{$endif}
{$endif}
@ -1877,17 +1941,27 @@ implementation
var
hs1 : namestr;
hs2 : extstr;
{$IFDEF USE_SYSUTILS}
exeName:String;
{$ENDIF USE_SYSUTILS}
{$ifdef need_path_search}
p : pchar;
{$endif need_path_search}
begin
{$ifdef delphi}
exepath:=dmisc.getenv('PPC_EXEC_PATH');
{$else delphi}
{$IFDEF USE_SYSUTILS}
exepath:=GetEnvironmentVariable('PPC_EXEC_PATH');
{$ELSE USE_SYSUTILS}
exepath:=dos.getenv('PPC_EXEC_PATH');
{$endif delphi}
{$ENDIF USE_SYSUTILS}
if exepath='' then
{$IFDEF USE_SYSUTILS}
exeName := FixFileName(system.paramstr(0));
exepath := ExtractFilePath(exeName);
hs1 := ExtractFileName(exeName);
hs2 := ExtractFileExt(exeName);
{$ELSE USE_SYSUTILS}
fsplit(FixFileName(system.paramstr(0)),exepath,hs1,hs2);
{$ENDIF USE_SYSUTILS}
{$ifdef need_path_search}
if exepath='' then
begin
@ -2047,7 +2121,11 @@ implementation
end.
{
$Log$
Revision 1.143 2004-10-10 15:42:22 peter
Revision 1.144 2004-10-14 18:16:17 mazen
* USE_SYSUTILS merged successfully : cycles with and without defines
* Need to be optimized in performance
Revision 1.143 2004/10/10 15:42:22 peter
* default optimization cpu changed to CLassPentium3
Revision 1.142 2004/10/09 11:27:59 olle

File diff suppressed because it is too large Load Diff

View File

@ -382,8 +382,8 @@ end;
function TLinkerBeOS.MakeExecutable:boolean;
var
binstr,
cmdstr : string;
binstr : String;
cmdstr : TcmdStr;
success : boolean;
DynLinkStr : string[60];
StaticStr,
@ -433,8 +433,8 @@ end;
Function TLinkerBeOS.MakeSharedLibrary:boolean;
var
binstr,
cmdstr : string;
binstr : String;
cmdstr : TCmdStr;
success : boolean;
DynLinkStr : string[60];
StaticStr,
@ -505,7 +505,11 @@ initialization
end.
{
$Log$
Revision 1.12 2004-09-22 15:25:14 mazen
Revision 1.13 2004-10-14 18:16:17 mazen
* USE_SYSUTILS merged successfully : cycles with and without defines
* Need to be optimized in performance
Revision 1.12 2004/09/22 15:25:14 mazen
* Fix error committing : previous version must be in branch USE_SYSUTILS
Revision 1.10 2004/06/20 08:55:32 florian

View File

@ -490,8 +490,8 @@ end;
function TLinkerBSD.MakeExecutable:boolean;
var
binstr,
cmdstr : string;
binstr : String;
cmdstr : TCmdStr;
success : boolean;
DynLinkStr : string[60];
StaticStr,
@ -547,8 +547,8 @@ end;
Function TLinkerBSD.MakeSharedLibrary:boolean;
var
binstr,
cmdstr : string;
binstr : String;
cmdstr : TCmdStr;
success : boolean;
begin
MakeSharedLibrary:=false;
@ -627,7 +627,11 @@ initialization
end.
{
$Log$
Revision 1.21 2004-09-22 15:25:14 mazen
Revision 1.22 2004-10-14 18:16:17 mazen
* USE_SYSUTILS merged successfully : cycles with and without defines
* Need to be optimized in performance
Revision 1.21 2004/09/22 15:25:14 mazen
* Fix error committing : previous version must be in branch USE_SYSUTILS
Revision 1.19 2004/06/20 08:55:32 florian

View File

@ -436,8 +436,8 @@ end;
function TLinkerEMX.MakeExecutable:boolean;
var
binstr,
cmdstr : string;
binstr : String;
cmdstr : TCmdStr;
success : boolean;
i : longint;
AppTypeStr,
@ -518,7 +518,11 @@ initialization
end.
{
$Log$
Revision 1.7 2004-09-22 15:25:14 mazen
Revision 1.8 2004-10-14 18:16:17 mazen
* USE_SYSUTILS merged successfully : cycles with and without defines
* Need to be optimized in performance
Revision 1.7 2004/09/22 15:25:14 mazen
* Fix error committing : previous version must be in branch USE_SYSUTILS
Revision 1.5 2004/09/08 11:23:31 michael

View File

@ -211,8 +211,8 @@ end;
function TLinkerGo32v2.MakeExecutable:boolean;
var
binstr,
cmdstr : string;
binstr : String;
cmdstr : TCmdStr;
success : boolean;
StripStr : string[40];
begin
@ -362,7 +362,11 @@ initialization
end.
{
$Log$
Revision 1.6 2004-09-22 15:25:14 mazen
Revision 1.7 2004-10-14 18:16:17 mazen
* USE_SYSUTILS merged successfully : cycles with and without defines
* Need to be optimized in performance
Revision 1.6 2004/09/22 15:25:14 mazen
* Fix error committing : previous version must be in branch USE_SYSUTILS
Revision 1.4 2004/06/20 08:55:32 florian

View File

@ -432,8 +432,8 @@ end;
function TLinkerLinux.MakeExecutable:boolean;
var
binstr,
cmdstr : string;
binstr : String;
cmdstr : TCmdStr;
success : boolean;
DynLinkStr : string[60];
StaticStr,
@ -486,8 +486,8 @@ var
InitStr,
FiniStr,
SoNameStr : string[80];
binstr,
cmdstr : string;
binstr : String;
cmdstr : TCmdStr;
success : boolean;
begin
MakeSharedLibrary:=false;
@ -579,7 +579,11 @@ end.
{
$Log$
Revision 1.24 2004-09-25 18:44:12 florian
Revision 1.25 2004-10-14 18:16:17 mazen
* USE_SYSUTILS merged successfully : cycles with and without defines
* Need to be optimized in performance
Revision 1.24 2004/09/25 18:44:12 florian
* fixed dyn. linker name for sparc
Revision 1.23 2004/09/22 15:25:14 mazen

View File

@ -549,8 +549,8 @@ Const
function TLinkerNetwlibc.MakeNetwareLoadableModule (isLib : boolean):boolean;
var
binstr,
cmdstr,
binstr : String;
cmdstr : TcmdStr;
xdcname : string;
success : boolean;
StripStr : string[2];
@ -653,7 +653,11 @@ initialization
end.
{
$Log$
Revision 1.6 2004-09-24 10:48:31 armin
Revision 1.7 2004-10-14 18:16:17 mazen
* USE_SYSUTILS merged successfully : cycles with and without defines
* Need to be optimized in performance
Revision 1.6 2004/09/24 10:48:31 armin
* added GROUP for .a files to linker script
Revision 1.5 2004/09/22 15:25:14 mazen

View File

@ -506,8 +506,8 @@ end;
function TLinkerNetware.MakeExecutable:boolean;
var
binstr,
cmdstr : string;
binstr : String;
cmdstr : TCmdStr;
success : boolean;
StripStr : string[2];
begin
@ -571,7 +571,11 @@ initialization
end.
{
$Log$
Revision 1.17 2004-09-24 10:48:31 armin
Revision 1.18 2004-10-14 18:16:17 mazen
* USE_SYSUTILS merged successfully : cycles with and without defines
* Need to be optimized in performance
Revision 1.17 2004/09/24 10:48:31 armin
* added GROUP for .a files to linker script
Revision 1.16 2004/09/22 15:25:14 mazen

View File

@ -436,8 +436,8 @@ end;
function TLinkeros2.MakeExecutable:boolean;
var
binstr,
cmdstr : string;
binstr : String;
cmdstr : TCmdStr;
success : boolean;
i : longint;
AppTypeStr,
@ -518,7 +518,11 @@ initialization
end.
{
$Log$
Revision 1.11 2004-09-22 15:25:14 mazen
Revision 1.12 2004-10-14 18:16:17 mazen
* USE_SYSUTILS merged successfully : cycles with and without defines
* Need to be optimized in performance
Revision 1.11 2004/09/22 15:25:14 mazen
* Fix error committing : previous version must be in branch USE_SYSUTILS
Revision 1.9 2004/09/08 11:23:31 michael

View File

@ -396,8 +396,8 @@ end;
function TLinkersunos.MakeExecutable:boolean;
var
binstr,
cmdstr : string;
binstr : String;
cmdstr : TCmdStr;
success : boolean;
DynLinkStr : string[60];
StaticStr,
@ -442,8 +442,8 @@ end;
Function TLinkersunos.MakeSharedLibrary:boolean;
var
binstr,
cmdstr : string;
binstr : String;
cmdstr : TCmdStr;
success : boolean;
begin
MakeSharedLibrary:=false;
@ -494,7 +494,11 @@ initialization
end.
{
$Log$
Revision 1.11 2004-10-01 17:41:21 marco
Revision 1.12 2004-10-14 18:16:17 mazen
* USE_SYSUTILS merged successfully : cycles with and without defines
* Need to be optimized in performance
Revision 1.11 2004/10/01 17:41:21 marco
* small updates to make playing with sparc/sunos easier
Revision 1.10 2004/09/22 15:25:14 mazen

View File

@ -133,8 +133,8 @@ end;
function TLinkerWatcom.MakeExecutable:boolean;
var
binstr,
cmdstr : string;
binstr : String;
cmdstr : TCmdStr;
success : boolean;
StripStr : string[40];
begin
@ -179,7 +179,11 @@ initialization
end.
{
$Log$
Revision 1.6 2004-09-22 15:25:14 mazen
Revision 1.7 2004-10-14 18:16:17 mazen
* USE_SYSUTILS merged successfully : cycles with and without defines
* Need to be optimized in performance
Revision 1.6 2004/09/22 15:25:14 mazen
* Fix error committing : previous version must be in branch USE_SYSUTILS
Revision 1.4 2004/06/20 08:55:32 florian

View File

@ -1014,8 +1014,8 @@ end;
function TLinkerWin32.MakeExecutable:boolean;
var
binstr,
cmdstr : string;
binstr : String;
cmdstr : TCmdStr;
success : boolean;
cmds,i : longint;
AsBinStr : string[80];
@ -1096,8 +1096,8 @@ end;
Function TLinkerWin32.MakeSharedLibrary:boolean;
var
binstr,
cmdstr : string;
binstr : String;
cmdstr : TCmdStr;
success : boolean;
cmds,
i : longint;
@ -1659,7 +1659,11 @@ initialization
end.
{
$Log$
Revision 1.37 2004-09-22 15:25:14 mazen
Revision 1.38 2004-10-14 18:16:17 mazen
* USE_SYSUTILS merged successfully : cycles with and without defines
* Need to be optimized in performance
Revision 1.37 2004/09/22 15:25:14 mazen
* Fix error committing : previous version must be in branch USE_SYSUTILS
Revision 1.35 2004/06/20 08:55:32 florian