home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel Volume 2 #1
/
carousel.iso
/
mactosh
/
lang
/
mod5.hqx
/
M2-5.pit
/
OPTIONS.DEF
next >
Wrap
Text File
|
1985-04-25
|
2KB
|
52 lines
DEFINITION MODULE Options; (* AKG / LG 26.02.81/ PF 06.06.83 *)
(********)
(* 13.06.83 added: FileName,nofile,ChangeExtension PF*)
EXPORT QUALIFIED FileNameAndOptions, GetOption, Termination,
FileName, ChangeExtension;
TYPE Termination = (normal, empty, can, nofile, esc);
TYPE FileName = ARRAY [0..39] OF CHAR; (*** computer dependent **)
PROCEDURE FileNameAndOptions
(VAR default : ARRAY OF CHAR;
VAR name : ARRAY OF CHAR;
VAR term : Termination; acceptOption: BOOLEAN);
(*Read file name and options from terminal.
Reads until a <cr>, blank, <can>, <ctrl-y> or <esc> is typed.
To read the file name a default name can be proposed.
name returns the read file name.
term returns the status of the input termination:
normal : normally terminated
empty : normally terminated, but name is empty
can : <can> is typed, input line cancelled
nofile : <ctrl-y> is typed, no file specified, program should proceed.
esc : <esc> is typed, no file specified, program should terminate.
If acceptOption is TRUE, then options preceded by '/' will be accepted.*)
PROCEDURE GetOption(VAR optStr: ARRAY OF CHAR; VAR length: CARDINAL);
(*To be called repeatedly after FileNameAndOptions, until length = 0.
The characters of the next option are returned in optstr
(terminated with a 0C character if length <= HIGH(optstr) ). *)
PROCEDURE ChangeExtension
(VAR filename : ARRAY OF CHAR;
VAR newExtension: ARRAY OF CHAR);
(* given a filename, change its extension to newExtension.
e.g. from a .MOD filename, build a .OBJ filename, in the format of
your operating system *)
(* notes: type FileName should be used only for variable declarations,
In procedure declarations, ARRAY OF CHAR should be used. This makes
live easier.
type Filename should contain the filename in a printable form, but
this is not specified *)
END Options.