home *** CD-ROM | disk | FTP | other *** search
- -- An exact copy of this module appears in both the Pascal and C libraries.
- {*********************************************************************
- (C) Copyright 1983-92 MetaWare Incorporated; Santa Cruz, CA 95060.
- *********************************************************************}
- Export(System,MSDOS,Fileh_type);
- pragma include('STATUS.pf');
- pragma include('SYSTEM.pf');
- pragma include('MSDOS.pf');
- pragma fragmented_implementation(System);
- pragma fragmented_implementation(MSDOS);
- with Status;
-
- program Implement_DOS_interface;
- pragma Alias(Implement_DOS_interface,Implement.RTE || 'dos_interface3');
- pragma off(emit_names); pragma on(optimize_for_space);
-
- with Registers;
- with Loopholes:[Address,Adr,Retype,&,Move,<<,|];
-
- #if PPLIB
- function Cstring(const Pstring:String; var Buf:Strcopy):Address;
- var Last:Cardinal;
- begin
- Move(Adr(Pstring[1]),Adr(Buf),Min(Maxlength(Buf),Length(Pstring)));
- -- Due to PCDOS 2.1 bug, we can't have extra blanks at the
- -- end of a file name. So we must place the null character right
- -- after the text. (This bug wasn't on PCDOS 2.0 or on Victor systems.)
- Last := Length(Pstring)+1 %Min Maxlength(Buf);
- -- Do not put chr(0) after a blank if we can avoid it:
- while (Last > 1) and then (Buf[Last-1] = ' ') do Dec(Last);
- Buf[Last] := Chr(0);
- return(Buf!Adr);
- end;
- #endif
-
- procedure Stringproc(Dos_name,C_DOS_Name) (Stringparm(Name); I:Byte);
- #if PPLIB
- var S: Strcopy;
- #endif
- begin
- #if PPLIB
- Load_DS_DX(Cstring(Name,S));
- #else
- Load_DS_DX(Name %Retype Address);
- #endif
- DOS(I);
- end;
-
- function Stringproc(Create,C_create) (Stringparm(Name); Mode: File_mode): File_handle;
- begin
- CX.R := Retype(Mode,Byte);
- DOS_name(Name,60);
- return(AX.L);
- end;
-
- value Sharing_mode := Compatibility;
-
- function Stringproc(Open,C_open) (Stringparm(Name); Method: Open_method): File_handle;
- begin
- AX.L := (Sharing_mode!Ord << 4) | Method!Ord;
- DOS_name(Name,61);
- return(AX.L);
- end;
-
- procedure Stringproc(Unlink,C_unlink) (Stringparm(Name));
- begin
- DOS_name(Name,65);
- end;
-
- -- (C) Copyright 1983,84,85 MetaWare Incorporated; Santa Cruz, CA 95060.
-