Debian Codegraph @

demos/ocaml/dbm.cocci

raw
1 @initialize:ocaml@
2 @@
3
4 let filename = "/tmp/pgtest"
5 let db = Dbm.opendbm
6 filename
7 [Dbm.Dbm_rdwr;Dbm.Dbm_create]
8 600
9
10 let _ = Printf.eprintf "Applies to %s\n" (Coccilib.dir ())
11
12 @r@
13 identifier f;
14 expression x,a;
15 @@
16
17 f(x,a)
18
19 @script:ocaml@
20 f << r.f;
21 y << r.x;
22 yy << r.a;
23 @@
24
25 Dbm.add db y yy;
26 if Str.string_match (Str.regexp "^foo") f 0
27 then Printf.eprintf "Fct '%s' matches \"^foo\"\n" f
28 else Printf.eprintf "Fct '%s' does not match \"^foo\"\n" f
29
30 @finalize:ocaml@
31 @@
32
33 Dbm.iter (fun key data -> Printf.printf "'%s' goes with '%s'\n" key data) db;
34 Dbm.close db;
35 Sys.remove (filename^".dir");
36 Sys.remove (filename^".pag")