-- FileUtilDefs.Mesa
-- last edited July 1, 1982 5:43 pm By Paul Rovner

DIRECTORY
  IO USING [Handle],
  Rope USING [ROPE];

FileUtilDefs: DEFINITIONS
= BEGIN

UpperCase: PROC[ch: CHARACTER] RETURNS[CHARACTER];

FileExists: PROC [fileName: Rope.ROPE] RETURNS [BOOLEAN];

	-- If name has an extension, and it is not the desired one, result is
	--  FALSE. If the extension is the one desired, result is TRUE. If the
	--  name has no extension, tack the desired one on and return TRUE.
ExtendFileName: PROC [name, extension: Rope.ROPE]
			RETURNS [extendedName: Rope.ROPE, extended: BOOLEAN];

	-- Snarf "words" (terminated by SP, TAB or CR) from s until either
	--  one is found which has (or can be extended with) the
	--  indicated extension or s is exhausted. '/...' word suffixes are stuck into 'switches' 
	-- BEWARE: this changes its 'name' and 'switches' parameters.
	--  name.length = 0 => none found. Otherwise, name is the
	--  (extended) file name.
GetExtendedFileName: PROC [s: IO.Handle,
                           extensionName: Rope.ROPE,
                           extensionRequired: BOOLEAN ← TRUE]
      RETURNS[name, switches: Rope.ROPE]; 

CheckExtendedFileName: PROC [name, switches, extensionName: Rope.ROPE,
                             extensionRequired: BOOLEAN ← TRUE]; 

IsSwitch: PROC [ch: CHARACTER, switches: Rope.ROPE] RETURNS[BOOLEAN]; 

END.