* merged fixes from 1.0.x

This commit is contained in:
peter 2001-12-26 21:03:56 +00:00
parent 1700a42f14
commit 21a8c2cc8e
13 changed files with 399 additions and 105 deletions

View File

@ -215,10 +215,15 @@ END;
PROCEDURE Mouse_Trap_NT; ASSEMBLER; PROCEDURE Mouse_Trap_NT; ASSEMBLER;
ASM ASM
pushl %eax;
PUSH %ES; { Save ES register } PUSH %ES; { Save ES register }
PUSH %DS; { Save DS register } PUSH %DS; { Save DS register }
PUSH %FS; { Save FS register }
PUSHL %EDI; { Save register } PUSHL %EDI; { Save register }
PUSHL %ESI; { Save register } PUSHL %ESI; { Save register }
pushl %ebx;
pushl %ecx;
pushl %edx;
{ ; caution : ds is not the selector for our data !! } { ; caution : ds is not the selector for our data !! }
{$ifdef DEBUG} {$ifdef DEBUG}
MOVL %EDI,%ES:EntryEDI MOVL %EDI,%ES:EntryEDI
@ -253,14 +258,19 @@ ASM
MOVL 28(%EAX), %EAX; { EAX from actionregs } MOVL 28(%EAX), %EAX; { EAX from actionregs }
CALL *MOUSECALLBACK; { Call callback proc } CALL *MOUSECALLBACK; { Call callback proc }
.L_NoCallBack: .L_NoCallBack:
popl %edx;
popl %ecx;
popl %ebx;
POPL %ESI; { Recover register } POPL %ESI; { Recover register }
POPL %EDI; { Recover register } POPL %EDI; { Recover register }
POP %FS; { Restore FS register }
POP %DS; { Restore DS register } POP %DS; { Restore DS register }
POP %ES; { Restore ES register } POP %ES; { Restore ES register }
movzwl %si,%eax movzwl %si,%eax
MOVL %ds:(%Eax), %EAX; MOVL %ds:(%Eax), %EAX;
MOVL %EAX, %ES:42(%EDI); { Set as return addr } MOVL %EAX, %ES:42(%EDI); { Set as return addr }
ADDW $4, %ES:46(%EDI); { adjust stack } ADDW $4, %ES:46(%EDI); { adjust stack }
popl %eax;
IRET; { Interrupt return } IRET; { Interrupt return }
END; END;
@ -737,7 +747,10 @@ Begin
end. end.
{ {
$Log$ $Log$
Revision 1.2 2001-09-22 00:01:42 michael Revision 1.3 2001-12-26 21:03:56 peter
* merged fixes from 1.0.x
Revision 1.2 2001/09/22 00:01:42 michael
+ Merged driver support for mouse from fixbranch + Merged driver support for mouse from fixbranch
Revision 1.1.2.2 2001/09/21 23:53:48 michael Revision 1.1.2.2 2001/09/21 23:53:48 michael

View File

@ -195,41 +195,12 @@
end; end;
end; end;
{****************************************************************************
Helper routines to support old TP styled reals
****************************************************************************}
function real2double(r : real48) : double;
var
res : array[0..7] of byte;
exponent : word;
begin
{ copy mantissa }
res[0]:=0;
res[1]:=r[1] shl 5;
res[2]:=(r[1] shr 3) or (r[2] shl 5);
res[3]:=(r[2] shr 3) or (r[3] shl 5);
res[4]:=(r[3] shr 3) or (r[4] shl 5);
res[5]:=(r[4] shr 3) or (r[5] and $7f) shl 5;
res[6]:=(r[5] and $7f) shr 3;
{ copy exponent }
{ correct exponent: }
exponent:=(word(r[0])+(1023-129));
res[6]:=res[6] or ((exponent and $f) shl 4);
res[7]:=exponent shr 4;
{ set sign }
res[7]:=res[7] or (r[5] and $80);
real2double:=double(res);
end;
{ {
$Log$ $Log$
Revision 1.6 2001-07-30 21:38:54 peter Revision 1.7 2001-12-26 21:03:56 peter
* merged fixes from 1.0.x
Revision 1.6 2001/07/30 21:38:54 peter
* m68k updates merged * m68k updates merged
Revision 1.1.2.3 2001/07/29 23:56:28 carl Revision 1.1.2.3 2001/07/29 23:56:28 carl

View File

@ -17,8 +17,8 @@
{ I think we should use the pascal version, this code isn't } { I think we should use the pascal version, this code isn't }
{ much faster } { much faster }
{ $define FPC_SYSTEM_HAS_FPC_INITIALIZE} { define FPC_SYSTEM_HAS_FPC_INITIALIZE}
{ (*
Procedure fpc_Initialize (Data,TypeInfo : pointer);[Public,Alias:'FPC_INITIALIZE']; {$ifdef hascompilerproc} compilerproc; {$endif} Procedure fpc_Initialize (Data,TypeInfo : pointer);[Public,Alias:'FPC_INITIALIZE']; {$ifdef hascompilerproc} compilerproc; {$endif}
assembler; assembler;
asm asm
@ -134,10 +134,10 @@ asm
pop %ebx pop %ebx
pop %eax pop %eax
end; end;
} *)
{$ define FPC_SYSTEM_HAS_FPC_FINALIZE} { define FPC_SYSTEM_HAS_FPC_FINALIZE}
{ (*
Procedure fpc_finalize (Data,TypeInfo: Pointer);[Public,Alias:'FPC_FINALIZE']; {$ifdef hascompilerproc} compilerproc; {$endif} Procedure fpc_finalize (Data,TypeInfo: Pointer);[Public,Alias:'FPC_FINALIZE']; {$ifdef hascompilerproc} compilerproc; {$endif}
assembler; assembler;
asm asm
@ -250,7 +250,7 @@ asm
pop %ebx pop %ebx
pop %eax pop %eax
end; end;
} *)
{$define FPC_SYSTEM_HAS_FPC_ADDREF} {$define FPC_SYSTEM_HAS_FPC_ADDREF}
@ -482,7 +482,10 @@ end;
{ {
$Log$ $Log$
Revision 1.12 2001-11-17 16:56:08 florian Revision 1.13 2001-12-26 21:03:56 peter
* merged fixes from 1.0.x
Revision 1.12 2001/11/17 16:56:08 florian
* init and final code in genrtti.inc updated * init and final code in genrtti.inc updated
Revision 1.11 2001/11/14 22:59:11 michael Revision 1.11 2001/11/14 22:59:11 michael

View File

@ -983,9 +983,45 @@ Function float32_to_int32_round_to_zero( a: Float32 ): longint;
end; end;
{$endif} {$endif}
{$ifdef SUPPORT_DOUBLE}
{****************************************************************************
Helper routines to support old TP styled reals
****************************************************************************}
function real2double(r : real48) : double;
var
res : array[0..7] of byte;
exponent : word;
begin
{ copy mantissa }
res[0]:=0;
res[1]:=r[1] shl 5;
res[2]:=(r[1] shr 3) or (r[2] shl 5);
res[3]:=(r[2] shr 3) or (r[3] shl 5);
res[4]:=(r[3] shr 3) or (r[4] shl 5);
res[5]:=(r[4] shr 3) or (r[5] and $7f) shl 5;
res[6]:=(r[5] and $7f) shr 3;
{ copy exponent }
{ correct exponent: }
exponent:=(word(r[0])+(1023-129));
res[6]:=res[6] or ((exponent and $f) shl 4);
res[7]:=exponent shr 4;
{ set sign }
res[7]:=res[7] or (r[5] and $80);
real2double:=double(res);
end;
{$endif}
{ {
$Log$ $Log$
Revision 1.2 2001-07-30 21:38:55 peter Revision 1.3 2001-12-26 21:03:56 peter
* merged fixes from 1.0.x
Revision 1.2 2001/07/30 21:38:55 peter
* m68k updates merged * m68k updates merged
Revision 1.1.2.1 2001/07/29 23:58:16 carl Revision 1.1.2.1 2001/07/29 23:58:16 carl

View File

@ -31,16 +31,21 @@
function power(bas,expo : extended) : extended; function power(bas,expo : extended) : extended;
function power(bas,expo : longint) : longint; function power(bas,expo : longint) : longint;
{$ifdef SUPPORT_DOUBLE}
type type
real48 = array[0..5] of byte; real48 = array[0..5] of byte;
function Real2Double(r : real48) : double; function Real2Double(r : real48) : double;
operator := (b:real48) d:double; operator := (b:real48) d:double;
operator := (b:real48) e:extended; operator := (b:real48) e:extended;
{$endif}
{ {
$Log$ $Log$
Revision 1.5 2001-12-13 20:23:19 michael Revision 1.6 2001-12-26 21:03:56 peter
* merged fixes from 1.0.x
Revision 1.5 2001/12/13 20:23:19 michael
+ Added double2real function from main branch + Added double2real function from main branch
Revision 1.4 2001/07/30 21:38:55 peter Revision 1.4 2001/07/30 21:38:55 peter

View File

@ -141,12 +141,11 @@
procedure InitInterfacePointers(objclass: tclass;instance : pointer); procedure InitInterfacePointers(objclass: tclass;instance : pointer);
{$ifdef HASINTF}
var var
intftable : pinterfacetable; intftable : pinterfacetable;
i : longint; i : longint;
begin begin
{$ifdef HASINTF}
if assigned(objclass.classparent) then if assigned(objclass.classparent) then
InitInterfacePointers(objclass.classparent,instance); InitInterfacePointers(objclass.classparent,instance);
intftable:=objclass.getinterfacetable; intftable:=objclass.getinterfacetable;
@ -154,8 +153,11 @@
for i:=0 to intftable^.EntryCount-1 do for i:=0 to intftable^.EntryCount-1 do
ppointer(@(PChar(instance)[intftable^.Entries[i].IOffset]))^:= ppointer(@(PChar(instance)[intftable^.Entries[i].IOffset]))^:=
pointer(intftable^.Entries[i].VTable); pointer(intftable^.Entries[i].VTable);
{$endif HASINTF}
end; end;
{$else HASINTF}
begin
end;
{$endif HASINTF}
class function TObject.InitInstance(instance : pointer) : tobject; class function TObject.InitInstance(instance : pointer) : tobject;
@ -693,7 +695,10 @@
{ {
$Log$ $Log$
Revision 1.17 2001-09-29 21:32:47 jonas Revision 1.18 2001-12-26 21:03:56 peter
* merged fixes from 1.0.x
Revision 1.17 2001/09/29 21:32:47 jonas
* almost all second pass typeconvnode helpers are now processor independent * almost all second pass typeconvnode helpers are now processor independent
* fixed converting boolean to int64/qword * fixed converting boolean to int64/qword
* fixed register allocation bugs which could cause internalerror 10 * fixed register allocation bugs which could cause internalerror 10

View File

@ -1,5 +1,5 @@
# #
# Don't edit, this file is generated by FPCMake Version 1.1 [2001/12/11] # Don't edit, this file is generated by FPCMake Version 1.1 [2001/12/17]
# #
default: all default: all
override PATH:=$(subst \,/,$(PATH)) override PATH:=$(subst \,/,$(PATH))
@ -191,7 +191,7 @@ USELIBGGI=NO
endif endif
override TARGET_UNITS+=$(SYSTEMUNIT) objpas strings $(LINUXUNIT) unix initc $(CPU_UNITS) dos crt objects printer ggigraph sysutils typinfo math varutils getopts heaptrc lineinfo errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants override TARGET_UNITS+=$(SYSTEMUNIT) objpas strings $(LINUXUNIT) unix initc $(CPU_UNITS) dos crt objects printer ggigraph sysutils typinfo math varutils getopts heaptrc lineinfo errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants
override TARGET_LOADERS+=prt0 dllprt0 cprt0 gprt0 cprt21 gprt21 override TARGET_LOADERS+=prt0 dllprt0 cprt0 gprt0 cprt21 gprt21
override TARGET_RSTS+=math varutils typinfo override TARGET_RSTS+=math varutils typinfo variants
override CLEAN_UNITS+=syslinux linux override CLEAN_UNITS+=syslinux linux
override INSTALL_FPCPACKAGE=y override INSTALL_FPCPACKAGE=y
override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC)
@ -213,6 +213,9 @@ endif
ifeq ($(OS_TARGET),netbsd) ifeq ($(OS_TARGET),netbsd)
UNIXINSTALLDIR=1 UNIXINSTALLDIR=1
endif endif
ifeq ($(OS_TARGET),sunos)
UNIXINSTALLDIR=1
endif
else else
ifeq ($(OS_SOURCE),linux) ifeq ($(OS_SOURCE),linux)
UNIXINSTALLDIR=1 UNIXINSTALLDIR=1
@ -223,6 +226,9 @@ endif
ifeq ($(OS_SOURCE),netbsd) ifeq ($(OS_SOURCE),netbsd)
UNIXINSTALLDIR=1 UNIXINSTALLDIR=1
endif endif
ifeq ($(OS_TARGET),sunos)
UNIXINSTALLDIR=1
endif
endif endif
ifndef INSTALL_PREFIX ifndef INSTALL_PREFIX
ifdef UNIXINSTALLDIR ifdef UNIXINSTALLDIR

View File

@ -14,7 +14,7 @@ units=$(SYSTEMUNIT) objpas strings \
getopts heaptrc lineinfo \ getopts heaptrc lineinfo \
errors sockets gpm ipc serial terminfo dl dynlibs \ errors sockets gpm ipc serial terminfo dl dynlibs \
video mouse keyboard variants video mouse keyboard variants
rsts=math varutils typinfo rsts=math varutils typinfo variants
[require] [require]
nortl=y nortl=y

View File

@ -553,7 +553,7 @@ var
end ; end ;
'/': StoreStr(@DateSeparator, 1); '/': StoreStr(@DateSeparator, 1);
':': StoreStr(@TimeSeparator, 1); ':': StoreStr(@TimeSeparator, 1);
' ', 'C', 'D', 'H', 'M', 'N', 'S', 'T', 'Y': begin ' ', 'C', 'D', 'H', 'M', 'N', 'S', 'T', 'Y','Z' : begin
while (P < FormatEnd) and (UpCase(P^) = Token) do while (P < FormatEnd) and (UpCase(P^) = Token) do
P := P + 1; P := P + 1;
Count := P - FormatCurrent; Count := P - FormatCurrent;
@ -602,6 +602,10 @@ var
if Count = 1 then StoreInt(Second, 0) if Count = 1 then StoreInt(Second, 0)
else StoreInt(Second, 2); else StoreInt(Second, 2);
end ; end ;
'Z': begin
if Count = 1 then StoreInt(MilliSecond, 0)
else StoreInt(MilliSecond, 2);
end ;
'T': begin 'T': begin
if Count = 1 then StoreFormat(timereformat(ShortTimeFormat)) if Count = 1 then StoreFormat(timereformat(ShortTimeFormat))
else StoreFormat(TimeReformat(LongTimeFormat)); else StoreFormat(TimeReformat(LongTimeFormat));
@ -673,7 +677,10 @@ end;
{ {
$Log$ $Log$
Revision 1.4 2001-01-18 22:09:09 michael Revision 1.5 2001-12-26 21:03:57 peter
* merged fixes from 1.0.x
Revision 1.4 2001/01/18 22:09:09 michael
+ Merged fixes from fixbranch - file modes + Merged fixes from fixbranch - file modes
Revision 1.3 2000/12/16 15:57:16 jonas Revision 1.3 2000/12/16 15:57:16 jonas

View File

@ -958,6 +958,9 @@ Begin
'-','=' : PushExt(FAltKey(ch)); '-','=' : PushExt(FAltKey(ch));
#10 : PushKey(#10); #10 : PushKey(#10);
'[' : State:=2; '[' : State:=2;
{$IFDEF LINUX}
'O': State:=7;
{$ENDIF}
else else
begin begin
PushKey(ch); PushKey(ch);
@ -1088,6 +1091,16 @@ Begin
if (Ch<>'~') then if (Ch<>'~') then
State:=255; State:=255;
end; end;
{$ifdef LINUX}
7 : begin {Esc[O}
case ch of
'A' : PushExt(72);
'B' : PushExt(80);
'C' : PushExt(77);
'D' : PushExt(75);
end;
end;
{$endif}
255 : ; 255 : ;
end; end;
if State<>0 then if State<>0 then
@ -1669,7 +1682,10 @@ Finalization
End. End.
{ {
$Log$ $Log$
Revision 1.7 2001-07-30 21:53:53 peter Revision 1.8 2001-12-26 21:03:57 peter
* merged fixes from 1.0.x
Revision 1.7 2001/07/30 21:53:53 peter
* reset winminx,winminy to 1 * reset winminx,winminy to 1
Revision 1.6 2001/06/27 20:21:46 peter Revision 1.6 2001/06/27 20:21:46 peter

View File

@ -830,10 +830,29 @@ End;
Procedure setftime(var f; time : longint); Procedure setftime(var f; time : longint);
Begin
{! No Linux equivalent !}
End;
Var
utim: utimbuf;
DT: DateTime;
path: pathstr;
index: Integer;
Begin
doserror:=0;
with utim do
begin
actime:=getepochtime;
UnPackTime(Time,DT);
modtime:=DTToUnixDate(DT);
end;
for Index:=0 to FilerecNameLength-1 do
path[Index+1]:=filerec(f).name[Index];
if not utime(path,utim) then
begin
Time:=0;
doserror:=3;
end;
End;
Procedure setfattr (var f;attr : word); Procedure setfattr (var f;attr : word);
@ -880,7 +899,10 @@ End.
{ {
$Log$ $Log$
Revision 1.10 2001-09-22 11:17:13 peter Revision 1.11 2001-12-26 21:03:57 peter
* merged fixes from 1.0.x
Revision 1.10 2001/09/22 11:17:13 peter
* Fixed passing of command without parameters to Exec() to not include * Fixed passing of command without parameters to Exec() to not include
a space after the executable name a space after the executable name

View File

@ -212,12 +212,18 @@ function CreateShellArgV(const prog:string):ppchar;
function CreateShellArgV(const prog:Ansistring):ppchar; function CreateShellArgV(const prog:Ansistring):ppchar;
procedure FreeShellArgV(p:ppchar); procedure FreeShellArgV(p:ppchar);
Procedure Execve(Path: pathstr;args:ppchar;ep:ppchar); Procedure Execve(Path: pathstr;args:ppchar;ep:ppchar);
Procedure Execve(Path: AnsiString;args:ppchar;ep:ppchar);
Procedure Execve(path: pchar;args:ppchar;ep:ppchar); Procedure Execve(path: pchar;args:ppchar;ep:ppchar);
Procedure Execv(const path:pathstr;args:ppchar); Procedure Execv(const path:pathstr;args:ppchar);
Procedure Execv(const path: AnsiString;args:ppchar);
Procedure Execvp(Path: Pathstr;Args:ppchar;Ep:ppchar); Procedure Execvp(Path: Pathstr;Args:ppchar;Ep:ppchar);
Procedure Execl(const Todo:string); Procedure Execvp(Path: AnsiString; Args:ppchar;Ep:ppchar);
Procedure Execle(Todo:string;Ep:ppchar); Procedure Execl(const Todo: String);
Procedure Execl(const Todo: Ansistring);
Procedure Execle(Todo: String;Ep:ppchar);
Procedure Execle(Todo: AnsiString;Ep:ppchar);
Procedure Execlp(Todo: string;Ep:ppchar); Procedure Execlp(Todo: string;Ep:ppchar);
Procedure Execlp(Todo: Ansistring;Ep:ppchar);
Function Shell(const Command:String):Longint; Function Shell(const Command:String):Longint;
Function Shell(const Command:AnsiString):Longint; Function Shell(const Command:AnsiString):Longint;
Function Fork:longint; Function Fork:longint;
@ -473,7 +479,9 @@ Function Basename(Const path:pathstr;Const suf:pathstr):pathstr;
Function FNMatch(const Pattern,Name:string):Boolean; Function FNMatch(const Pattern,Name:string):Boolean;
Function Glob(Const path:pathstr):pglob; Function Glob(Const path:pathstr):pglob;
Procedure Globfree(var p:pglob); Procedure Globfree(var p:pglob);
Function StringToPPChar(Var S:STring):ppchar; Function StringToPPChar(Var S:String):ppchar;
Function StringToPPChar(Var S:AnsiString):ppchar;
Function StringToPPChar(S : Pchar):ppchar;
Function GetFS(var T:Text):longint; Function GetFS(var T:Text):longint;
Function GetFS(Var F:File):longint; Function GetFS(Var F:File):longint;
{Filedescriptorsets} {Filedescriptorsets}
@ -587,6 +595,44 @@ begin
end; end;
Procedure Execve(Path: AnsiString;args:ppchar;ep:ppchar);
{
overloaded ansistring version.
}
begin
ExecVE(PChar(Path),args,ep);
end;
Procedure Execv(const path: AnsiString;args:ppchar);
{
Overloaded ansistring version.
}
begin
ExecVe(Path,Args,envp)
end;
Procedure Execvp(Path: AnsiString; Args:ppchar;Ep:ppchar);
{
Overloaded ansistring version
}
var
thepath : Ansistring;
begin
if path[1]<>'/' then
begin
Thepath:=strpas(getenv('PATH'));
if thepath='' then
thepath:='.';
Path:=FSearch(path,thepath)
end
else
Path:='';
if Path='' then
linuxerror:=Sys_enoent
else
Execve(Path,args,ep);{On error linuxerror will get set there}
end;
Procedure Execv(const path:pathstr;args:ppchar); Procedure Execv(const path:pathstr;args:ppchar);
{ {
Replaces the current program by the program specified in path, Replaces the current program by the program specified in path,
@ -642,6 +688,24 @@ begin
end; end;
Procedure Execle(Todo:AnsiString;Ep:ppchar);
{
This procedure takes the string 'Todo', parses it for command and
command options, and Executes the command with the given options.
The string 'Todo' shoud be of the form 'command options', options
separated by commas.
the PATH environment is not searched for 'command'.
The specified environment(in 'ep') is passed on to command
}
var
p : ppchar;
begin
p:=StringToPPChar(ToDo);
if (p=nil) or (p^=nil) then
exit;
ExecVE(p^,p,EP);
end;
Procedure Execl(const Todo:string); Procedure Execl(const Todo:string);
{ {
This procedure takes the string 'Todo', parses it for command and This procedure takes the string 'Todo', parses it for command and
@ -675,6 +739,20 @@ begin
end; end;
Procedure Execlp(Todo: Ansistring;Ep:ppchar);
{
Overloaded ansistring version.
}
var
p : ppchar;
begin
p:=StringToPPchar(todo);
if (p=nil) or (p^=nil) then
exit;
ExecVP(StrPas(p^),p,EP);
end;
Function Shell(const Command:String):Longint; Function Shell(const Command:String):Longint;
{ {
Executes the shell, and passes it the string Command. (Through /bin/sh -c) Executes the shell, and passes it the string Command. (Through /bin/sh -c)
@ -920,6 +998,15 @@ begin
SetDateTime:=stime ( LocalToEpoch ( Year, Month, Day, Hour, Minute, Second ) ); SetDateTime:=stime ( LocalToEpoch ( Year, Month, Day, Hour, Minute, Second ) );
end; end;
Procedure Execl(const Todo:Ansistring);
{
Overloaded AnsiString Version of ExecL.
}
begin
ExecLE(ToDo,EnvP);
end;
@ -2184,20 +2271,14 @@ begin
Octal:=oct; Octal:=oct;
end; end;
Function StringToPPChar(S: PChar):ppchar;
Function StringToPPChar(Var S:STring):ppchar;
{
Create a PPChar to structure of pchars which are the arguments specified
in the string S. Especially usefull for creating an ArgV for Exec-calls
}
var var
nr : longint; nr : longint;
Buf : ^char; Buf : ^char;
p : ppchar; p : ppchar;
begin begin
s:=s+#0; buf:=s;
buf:=@s[1];
nr:=0; nr:=0;
while(buf^<>#0) do while(buf^<>#0) do
begin begin
@ -2214,7 +2295,7 @@ begin
LinuxError:=sys_enomem; LinuxError:=sys_enomem;
exit; exit;
end; end;
buf:=@s[1]; buf:=s;
while (buf^<>#0) do while (buf^<>#0) do
begin begin
while (buf^ in [' ',#8,#10]) do while (buf^ in [' ',#8,#10]) do
@ -2335,6 +2416,27 @@ begin
DirName:=Dir; DirName:=Dir;
end; end;
Function StringToPPChar(Var S:String):ppchar;
{
Create a PPChar to structure of pchars which are the arguments specified
in the string S. Especially usefull for creating an ArgV for Exec-calls
Note that the string S is destroyed by this call.
}
begin
S:=S+#0;
StringToPPChar:=StringToPPChar(@S[1]);
end;
Function StringToPPChar(Var S:AnsiString):ppchar;
{
Create a PPChar to structure of pchars which are the arguments specified
in the string S. Especially usefull for creating an ArgV for Exec-calls
}
begin
StringToPPChar:=StringToPPChar(PChar(S));
end;
Function Basename(Const path:pathstr;Const suf:pathstr):pathstr; Function Basename(Const path:pathstr;Const suf:pathstr):pathstr;
@ -2947,7 +3049,10 @@ End.
{ {
$Log$ $Log$
Revision 1.18 2001-11-30 07:16:41 marco Revision 1.19 2001-12-26 21:03:57 peter
* merged fixes from 1.0.x
Revision 1.18 2001/11/30 07:16:41 marco
* TTYname fix from Maarten Beekers. Apparantly accidentally not commited the first time. * TTYname fix from Maarten Beekers. Apparantly accidentally not commited the first time.
Revision 1.17 2001/10/14 13:33:20 peter Revision 1.17 2001/10/14 13:33:20 peter

View File

@ -211,12 +211,18 @@ function SetDateTime(Year,Month,Day,hour,minute,second:Word) : Boolean;
function CreateShellArgV(const prog:string):ppchar; function CreateShellArgV(const prog:string):ppchar;
function CreateShellArgV(const prog:Ansistring):ppchar; function CreateShellArgV(const prog:Ansistring):ppchar;
Procedure Execve(Path: pathstr;args:ppchar;ep:ppchar); Procedure Execve(Path: pathstr;args:ppchar;ep:ppchar);
Procedure Execve(Path: AnsiString;args:ppchar;ep:ppchar);
Procedure Execve(path: pchar;args:ppchar;ep:ppchar); Procedure Execve(path: pchar;args:ppchar;ep:ppchar);
Procedure Execv(const path:pathstr;args:ppchar); Procedure Execv(const path:pathstr;args:ppchar);
Procedure Execv(const path: AnsiString;args:ppchar);
Procedure Execvp(Path: Pathstr;Args:ppchar;Ep:ppchar); Procedure Execvp(Path: Pathstr;Args:ppchar;Ep:ppchar);
Procedure Execl(const Todo:string); Procedure Execvp(Path: AnsiString; Args:ppchar;Ep:ppchar);
Procedure Execle(Todo:string;Ep:ppchar); Procedure Execl(const Todo: String);
Procedure Execl(const Todo: Ansistring);
Procedure Execle(Todo: String;Ep:ppchar);
Procedure Execle(Todo: AnsiString;Ep:ppchar);
Procedure Execlp(Todo: string;Ep:ppchar); Procedure Execlp(Todo: string;Ep:ppchar);
Procedure Execlp(Todo: Ansistring;Ep:ppchar);
Function Shell(const Command:String):Longint; Function Shell(const Command:String):Longint;
Function Shell(const Command:AnsiString):Longint; Function Shell(const Command:AnsiString):Longint;
Function Fork:longint; Function Fork:longint;
@ -467,7 +473,9 @@ Function Basename(Const path:pathstr;Const suf:pathstr):pathstr;
Function FNMatch(const Pattern,Name:string):Boolean; Function FNMatch(const Pattern,Name:string):Boolean;
Function Glob(Const path:pathstr):pglob; Function Glob(Const path:pathstr):pglob;
Procedure Globfree(var p:pglob); Procedure Globfree(var p:pglob);
Function StringToPPChar(Var S:STring):ppchar; Function StringToPPChar(Var S:String):ppchar;
Function StringToPPChar(Var S:AnsiString):ppchar;
Function StringToPPChar(S : Pchar):ppchar;
Function GetFS(var T:Text):longint; Function GetFS(var T:Text):longint;
Function GetFS(Var F:File):longint; Function GetFS(Var F:File):longint;
{Filedescriptorsets} {Filedescriptorsets}
@ -581,6 +589,44 @@ begin
end; end;
Procedure Execve(Path: AnsiString;args:ppchar;ep:ppchar);
{
overloaded ansistring version.
}
begin
ExecVE(PChar(Path),args,ep);
end;
Procedure Execv(const path: AnsiString;args:ppchar);
{
Overloaded ansistring version.
}
begin
ExecVe(Path,Args,envp)
end;
Procedure Execvp(Path: AnsiString; Args:ppchar;Ep:ppchar);
{
Overloaded ansistring version
}
var
thepath : Ansistring;
begin
if path[1]<>'/' then
begin
Thepath:=strpas(getenv('PATH'));
if thepath='' then
thepath:='.';
Path:=FSearch(path,thepath)
end
else
Path:='';
if Path='' then
linuxerror:=Sys_enoent
else
Execve(Path,args,ep);{On error linuxerror will get set there}
end;
Procedure Execv(const path:pathstr;args:ppchar); Procedure Execv(const path:pathstr;args:ppchar);
{ {
Replaces the current program by the program specified in path, Replaces the current program by the program specified in path,
@ -636,6 +682,24 @@ begin
end; end;
Procedure Execle(Todo:AnsiString;Ep:ppchar);
{
This procedure takes the string 'Todo', parses it for command and
command options, and Executes the command with the given options.
The string 'Todo' shoud be of the form 'command options', options
separated by commas.
the PATH environment is not searched for 'command'.
The specified environment(in 'ep') is passed on to command
}
var
p : ppchar;
begin
p:=StringToPPChar(ToDo);
if (p=nil) or (p^=nil) then
exit;
ExecVE(p^,p,EP);
end;
Procedure Execl(const Todo:string); Procedure Execl(const Todo:string);
{ {
This procedure takes the string 'Todo', parses it for command and This procedure takes the string 'Todo', parses it for command and
@ -669,6 +733,20 @@ begin
end; end;
Procedure Execlp(Todo: Ansistring;Ep:ppchar);
{
Overloaded ansistring version.
}
var
p : ppchar;
begin
p:=StringToPPchar(todo);
if (p=nil) or (p^=nil) then
exit;
ExecVP(StrPas(p^),p,EP);
end;
Function Shell(const Command:String):Longint; Function Shell(const Command:String):Longint;
{ {
Executes the shell, and passes it the string Command. (Through /bin/sh -c) Executes the shell, and passes it the string Command. (Through /bin/sh -c)
@ -977,6 +1055,15 @@ begin
LinuxError:=Errno; LinuxError:=Errno;
end; end;
Procedure Execl(const Todo:Ansistring);
{
Overloaded AnsiString Version of ExecL.
}
begin
ExecLE(ToDo,EnvP);
end;
Function fdOpen(pathname:pchar;flags:longint):longint; Function fdOpen(pathname:pchar;flags:longint):longint;
@ -2213,20 +2300,14 @@ begin
Octal:=oct; Octal:=oct;
end; end;
Function StringToPPChar(S: PChar):ppchar;
Function StringToPPChar(Var S:STring):ppchar;
{
Create a PPChar to structure of pchars which are the arguments specified
in the string S. Especially usefull for creating an ArgV for Exec-calls
}
var var
nr : longint; nr : longint;
Buf : ^char; Buf : ^char;
p : ppchar; p : ppchar;
begin begin
s:=s+#0; buf:=s;
buf:=@s[1];
nr:=0; nr:=0;
while(buf^<>#0) do while(buf^<>#0) do
begin begin
@ -2243,7 +2324,7 @@ begin
LinuxError:=sys_enomem; LinuxError:=sys_enomem;
exit; exit;
end; end;
buf:=@s[1]; buf:=s;
while (buf^<>#0) do while (buf^<>#0) do
begin begin
while (buf^ in [' ',#8,#10]) do while (buf^ in [' ',#8,#10]) do
@ -2360,6 +2441,27 @@ begin
DirName:=Dir; DirName:=Dir;
end; end;
Function StringToPPChar(Var S:String):ppchar;
{
Create a PPChar to structure of pchars which are the arguments specified
in the string S. Especially usefull for creating an ArgV for Exec-calls
Note that the string S is destroyed by this call.
}
begin
S:=S+#0;
StringToPPChar:=StringToPPChar(@S[1]);
end;
Function StringToPPChar(Var S:AnsiString):ppchar;
{
Create a PPChar to structure of pchars which are the arguments specified
in the string S. Especially usefull for creating an ArgV for Exec-calls
}
begin
StringToPPChar:=StringToPPChar(PChar(S));
end;
Function Basename(Const path:pathstr;Const suf:pathstr):pathstr; Function Basename(Const path:pathstr;Const suf:pathstr):pathstr;
@ -2972,7 +3074,10 @@ End.
{ {
$Log$ $Log$
Revision 1.19 2001-11-30 07:16:42 marco Revision 1.20 2001-12-26 21:03:57 peter
* merged fixes from 1.0.x
Revision 1.19 2001/11/30 07:16:42 marco
* TTYname fix from Maarten Beekers. Apparantly accidentally not commited the first time. * TTYname fix from Maarten Beekers. Apparantly accidentally not commited the first time.
Revision 1.18 2001/11/05 21:46:06 michael Revision 1.18 2001/11/05 21:46:06 michael