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