From 8aa50feff3e82f3d217fe7ee897b7a030a72bc90 Mon Sep 17 00:00:00 2001 From: ian Date: Sun, 15 Jan 2006 15:06:21 +0000 Subject: [PATCH] settling on interface to cdb binding --- cdb/Makefile | 9 +++++ cdb/cdb.tct | 102 ++++++++++++++++----------------------------------- 2 files changed, 41 insertions(+), 70 deletions(-) create mode 100644 cdb/Makefile diff --git a/cdb/Makefile b/cdb/Makefile new file mode 100644 index 0000000..9c1f665 --- /dev/null +++ b/cdb/Makefile @@ -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 + diff --git a/cdb/cdb.tct b/cdb/cdb.tct index 9bb1fe4..cfb93ba 100644 --- a/cdb/cdb.tct +++ b/cdb/cdb.tct @@ -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 ...: - # on_info - # # files: - # .main + # .main # .cdb - # .log + # .log # .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 ...: + # on_info open-clean + # on_info open-dirty + # on_info compact-start + # on_info compact-end + # on_info close 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) -- 2.30.2