chiark / gitweb /
writeable wip
[chiark-tcl.git] / cdb / cdb.tct
1 Table *cdbtoplevel TopLevel_Command
2         cdb
3                 subcmd  enum(Cdb/_SubCommand, "cdb subcommand")
4                 ...     obj
5         cdb-wr
6                 subcmd  enum(Cdbwr/_SubCommand, "cdb-wr subcommand")
7                 ...     obj
8
9 Table cdb Cdb_SubCommand
10         open
11                 path    string
12                 =>      iddata(&cdbtcl_databases)
13         lookup
14                 db      iddata(&cdbtcl_databases)
15                 key     obj
16                 =>      obj
17         lookup-hb
18                 db      iddata(&cdbtcl_databases)
19                 key     hb
20                 =>      hb
21         close
22                 db      iddata(&cdbtcl_databases)
23
24 Table cdbwr Cdbwr_SubCommand
25         create-empty -1
26                 pathb   string
27                 # files:
28                 #       <pathb>.main
29                 #       <pathb>.lock
30                 #       <pathb>.cdb
31                 #       <pathb>.log
32                 #       <pathb>.tmp (might be new .main or new .cdb)
33                 # invariants:
34                 #       .lock is an empty file
35                 #         which is locked with fcntl by open
36                 #       .main is a cdb native text file
37                 #         and always exists
38                 #       if .tmp exists it is irrelevant
39                 #       if .cdb exists it is a cdb database
40                 #         containing exactly the same as .main
41                 #       if .log exists, it is a cdb native
42                 #         text file _without the trailing newline_;
43                 #         its contents override values from .main or .cdb
44         open -1
45                 pathb   string
46                 on_info obj
47                 =>      iddata(&cdbtcl_rwdatabases)
48                 # on_info <event> <xinfo>...:
49                 # on_info open-clean <statistics-info-string>
50                 # on_info open-dirty <statistics-info-string>
51                 # on_info compact-start <statistics-info-string>
52                 # on_info compact-end <statistics-info-string>
53                 # on_info close <statistics-info-string>
54         lookup 1
55                 db      iddata(&cdbtcl_rwdatabases)
56                 key     obj
57                 =>      obj
58         lookup-hb 1
59                 db      iddata(&cdbtcl_rwdatabases)
60                 key     hb
61                 =>      hb
62         update 0
63                 db      iddata(&cdbtcl_rwdatabases)
64                 key     obj
65                 value   obj
66         update-hb 0
67                 db      iddata(&cdbtcl_rwdatabases)
68                 key     hb
69                 value   hb
70         update-quick 1
71                 db      iddata(&cdbtcl_rwdatabases)
72                 key     obj
73                 value   obj
74         update-quick-hb 1
75                 db      iddata(&cdbtcl_rwdatabases)
76                 key     hb
77                 value   hb
78         close 0
79                 db      iddata(&cdbtcl_rwdatabases)
80         close-quick 1
81                 db      iddata(&cdbtcl_rwdatabases)
82
83 EntryExtra Cdbwr_SubCommand
84         int quick;