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
|
using "equivalence.iso"
@initialize:ocaml@
@@
// count the number of % characters in the format string
let fmtn(fmt,n) =
List.length (Str.split_delim (Str.regexp_string "%") fmt) = n + 1
# replace osip_debug/oslocal_debug with Debug() macros first
@@
expression E;
expression list args;
@@
(
-osip_debug
|
-oslocal_debug
)
+Debug
(
-E,
+LDAP_DEBUG_TRACE,
args );
// replace Debug( ..., arg1, arg2, 0 ) with Debug2( ..., arg1, arg2 )
@@
char[] fmt : script:ocaml() { fmtn(fmt,2) };
expression list[2] args;
expression E;
@@
-Debug
+Debug2
( E, _(fmt), args
-, 0
);
// replace Debug( ..., arg1, 0, 0 ) with Debug1()
@@
char[] fmt : script:ocaml() { fmtn(fmt,1) };
expression list[1] args;
expression E;
@@
-Debug
+Debug1
( E, _(fmt), args
-, 0, 0
);
// Zero-argument Debug() -> Debug0()
@@
expression E, S;
@@
-Debug
+Debug0
( E, S
-, 0, 0, 0
);
// everything else is a regular 3-argument debug macro, replace with Debug3()
@@
expression E, S;
expression list[3] args;
@@
-Debug
+Debug3
( E, S, args );
|