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