123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325 |
- {
- This file is part of the Free Pascal run time library.
- Copyright (c) 1999-2000 by Florian Klaempfl
- member of the Free Pascal development team
- Sysutils unit for BeOS
- See the file COPYING.FPC, included in this distribution,
- for details about the copyright.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- **********************************************************************}
- unit sysutils;
- interface
- {$MODE objfpc}
- { force ansistrings }
- {$H+}
- uses
- beos,
- dos;
- { Include platform independent interface part }
- {$i sysutilh.inc}
- implementation
- uses
- sysconst;
- (* Potentially needed FPC_FEXPAND_* defines should be defined here. *)
- { Include platform independent implementation part }
- {$i sysutils.inc}
- {****************************************************************************
- File Functions
- ****************************************************************************}
- Function FileOpen (Const FileName : string; Mode : Integer) : Longint;
- BEGIN
- end;
- Function FileCreate (Const FileName : String) : longint;
- begin
- end;
- Function FileCreate (Const FileName : String;Mode:longint) : longint;
- begin
- end;
- Function FileRead (Handle : Longint; Var Buffer; Count : longint) : Longint;
- begin
- end;
- Function FileWrite (Handle : Longint; const Buffer; Count : Longint) : Longint;
- begin
- end;
- Function FileSeek (Handle,FOffset,Origin : longint) : longint;
- begin
- end;
- Function FileSeek (Handle:longint;FOffset: Int64; Origin: Longint) : int64;
- begin
- end;
- Procedure FileClose (Handle : Longint);
- begin
- end;
- Function FileTruncate (Handle: longint;Size: Int64) : boolean;
- begin
- end;
- Function FileAge (Const FileName : String): Longint;
- begin
- end;
- Function FileExists (Const FileName : String) : Boolean;
- begin
- end;
- Function FindFirst (Const Path : String; Attr : Longint; out Rslt : TSearchRec) : Longint;
- begin
- end;
- Function FindNext (Var Rslt : TSearchRec) : Longint;
- begin
- end;
- Procedure FindClose (Var F : TSearchrec);
- begin
- end;
- Function FileGetDate (Handle : Longint) : Longint;
- begin
- end;
- Function FileSetDate (Handle,Age : Longint) : Longint;
- begin
- end;
- Function FileGetAttr (Const FileName : String) : Longint;
- begin
- end;
- Function FileSetAttr (Const Filename : String; Attr: longint) : Longint;
- begin
- end;
- Function DeleteFile (Const FileName : String) : Boolean;
- begin
- end;
- Function RenameFile (Const OldName, NewName : String) : Boolean;
- begin
- end;
- {****************************************************************************
- Disk Functions
- ****************************************************************************}
- Function DiskFree(Drive: Byte): int64;
- Begin
- End;
- Function DiskSize(Drive: Byte): int64;
- Begin
- End;
- Function GetCurrentDir : String;
- begin
- GetDir(0,Result);
- end;
- Function SetCurrentDir (Const NewDir : String) : Boolean;
- begin
- {$I-}
- ChDir(NewDir);
- {$I+}
- result := (IOResult = 0);
- end;
- Function CreateDir (Const NewDir : String) : Boolean;
- begin
- {$I-}
- MkDir(NewDir);
- {$I+}
- result := (IOResult = 0);
- end;
- Function RemoveDir (Const Dir : String) : Boolean;
- begin
- {$I-}
- RmDir(Dir);
- {$I+}
- result := (IOResult = 0);
- end;
- function DirectoryExists (const Directory: string): boolean;
- begin
- end;
- {****************************************************************************
- Misc Functions
- ****************************************************************************}
- procedure Beep;
- begin
- end;
- {****************************************************************************
- Locale Functions
- ****************************************************************************}
- Procedure GetLocalTime(var SystemTime: TSystemTime);
- begin
- end ;
- Procedure InitAnsi;
- Var
- i : longint;
- begin
- { Fill table entries 0 to 127 }
- for i := 0 to 96 do
- UpperCaseTable[i] := chr(i);
- for i := 97 to 122 do
- UpperCaseTable[i] := chr(i - 32);
- for i := 123 to 191 do
- UpperCaseTable[i] := chr(i);
- Move (CPISO88591UCT,UpperCaseTable[192],SizeOf(CPISO88591UCT));
- for i := 0 to 64 do
- LowerCaseTable[i] := chr(i);
- for i := 65 to 90 do
- LowerCaseTable[i] := chr(i + 32);
- for i := 91 to 191 do
- LowerCaseTable[i] := chr(i);
- Move (CPISO88591LCT,UpperCaseTable[192],SizeOf(CPISO88591UCT));
- end;
- Procedure InitInternational;
- begin
- InitInternationalGeneric;
- InitAnsi;
- end;
- function SysErrorMessage(ErrorCode: Integer): String;
- begin
- Str(Errorcode,Result);
- Result:='Error '+Result;
- end;
- {****************************************************************************
- OS utility functions
- ****************************************************************************}
- Function GetEnvironmentVariable(Const EnvVar : String) : String;
- begin
- Result:=StrPas(beos.Getenv(PChar(EnvVar)));
- end;
- Function GetEnvironmentVariableCount : Integer;
- begin
- // Result:=FPCCountEnvVar(EnvP);
- Result:=0;
- end;
- Function GetEnvironmentString(Index : Integer) : String;
- begin
- // Result:=FPCGetEnvStrFromP(Envp,Index);
- Result:='';
- end;
- function ExecuteProcess (const Path: AnsiString; const ComLine: AnsiString):
- integer;
- var
- CommandLine: AnsiString;
- begin
- { always surround the name of the application by quotes
- so that long filenames will always be accepted. But don't
- do it if there are already double quotes!
- }
- if pos('"',path)=0 then
- CommandLine:='"'+path+'"'
- else
- CommandLine:=path;
- if ComLine <> '' then
- CommandLine := Commandline + ' ' + ComLine;
- ExecuteProcess := beos.shell (CommandLine);
- end;
- function ExecuteProcess (const Path: AnsiString;
- const ComLine: array of AnsiString): integer;
- {$WARNING Should be probably changed according to the Unix version}
- var
- CommandLine: AnsiString;
- I: integer;
- begin
- Commandline := '';
- for I := 0 to High (ComLine) do
- if Pos (' ', ComLine [I]) <> 0 then
- CommandLine := CommandLine + ' ' + '"' + ComLine [I] + '"'
- else
- CommandLine := CommandLine + ' ' + Comline [I];
- ExecuteProcess := ExecuteProcess (Path, CommandLine);
- end;
- {****************************************************************************
- Initialization code
- ****************************************************************************}
- Initialization
- InitExceptions; { Initialize exceptions. OS independent }
- InitInternational; { Initialize internationalization settings }
- Finalization
- DoneExceptions;
- end.
|