-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpplib.inc
More file actions
34 lines (30 loc) · 852 Bytes
/
pplib.inc
File metadata and controls
34 lines (30 loc) · 852 Bytes
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
{ pplib.inc -- interface routines for picoProlog }
{ argc -- return number of arguments, counting the program name }
function argc: integer;
begin
argc := ParamCount+1
end;
{ argv -- fetch |i|'th argument; program name is number 0 }
procedure argv(i: integer; var arg: tempstring);
var j, k: integer; temp: string;
begin
temp := ParamStr(i);
k := length(temp);
for j := 1 to k do arg[j] := temp[j];
arg[k+1] := chr(0)
end;
{ openin -- open input file, return true if successful }
function openin(var f: text; var name: tempstring): boolean;
var j, k: integer; temp: string;
begin
k := StringLength(name);
temp := '';
for j := 1 to k do temp := temp + name[j];
{$I-} assign(f, temp); reset(f); {$I-} {%ASSIGN%}
openin := IOresult = 0
end;
{ closein -- close input file }
procedure closein(var f: text);
begin
close(f)
end;