-
Notifications
You must be signed in to change notification settings - Fork 5
/
XDC_LOG.PAS
58 lines (46 loc) · 914 Bytes
/
XDC_LOG.PAS
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
unit xdc_log;
{provides debug logging. Currently writes to a file, but could later
be expanded to have a special debug window or something.}
interface
const
Logging:boolean=false;
procedure openLogging(s:string);
procedure stdout(s:string);
procedure logAtomic(s:string);
procedure stderr(s:string);
procedure closeLogging;
implementation
uses
xdc_globals;
var
logout:text;
procedure openLogging(s:string);
begin
assign(logout,s);
rewrite(logout);
Logging:=true;
end;
procedure logAtomic(s:string);
var
f:text;
begin
assign(f,'atomic.log');
rewrite(f);
writeln(f,s);
close(f);
end;
procedure stdout(s:string);
begin
if logging and (debug<>0) then writeln(logout,s);
{logatomic(s);}
end;
procedure stderr(s:string);
begin
if logging and (debug<>0) then writeln(logout,'*** '+s);
end;
procedure closeLogging;
begin
if logging then close(logout);
Logging:=false;
end;
end.