summaryrefslogtreecommitdiff
path: root/rtl/emx
diff options
context:
space:
mode:
authorjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2013-07-04 22:28:37 +0000
committerjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2013-07-04 22:28:37 +0000
commit703e176f36dc415eeb013f3b84c7265f878c455b (patch)
treea1524954d423971421170267686271c8c40fad18 /rtl/emx
parent91e95a1a064b68fb6bd765e325ee979ea1d6b1d0 (diff)
downloadfpc-703e176f36dc415eeb013f3b84c7265f878c455b.tar.gz
+ added mkdir/chdir/rmdir(rawbytestring) and (unicodestring) to the system unit
* renamed platform-specific pchar versions of those rouines to do_*() and changed them to either rawbytestring or unicodestring depending on the FPCRTL_FILESYSTEM_SINGLE_BYTE_API/FPCRTL_FILESYSTEM_TWO_BYTE_API setting * implemented generic shortstring versions of those routines on top of either rawbytestring or unicodestring depending on the API-kind (in case of the embedded target, if ansistring are not supported they will map directly to shortstring routines instead) * all platform-specific *dir() routines with rawbytestring parameters now receive their parameters in DefaultFileSystemCodePage - removed no longer required ansistring variants from the objpas unit - removed no longer required FPC_SYS_MKDIR etc aliases * factored out empty string and inoutres<>0 checks from platform-specific *dir() routines to generic ones o platform-specific notes: o amiga/morphos: check new pathconv(rawbytestring) function o macos TODO: convert PathArgToFSSpec (and the routines it calls) to rawbytestring o nativent: added SysUnicodeStringToNtStr() function o wii: convert dirio callbacks to use rawbytestring to avoid conversion + test for unicode mk/ch/rm/getdir() git-svn-id: http://svn.freepascal.org/svn/fpc/branches/cpstrrtl@25048 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'rtl/emx')
-rw-r--r--rtl/emx/sysdir.inc66
1 files changed, 30 insertions, 36 deletions
diff --git a/rtl/emx/sysdir.inc b/rtl/emx/sysdir.inc
index 5aeba91021..901bc85742 100644
--- a/rtl/emx/sysdir.inc
+++ b/rtl/emx/sysdir.inc
@@ -3,7 +3,7 @@
Copyright (c) 1999-2000 by Florian Klaempfl and Pavel Ozerski
member of the Free Pascal development team.
- FPC Pascal system unit for the Win32 API.
+ FPC Pascal system unit for EMX.
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
@@ -19,7 +19,7 @@
Directory Handling
*****************************************************************************}
-procedure DosDir (Func: byte; S: PChar);
+procedure DosDir (Func: byte; S: rawbytestring);
begin
DoDirSeparators (S);
@@ -33,17 +33,14 @@ begin
end ['eax', 'edx'];
end;
-procedure MkDir (S: pchar; Len: SizeUInt); [IOCheck, public, alias: 'FPC_SYS_MKDIR'];
+procedure do_MkDir (S: rawbytestring);
var
RC: cardinal;
begin
- if not Assigned (S) or (Len = 0) or (InOutRes <> 0) then
- Exit;
-
if os_mode = osOs2 then
begin
DoDirSeparators (S);
- RC := DosCreateDir (S, nil);
+ RC := DosCreateDir (pchar(S), nil);
if RC <> 0 then
begin
InOutRes := RC;
@@ -60,49 +57,46 @@ begin
end;
-procedure RmDir (S: PChar; Len: SizeUInt); [IOCheck, public, alias: 'FPC_SYS_RMDIR'];
+procedure do_RmDir (S: rawbytestring);
var
RC: cardinal;
begin
- if Assigned (S) and (Len <> 0) and (InOutRes = 0) then
- begin
- if (Len = 1) and (S^ = '.') then
- InOutRes := 16
- else
- if os_mode = osOs2 then
+ if S = '.' then
+ InOutRes := 16
+ else
+ if os_mode = osOs2 then
+ begin
+ DoDirSeparators (S);
+ RC := DosDeleteDir (pchar(S));
+ if RC <> 0 then
begin
- DoDirSeparators (S);
- RC := DosDeleteDir (S);
- if RC <> 0 then
- begin
- InOutRes := RC;
- Errno2InOutRes;
- end;
- end
- else
- { Under EMX 0.9d DOS this routine call may sometimes fail }
- { The syscall documentation indicates clearly that this }
- { routine was NOT tested. }
- DosDir ($3A, S);
- end
+ InOutRes := RC;
+ Errno2InOutRes;
+ end;
+ end
+ else
+ { Under EMX 0.9d DOS this routine call may sometimes fail }
+ { The syscall documentation indicates clearly that this }
+ { routine was NOT tested. }
+ DosDir ($3A, S);
end;
{$ASMMODE INTEL}
-procedure ChDir (S: PChar; Len: SizeUInt); [IOCheck, public, alias: 'FPC_SYS_CHDIR'];
+procedure do_ChDir (S: rawbytestring);
var
RC: cardinal;
+ Len: longint;
begin
- if not Assigned (S) or (Len = 0) or (InOutRes <> 0) then
- exit;
(* According to EMX documentation, EMX has only one current directory
for all processes, so we'll use native calls under OS/2. *)
+ Len := Length (S);
if os_Mode = osOS2 then
begin
- if (Len >= 2) and (S [1] = ':') then
+ if (Len >= 2) and (S [2] = ':') then
begin
- RC := DosSetDefaultDisk ((Ord (S^) and not ($20)) - $40);
+ RC := DosSetDefaultDisk ((Ord (S[1]) and not ($20)) - $40);
if RC <> 0 then
begin
InOutRes := RC;
@@ -112,7 +106,7 @@ begin
if Len > 2 then
begin
DoDirSeparators (S);
- RC := DosSetCurrentDir (S);
+ RC := DosSetCurrentDir (pchar(S));
if RC <> 0 then
begin
InOutRes := RC;
@@ -123,7 +117,7 @@ begin
else
begin
DoDirSeparators (S);
- RC := DosSetCurrentDir (S);
+ RC := DosSetCurrentDir (pchar(S));
if RC <> 0 then
begin
InOutRes:= RC;
@@ -132,7 +126,7 @@ begin
end;
end
else
- if (Len >= 2) and (S [1] = ':') then
+ if (Len >= 2) and (S [2] = ':') then
begin
asm
mov esi, S