ÄuFNAME DEF¬‡FNAME MOD u³ÿ DEFINITION MODULE FNAME; (* useful routines for manipulation of filenames. Adapted from code by Charlie Foster byGlenn Brooke 12/29/86, released to the public domain. *) TYPE filename = ARRAY[0..13] OF CHAR; Extension = ARRAY[0..2] OF CHAR; PROCEDURE AppendExt(VAR DiskFileName : filename; Ext : Extension); (* appends the extension Ext to the filename DiskFileName *) PROCEDURE StripExt(VAR DiskFileName : filename); (* strips the period and following characters *) PROCEDURE GetExt(DiskFileName : filename;VAR Ext : Extension); (* returns the extension portion of the filename without removing it *) END FNAME. IMPLEMENTATION MODULE FNAME; (* useful routines for manipulation of filenames. By Glenn Brooke 12/29/86, released to the public domain. *) FROM strings IMPORT Length, Pos, Append, Copy, Delete; PROCEDURE AppendExt(VAR DiskFileName : filename; Ext : Extension); (* appends the extension Ext to the filename DiskFileName *) VAR LengthCount : CARDINAL; BEGIN LengthCount := Length(DiskFileName); DiskFileName[LengthCount] := "."; Append(Ext, DiskFileName); END AppendExt; PROCEDURE StripExt(VAR DiskFileName : filename); (* strips the period and following characters *) VAR WherePeriod : CARDINAL; BEGIN WherePeriod := Pos(".", DiskFileName); Delete(DiskFileName, WherePeriod, Length(DiskFileName)-WherePeriod); END StripExt; PROCEDURE GetExt(DiskFileName : filename;VAR Ext : Extension); (* returns the extension portion of the filename without removing it *) VAR WherePeriod, ExtLength : CARDINAL; BEGIN WherePeriod := Pos(".", DiskFileName); ExtLength := HIGH(DiskFileName) - WherePeriod; Copy(DiskFileName, WherePeriod+1, ExtLength, Ext); END GetExt; END FNAME.