Parent: [c7c9f5] (diff)

Child: [8d1c2d] (diff)

Download this file

ArgAccess.def    91 lines (73 with data), 5.2 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
DEFINITION MODULE ArgAccess;
(*------------------------------------------------------------------------*)
(* Zugriff auf Kommandozeilenargumente und die Programmumgebung *)
(* Access to command line arguments and programm environment *)
(*------------------------------------------------------------------------*)
(* Implementation : Michael Riedl *)
(* Licence : GNU Lesser General Public License (LGPL) *)
(*------------------------------------------------------------------------*)
(* $Id: ArgAccess.def,v 1.2 2018/06/07 06:56:50 mriedl Exp mriedl $ *)
(*------------------------------------------------------------------------*)
(* ArgTable can be used when a called "C" routine expects something like *)
(* argvec *)
(*------------------------------------------------------------------------*)
CONST ArgL = 255; (* MAX(SHORTCARD); *)
TYPE ArgTable = POINTER TO ARRAY [0..ArgL] OF
POINTER TO ARRAY [0..ArgL] OF CHAR;
PROCEDURE GetArgCount () : CARDINAL;
(*----------------------------------------------------------------*)
(* Ermittelt die Anzahl der "Ubergebenen Argumente beim *)
(* Programmaufruf. *)
(* *)
(* Get the number of command line arguments at program call *)
(*----------------------------------------------------------------*)
PROCEDURE GetArgument ( ArgNum : CARDINAL;
VAR Argument : ARRAY OF CHAR);
(*----------------------------------------------------------------*)
(* Ermittelt das ArgNum-te Argumente beim Programmaufruf, *)
(* GetArgument(0,Argument) gibt in Argument den Programmnamen *)
(* zur�ck. Ist ArgNum ausserhalb des zul"assigen Bereichs wird *)
(* 0C in Argument[0] zur"ckgegeben. *)
(* *)
(* Get the n-th command line argument (GetArgument(0,Argument) *)
(* will return the name of the program. If ArgNum is out of range *)
(* 0C will be returnd in Argument[0] *)
(*----------------------------------------------------------------*)
PROCEDURE FindEnvStr( SuchStr : ARRAY OF CHAR;
VAR EnvStr : ARRAY OF CHAR);
(*----------------------------------------------------------------*)
(* Sucht in der Tabelle der Umgebungsvariablen die Umgebungs- *)
(* variable SuchStr und gibt in EnvStr die entsprechende Zuweis- *)
(* ung zur�ck. Wird SuchStr nicht gefunden, wird in EnvStr[0] 0C *)
(* zur"uckgegeben (Leere Zeichenkette). *)
(* *)
(* Looks in the table of environment variables the variable with *)
(* name "SuchStr" and will, if found, retrun its value in EnvStr *)
(* If SuchStr is not found the routine will return 0C in *)
(* EnvStr[0] *)
(*----------------------------------------------------------------*)
PROCEDURE RdIntFromArgList( iarg : CARDINAL;
VAR i : INTEGER;
VAR ok : BOOLEAN);
(*----------------------------------------------------------------*)
(* Liesst das Kommandozeilenargument "iarg" als Ganzzahl i ein. *)
(* Im Fehlerfall wird ok auf falsch gesetzt und i mit *)
(* MAX(INTEGER) belegt. *)
(* *)
(* Tries to read command line argument "iarg" as interger i. *)
(* In case of an error ok will be set to false and i will be set *)
(* MAX(INTEGER). *)
(*----------------------------------------------------------------*)
PROCEDURE RdRealFromArgList( iarg : CARDINAL;
VAR x : LONGREAL;
VAR ok : BOOLEAN);
(*----------------------------------------------------------------*)
(* Liesst das Kommandozeilenargument "iarg" als Fliesskommazahl x *)
(* ein. Im Fehlerfall wird ok auf falsch gesetzt und x mit *)
(* MAX(LONGREAL) belegt. *)
(* *)
(* Tries to read command line argument "iarg" as real value x. *)
(* In case of an error ok will be set to false and x will be set *)
(* to MAX(LONGREAL). *)
(*----------------------------------------------------------------*)
END ArgAccess.