mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 16:26:13 +02:00
+ GetEnvPChar added
This commit is contained in:
parent
2930a10314
commit
a92d2c1f76
@ -175,6 +175,7 @@ function exec(path:pathstr;runflags:execrunflags;winflags:execwinflags;
|
|||||||
const comline:comstr):longint;
|
const comline:comstr):longint;
|
||||||
function envcount:longint;
|
function envcount:longint;
|
||||||
function envstr(index:longint) : string;
|
function envstr(index:longint) : string;
|
||||||
|
function GetEnvPChar (EnvVar: string): PChar;
|
||||||
function getenv(const envvar:string): string;
|
function getenv(const envvar:string): string;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -854,7 +855,7 @@ begin
|
|||||||
if os_mode = osOS2 then
|
if os_mode = osOS2 then
|
||||||
begin
|
begin
|
||||||
New (F.FStat);
|
New (F.FStat);
|
||||||
F.Handle := $FFFFFFFF;
|
F.Handle := longint ($FFFFFFFF);
|
||||||
Count := 1;
|
Count := 1;
|
||||||
DosError := integer (DosFindFirst (Path, F.Handle,
|
DosError := integer (DosFindFirst (Path, F.Handle,
|
||||||
Attr and FindResvdMask, F.FStat, SizeOf (F.FStat^),
|
Attr and FindResvdMask, F.FStat, SizeOf (F.FStat^),
|
||||||
@ -933,18 +934,17 @@ begin
|
|||||||
envstr:=strpas(hp);
|
envstr:=strpas(hp);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetEnv (const EnvVar: string): string;
|
function GetEnvPChar (EnvVar: string): PChar;
|
||||||
(* The assembler version is more than three times as fast as Pascal. *)
|
(* The assembler version is more than three times as fast as Pascal. *)
|
||||||
var
|
var
|
||||||
P: PChar;
|
P: PChar;
|
||||||
_EnvVar: string;
|
|
||||||
begin
|
begin
|
||||||
_EnvVar := UpCase (EnvVar);
|
EnvVar := UpCase (EnvVar);
|
||||||
{$ASMMODE INTEL}
|
{$ASMMODE INTEL}
|
||||||
asm
|
asm
|
||||||
cld
|
cld
|
||||||
mov edi, Environment
|
mov edi, Environment
|
||||||
lea esi, _EnvVar
|
lea esi, EnvVar
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
lodsb
|
lodsb
|
||||||
@NewVar:
|
@NewVar:
|
||||||
@ -989,7 +989,14 @@ begin
|
|||||||
mov P, edi { place pointer to variable contents in P }
|
mov P, edi { place pointer to variable contents in P }
|
||||||
@End:
|
@End:
|
||||||
end;
|
end;
|
||||||
GetEnv := StrPas (P);
|
GetEnvPChar := P;
|
||||||
|
end;
|
||||||
|
{$ASMMODE ATT}
|
||||||
|
|
||||||
|
function GetEnv (const EnvVar: string): string;
|
||||||
|
(* The assembler version is more than three times as fast as Pascal. *)
|
||||||
|
begin
|
||||||
|
GetEnv := StrPas (GetEnvPChar (EnvVar));
|
||||||
end;
|
end;
|
||||||
{$ASMMODE ATT}
|
{$ASMMODE ATT}
|
||||||
|
|
||||||
@ -1214,7 +1221,10 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.22 2002-12-07 19:46:56 hajny
|
Revision 1.23 2003-01-04 15:43:50 hajny
|
||||||
|
+ GetEnvPChar added
|
||||||
|
|
||||||
|
Revision 1.22 2002/12/07 19:46:56 hajny
|
||||||
* mistyping fixed
|
* mistyping fixed
|
||||||
|
|
||||||
Revision 1.21 2002/12/07 19:17:13 hajny
|
Revision 1.21 2002/12/07 19:17:13 hajny
|
||||||
|
Loading…
Reference in New Issue
Block a user