* fixes for dosh.inc

* Executeprocess iverloaded function
* updated todo
This commit is contained in:
yuri 2004-02-15 08:02:44 +00:00
parent 715bb087b0
commit b1a8443699
3 changed files with 113 additions and 43 deletions

View File

@ -94,7 +94,16 @@ const
ExecFlags: cardinal = ord (efwait);
var
dosexitcode:word;
dosexitcodevar:word;
{$I dosh.inc}
{OS/2 specific functions}
function exec(path:pathstr;runflags:execrunflags;winflags:execwinflags;
const comline:comstr):longint;
function GetEnvPChar (EnvVar: string): PChar;
implementation
@ -154,7 +163,7 @@ end;
procedure exec(const path:pathstr;const comline:comstr);
{Execute a program.}
begin
dosexitcode:=word(exec(path,execrunflags(ExecFlags),efdefault,comline));
dosexitcodevar:=word(exec(path,execrunflags(ExecFlags),efdefault,comline));
end;
function exec(path:pathstr;runflags:execrunflags;winflags:execwinflags;
@ -258,15 +267,15 @@ begin
DosVersion:=Major or Minor shl 8;
end;
procedure GetDate (var Year, Month, Day, DayOfWeek: word);
procedure GetDate (var Year, Month, MDay, WDay: word);
Var
dt: TDateTime;
begin
DosGetDateTime(dt);
Year:=dt.year;
Month:=dt.month;
Day:=dt.Day;
DayofWeek:=dt.Weekday;
MDay:=dt.Day;
WDay:=dt.Weekday;
end;
procedure SetDate (Year, Month, Day: word);
@ -416,7 +425,7 @@ begin
envcount:=envc;
end;
function envstr(index : longint) : string;
function envstr(index : integer) : string;
var hp:Pchar;
@ -489,7 +498,7 @@ begin
end;
{$ASMMODE ATT}
function GetEnv (const EnvVar: string): string;
Function GetEnv(envvar: string): string;
(* The assembler version is more than three times as fast as Pascal. *)
begin
GetEnv := StrPas (GetEnvPChar (EnvVar));
@ -554,40 +563,40 @@ function FExpand (const Path: PathStr): PathStr;
{$UNDEF FPC_FEXPAND_DRIVES}
{$UNDEF FPC_FEXPAND_UNC}
procedure packtime(var d:datetime;var time:longint);
procedure packtime(var t:datetime;var p:longint);
var zs:longint;
begin
time:=-1980;
time:=time+d.year and 127;
time:=time shl 4;
time:=time+d.month;
time:=time shl 5;
time:=time+d.day;
time:=time shl 16;
zs:=d.hour;
p:=-1980;
p:=p+t.year and 127;
p:=p shl 4;
p:=p+t.month;
p:=p shl 5;
p:=p+t.day;
p:=p shl 16;
zs:=t.hour;
zs:=zs shl 6;
zs:=zs+d.min;
zs:=zs+t.min;
zs:=zs shl 5;
zs:=zs+d.sec div 2;
time:=time+(zs and $ffff);
zs:=zs+t.sec div 2;
p:=p+(zs and $ffff);
end;
procedure unpacktime (time:longint;var d:datetime);
procedure unpacktime (p:longint;var t:datetime);
begin
d.sec:=(time and 31) * 2;
time:=time shr 5;
d.min:=time and 63;
time:=time shr 6;
d.hour:=time and 31;
time:=time shr 5;
d.day:=time and 31;
time:=time shr 5;
d.month:=time and 15;
time:=time shr 4;
d.year:=time+1980;
t.sec:=(p and 31) * 2;
p:=p shr 5;
t.min:=p and 63;
p:=p shr 6;
t.hour:=p and 31;
p:=p shr 5;
t.day:=p and 31;
p:=p shr 5;
t.month:=p and 15;
p:=p shr 4;
t.year:=p+1980;
end;
procedure GetFAttr (var F; var Attr: word);
@ -619,10 +628,50 @@ begin
DosError := integer (RC);
end;
function DosExitCode: word;
begin
DosExitCode:=dosexitcodevar;
end;
Procedure Intr(intno: byte; var regs: registers);
begin
end;
Procedure MSDos(var regs: registers);
begin
end;
Procedure GetIntVec(intno: byte; var vector: pointer);
begin
end;
Procedure SetIntVec(intno: byte; vector: pointer);
begin
end;
Procedure Keep(exitcode: word);
begin
end;
function GetShortName(var p : String) : boolean;
begin
GetShortName:=true;
end;
function GetLongName(var p : String) : boolean;
begin
GetLongName:=true;
end;
end.
{
$Log$
Revision 1.34 2004-02-09 12:03:16 michael
Revision 1.35 2004-02-15 08:02:44 yuri
* fixes for dosh.inc
* Executeprocess iverloaded function
* updated todo
Revision 1.34 2004/02/09 12:03:16 michael
+ Switched to single interface in dosh.inc
Revision 1.33 2003/11/05 09:13:59 yuri

View File

@ -258,7 +258,7 @@ const
{Start the new session independent or as a child.}
ssf_Related_Independent = 0; {Start new session independent
of the calling session.}
ssf_Related_Child = 1; {Start new session as a child
ssf_Related_Child = 1; {Start new session as a child
session to the calling session.}
{Start the new session in the foreground or in the background.}
@ -270,9 +270,9 @@ const
ssf_TraceOpt_None = 0; {No trace.}
ssf_TraceOpt_Trace = 1; {Trace with no notification
of descendants.}
ssf_TraceOpt_TraceAll = 2; {Trace all descendant sessions.
A termination queue must be
supplied and Related must be
ssf_TraceOpt_TraceAll = 2; {Trace all descendant sessions.
A termination queue must be
supplied and Related must be
ssf_Related_Child (=1).}
{Will the new session inherit open file handles
@ -944,6 +944,19 @@ begin
raise E;
end;
function ExecuteProcess(Const Path: AnsiString; Const ComLine: Array of AnsiString):integer;
Var
CommandLine : AnsiString;
i : Integer;
Begin
Commandline:='';
For i:=0 to high(ComLine) Do
Commandline:=CommandLine+' '+Comline[i];
ExecuteProcess:=ExecuteProcess(Path,CommandLine);
End;
{****************************************************************************
Initialization code
****************************************************************************}
@ -957,7 +970,12 @@ end.
{
$Log$
Revision 1.40 2004-01-20 23:11:20 hajny
Revision 1.41 2004-02-15 08:02:44 yuri
* fixes for dosh.inc
* Executeprocess iverloaded function
* updated todo
Revision 1.40 2004/01/20 23:11:20 hajny
* ExecuteProcess fixes, ProcessID and ThreadID added
Revision 1.39 2003/11/26 20:00:19 florian

View File

@ -6,7 +6,7 @@ Persons:
DM - Daniel Mantione (as daniel)
TH - Tomas Hajny (as hajny)
RB - Ramon Bosque
KB - Karoly Balogh
KB - Karoly Balogh (as karoly)
YP - Yuri Prokushev (as yuri)
AS - Andry Svirgunov
@ -28,10 +28,10 @@ RTL high
libgdb medium
OS/2 native rtl high
- system.pas
- system.pas..............................................YP/TH
- crt.pas.................................................YP
- dos.pas.................................................YP
- sysutils.pp
- sysutils.pp.............................................YP/TH
- ports.pas
- thread.inc..............................................YP
- linker (LINK386, Internal, ...)
@ -80,17 +80,20 @@ native packages medium
Anyway, interface must be compatible with libc package)
- SOM (SOM2, not SOM3, because all current OS/2 implementations based on SOM2)
- Base API
- SOM
- DSOM
- SOMIR
- Base classes
- WPS
- Base classes
- CW BubblePad class
- IBM MM classes (seems to be obsolete in eCS 1.1+)
- CW MM classes (seems to be replacement for IBM MM classes in eCS 1.1+)
- IBM MM classes (obsolete since eCS 1.2)
- CW MM classes (new since eCS 1.2)
- eWorkplace/XWorkplace classes (new since eCS 1.1)
- OpenDoc classes (obsolete since OS/2 4.5)
- DSOM
- Security/2 (os2.kiev.ua)
- UniAud/2 (os2.kiev.ua)
- WPS Toolkit (wpstk.netlabs.org)
cross-platform packages low
- SVGAlib (?)