home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
pmos2002.zip
/
UTIL
/
DEF
/
PPMISC.DEF
< prev
Wrap
Text File
|
1996-08-03
|
5KB
|
126 lines
DEFINITION MODULE PPMisc;
(********************************************************)
(* *)
(* Miscellaneous procedures for preprocessor. *)
(* *)
(* The purpose of this module is to collect *)
(* together the compiler-dependent of the *)
(* preprocessor. The module consists mostly *)
(* of file and string operations. *)
(* *)
(* Programmer: P. Moylan *)
(* Last edited: 3 August 1996 *)
(* Status: Working with FST, TopSpeed 1.17 *)
(* TopSpeed 3.10, and XDS *)
(* *)
(* Rowley version is untested and probably wrong. *)
(* *)
(********************************************************)
(*<FST|Rowley
IMPORT FileSystem;
>*)
(*<TopSpeed
IMPORT FIO;
>*)
(*<XDS*)
IMPORT IOChan;
(*>*)
TYPE File = (*<TopSpeed FIO.File; >*)
(*<FST|Rowley FileSystem.File; >*)
(*<XDS*) IOChan.ChanId; (*>*)
(************************************************************************)
(* STRING OPERATIONS *)
(************************************************************************)
PROCEDURE Length (s: ARRAY OF CHAR): CARDINAL;
(* Returns the length of string s. *)
PROCEDURE StringMatch (s1, s2: ARRAY OF CHAR): BOOLEAN;
(* Returns TRUE iff the two strings are equal. *)
PROCEDURE CopyString (src: ARRAY OF CHAR; VAR (*OUT*) dst: ARRAY OF CHAR);
(* Copies src to dst. *)
PROCEDURE Pos (pattern, string: ARRAY OF CHAR): CARDINAL;
(* If pattern is a substring of string, returns the index in *)
(* string of the start of the first occurrence of pattern. If *)
(* no match then the value returned is beyond the end of string. *)
(************************************************************************)
(* TERMINAL I/O *)
(************************************************************************)
PROCEDURE Message (mess: ARRAY OF CHAR);
(* Writes a string to the screen. *)
PROCEDURE EndOfMessage;
(* Goes to the next line on the screen. *)
PROCEDURE CommandLine (argNr: CARDINAL; VAR (*OUT*) strg : ARRAY OF CHAR;
VAR (*OUT*) arglen : CARDINAL);
(* Picks up argument number argNr from the command line. If there *)
(* is no such argument then arglen is returned as zero. *)
(* Warning: in the XDS case, argNr is ignored and arguments are *)
(* processed strictly in their order of occurrence. *)
(************************************************************************)
(* FILE OPERATIONS *)
(************************************************************************)
PROCEDURE OpenFile (VAR (*OUT*) f: File; filename: ARRAY OF CHAR;
create: BOOLEAN): BOOLEAN;
(* Opens the file specified as "filename". We open it for input if *)
(* create=FALSE, or create a new file for output if create=TRUE. *)
(* The function result indicates success. *)
(* Warning: the code used for TopSpeed allocates file buffers on *)
(* the assumption that we never have more than one input file and *)
(* one output file open at any one time. *)
PROCEDURE CloseFile (VAR (*INOUT*) f: File);
(* Closes file f. *)
PROCEDURE EndOfFile (VAR (*INOUT*) f: File): BOOLEAN;
(* Returns TRUE iff the end of file f has been reached. *)
PROCEDURE WriteToFile (VAR (*INOUT*) f: File;
VAR (*IN*) str: ARRAY OF CHAR);
(* Writes a text string to file f. *)
PROCEDURE TerminateLine (VAR (*INOUT*) f: File);
(* Writes an end-of-line to file f. *)
PROCEDURE ReadLine (VAR (*INOUT*) f: File; VAR (*OUT*) strg: ARRAY OF CHAR);
(* Reads a line of text from file f. *)
PROCEDURE DeleteFile (name: ARRAY OF CHAR);
(* Deletes a file, if it exists. The file must not be open. *)
PROCEDURE RenameFile (originalname, newname: ARRAY OF CHAR);
(* Renames an existing file. The file should not be open. *)
END PPMisc.