| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- (* ========================================================= *)
- (* Preliminary library module for Gardens Point Modula *)
- (* ========================================================= *)
- (* !SYSTEM! *) DEFINITION MODULE ProgArgs;
- (* this is a system module; it is known to the compiler and *)
- (* activated by import. There is no explicit implementation. *)
- PROCEDURE ArgNumber() : CARDINAL;
- (* postcondition : returns number of arguments with UNIX *)
- (* conventions. Returns 1 if no args given *)
- PROCEDURE GetArg(num : CARDINAL; VAR arg : ARRAY OF CHAR);
- (* precondition : 0 <= num <= ArgNumber() - 1 *)
- (* postcondition : arg is a nul terminated string. ( ==> *)
- (* it is fast even if HIGH(arg) >> length) *)
- (* usage example: to simply print all the arguments --
- FOR ix := 0 TO ArgNumber() - 1 DO
- GetArg(ix,str); WriteString(str); WriteLn;
- END;
- *)
- PROCEDURE EnvironString(inStr : ARRAY OF CHAR;
- VAR outStr : ARRAY OF CHAR);
- (* precondition : HIGH(outStr) must be > than length of *)
- (* outString ... no checking is done. *)
- (* postcondition : outStr holds value of environ variable, *)
- (* or an empty string if inStr not defined *)
- PROCEDURE VersionTime(VAR outStr : ARRAY OF CHAR);
- (* precondition : HIGH(outStr) > 26 *)
- (* postcondition : outStr is a nul terminated string with *)
- (* the date and time at which the program *)
- (* was built. The string includes newline *)
- (* usage example: to print version time --
- WriteString("Program version of ");
- VersionTime(str);
- WriteString(str); (* no WriteLn needed *)
- *)
- PROCEDURE UNIXtime() : CARDINAL;
- (* returns time in seconds since 00:00:00, GMT Jan 1 1970 *)
- PROCEDURE UNIXexit(res : CARDINAL);
- (* exits program returning result code res to UNIX caller *)
- PROCEDURE Assert(expr : BOOLEAN);
- optString : ARRAY OF CHAR);
- (* If expr is FALSE, the program aborts with the message *)
- (* optString. The open array is optional, and if used *)
- (* replaces the module name message which is otherwise *)
- (* generated *)
- (* From the command line "gpm -a" suppresses assert tests *)
- END ProgArgs.
|