home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / MODULAV2GERMAN.DMS / in.adf / Def.zoo / FileNames.def < prev    next >
Encoding:
Modula Definition  |  1988-09-13  |  1.8 KB  |  58 lines

  1. (* $N- *)
  2. DEFINITION MODULE FileNames;
  3. (* 2.1 / 29.5.87 / ms *)
  4.  
  5. FROM SYSTEM IMPORT CAST;
  6.  
  7. TYPE
  8.  ReadProc=PROCEDURE(VAR CHAR);
  9.  WriteProc=PROCEDURE(CHAR);
  10.  
  11. CONST
  12.  noEcho=CAST(WriteProc,NIL);
  13. (*
  14.  * ReadFileName reads a filename using the supplied I/O routines.
  15.  * Read should not echo, Write should interpret <bs> and <del> as
  16.  * erasing the last character. len gives the number of characters
  17.  * in the filename. If the user hits <esc> the filename is returned
  18.  * empty with len=0. <cr> is ignored on an empty input else it
  19.  * terminates the string. All characters [" "..CHAR(del-1)] are
  20.  * accepted.
  21.  *
  22.  * ReadFileName(fname, len, Terminal.Read, Terminal.Write);
  23.  *    user: df1:exec/Alerts.sym<cr>
  24.  *    fname="df1:exec/sym/Alerts.sym"; len=23;
  25.  *)
  26. PROCEDURE ReadFileName(VAR fname: ARRAY OF CHAR; VAR len: INTEGER;
  27.                        readProc: ReadProc; writeProc: WriteProc);
  28. (*
  29.  * GetPath removes the path info in fname and stores it in path.
  30.  * len is asssumed to hold the lenght of fname and is set according
  31.  * the new length of fname.
  32.  *
  33.  * GetPath(fname, path, len);
  34.  *     fname="Alerts.sym"; len=10;
  35.  *    path ="df1:exec/sym/";
  36.  *)
  37. PROCEDURE GetPath(VAR fname, path: ARRAY OF CHAR; VAR len: INTEGER);
  38.  
  39. (*
  40.  * GetExtension works as GetPath except that it removes any extension
  41.  * from the filename. An extension is assumed to be separated by a
  42.  * dot.
  43.  *)
  44. PROCEDURE GetExtension(VAR fname, extension: ARRAY OF CHAR; VAR len: INTEGER);
  45.  
  46. (*
  47.  * MakeFileName is a simple concat of the four strings. It is useful to
  48.  * concat filenames.
  49.  *
  50.  * MakeFileName(fname, len, "df1:", "exec/sym/", "Alerts", ".sym")
  51.  *    fname="df1:exec/sym/Alerts.sym"; len=23;
  52.  *
  53.  *)
  54. PROCEDURE MakeFileName(VAR fname: ARRAY OF CHAR; VAR len: INTEGER;
  55.                        dev, dir, name, ext: ARRAY OF CHAR);
  56.  
  57. END FileNames.
  58.