chiark / gitweb /
settling on interface to cdb binding
authorian <ian>
Sun, 15 Jan 2006 15:06:21 +0000 (15:06 +0000)
committerian <ian>
Sun, 15 Jan 2006 15:06:21 +0000 (15:06 +0000)
cdb/Makefile [new file with mode: 0644]
cdb/cdb.tct

diff --git a/cdb/Makefile b/cdb/Makefile
new file mode 100644 (file)
index 0000000..9c1f665
--- /dev/null
@@ -0,0 +1,9 @@
+BASE_DIR =     ../base
+EXTBASE =      cdb
+CFILES =       cdb
+OTHER_TCTS =   ../hbytes/hbytes-base.tct
+CPPFLAGS +=    -I../hbytes
+LDLIBS +=      ../hbytes/chiark_tcl_hbytes.so -ltinycdb
+
+include ../base/extension.make
+
index 9bb1fe4..cfb93ba 100644 (file)
@@ -3,7 +3,7 @@ Table cdbtoplevel TopLevel_Command
                subcmd  enum(Cdb/_SubCommand, "cdb subcommand")
                ...     obj
        cdb-wr
-               subcmd  enum(CdbWr/_SubCommand, "cdb-wr subcommand")
+               subcmd  enum(Cdbwr/_SubCommand, "cdb-wr subcommand")
                ...     obj
 
 Table cdb Cdb_SubCommand
@@ -12,8 +12,8 @@ Table cdb Cdb_SubCommand
                =>      iddata(&cdbtcl_databases)
        lookup
                db      iddata(&cdbtcl_databases)
-               key     obj
-               =>      obj
+               key     bytearray
+               =>      bytearray
        lookup-hb
                db      iddata(&cdbtcl_databases)
                key     hb
@@ -22,95 +22,57 @@ Table cdb Cdb_SubCommand
                db      iddata(&cdbtcl_databases)
 
 Table cdbwr CdbWr_SubCommand
-       open
+       create-empty
                pathb   string
-               on_info obj
-               =>      iddata(&cdbtcl_rwdatabases)
-               # on_info <event> <xinfo>...:
-               # on_info
-               #
                # files:
-               #       <pathdb>.main
+               #       <pathb>.main
                #       <pathb>.cdb
-               #       <pathdb>.log
+               #       <pathb>.log
                #       <pathb>.tmp (might be new .main or new .cdb)
                # invariants:
- fixme finish this
- also mention file format
- and whether cdb text format files are terminated
-               #       .main always exists
+               #       .main is a cdb native text file
+               #         and always exists
                #       if .tmp exists it is irrelevant
-               #       if .cdb exists it contains exactly the same
-               #          as .main
-               #       if .log exists, it _must_ be read and contents
-               #          override values from .main or .cdb
-       create-empty
+               #       if .cdb exists it is a cdb database
+               #         containing exactly the same as .main
+               #       if .log exists, it is a cdb native
+               #         text file _without the trailing newline_;
+               #         its contents override values from .main or .cdb
+       open
                pathb   string
+               on_info obj
+               =>      iddata(&cdbtcl_rwdatabases)
+               # on_info <event> <xinfo>...:
+               # on_info open-clean <statistics-info-string>
+               # on_info open-dirty <statistics-info-string>
+               # on_info compact-start <statistics-info-string>
+               # on_info compact-end <statistics-info-string>
+               # on_info close <statistics-info-string>
        lookup
                db      iddata(&cdbtcl_rwdatabases)
-               key     obj
-               =>      obj
+               key     bytearray
+               =>      bytearray
        lookup-hb
                db      iddata(&cdbtcl_rwdatabases)
                key     hb
                =>      hb
        update
                db      iddata(&cdbtcl_rwdatabases)
-               key     obj
-               value   obj
+               key     bytearray
+               value   bytearray
        update-hb
                db      iddata(&cdbtcl_rwdatabases)
                key     hb
                value   hb
        update-quick
                db      iddata(&cdbtcl_rwdatabases)
-               key     obj
-               value   obj
+               key     bytearray
+               value   bytearray
        update-quick-hb
                db      iddata(&cdbtcl_rwdatabases)
                key     hb
                value   hb
-
-       open-autolog
-               
-
-       lookup
-               rrtype  enum(CdbTclRRTypeInfo/, "rrtype")
-               domain  string
-               ...     obj
-               =>      obj
-       synch
-               rrtype  enum(CdbTclRRTypeInfo/, "rrtype")
-               domain  string
-               ...     obj
-               =>      obj
-       asynch
-               on_yes  obj
-               on_no   obj
-               on_fail obj
-               xargs   obj
-               rrtype  enum(CdbTclRRTypeInfo/, "rrtype")
-               domain  string
-               ...     obj
-               =>      iddata(&cdbtcl_queries)
-       asynch-cancel
-               query   iddata(&cdbtcl_queries)
-       new-resolver
-               ...     obj
-               =>      iddata(&cdbtcl_resolvers)
-       set-default-resolver
-               res     iddata(&cdbtcl_resolvers)
-       destroy-resolver
-               res     iddata(&cdbtcl_resolvers)
-
-
-
-Type cdbresults:               cdb_answer *@
-Init cdbresults                @=0;
-Fini cdbresults                free(@);
-
-Table cdbtoplevel TopLevel_Command
-       cdb
-               subcmd  enum(Cdb/_SubCommand, "cdb subcommand")
-               ...     obj
-
+       close
+               db      iddata(&cdbtcl_rwdatabases)
+       close-quick
+               db      iddata(&cdbtcl_rwdatabases)