git » nmdb » commit a07262c

Update newlisp bindings to reflect TCP support and API changes.

author Alberto Bertogli
2007-06-01 16:50:52 UTC
committer Alberto Bertogli
2007-06-01 16:50:52 UTC
parent 65cd6fd63ee088723ceacdb3f86d3a8516922d84

Update newlisp bindings to reflect TCP support and API changes.

Signed-off-by: Alberto Bertogli <albertito@gmail.com>

bindings/newlisp/nmdb.lsp +13 -8
bindings/newlisp/test.lsp +5 -4

diff --git a/bindings/newlisp/nmdb.lsp b/bindings/newlisp/nmdb.lsp
index ba61413..a139780 100644
--- a/bindings/newlisp/nmdb.lsp
+++ b/bindings/newlisp/nmdb.lsp
@@ -5,9 +5,10 @@
 ;
 ; Functions:
 ;
-;   (nmdb:init port) -> Connects with the DB at the given port.
-;   (nmdb:add-server port) -> Adds a new server to the connection.
-;   (nmdb:free ) -> Closes the connection.
+;   (nmdb:init) -> Creates a new database object.
+;   (nmdb:add-tipc-server port) -> Adds a new TIPC server to the database.
+;   (nmdb:add-tcp-server addr port) -> Adds a new TCP server to the database.
+;   (nmdb:free) -> Closes the database.
 ;
 ;   (nmdb:db-get key) -> Gets the value associated to the given key, or -1.
 ;   (nmdb:cache-get key) -> Like dbget but only get from the cache.
@@ -23,8 +24,8 @@
 ;
 ; Example:
 ;   (load "nmdb.lsp")
-;   (nmdb:init 10)
-;   (nmdb:add-server 11)
+;   (nmdb:init)
+;   (nmdb:add-tipc-server 10)
 ;   (nmdb:db-set "Hello" "Newlisp!")
 ;   (nmdb:db-get "Hello")
 ;   (nmdb:db-del "Hello")
@@ -40,7 +41,8 @@
 (set 'libnmdb "libnmdb.so")
 
 (import libnmdb "nmdb_init")
-(import libnmdb "nmdb_add_server")
+(import libnmdb "nmdb_add_tipc_server")
+(import libnmdb "nmdb_add_tcp_server")
 (import libnmdb "nmdb_free")
 
 (import libnmdb "nmdb_set")
@@ -65,8 +67,11 @@
   (if (= NMDB 0) (set NMDB nil))
   (not (= NMDB nil)))
 
-(define (add-server port)
-  (nmdb_add_server NMDB port))
+(define (add-tipc-server port)
+  (nmdb_add_tipc_server NMDB port))
+
+(define (add-tcp-server addr port)
+  (nmdb_add_tcp_server NMDB addr port))
 
 (define (free)
   (nmdb_free NMDB))
diff --git a/bindings/newlisp/test.lsp b/bindings/newlisp/test.lsp
index 0fb90a2..2139674 100644
--- a/bindings/newlisp/test.lsp
+++ b/bindings/newlisp/test.lsp
@@ -3,10 +3,11 @@
 
 (load "nmdb.lsp")
 
-(println "init\t\t"		(nmdb:init 10))
-;(println "add-server\t"		(nmdb:add-server 11))
-;(println "add-server\t"		(nmdb:add-server 12))
-;(println "add-server\t"		(nmdb:add-server 13))
+(println "init\t\t"		(nmdb:init))
+(println "add-tipc-server\t"	(nmdb:add-tipc-server 10))
+;(println "add-tipc-server\t"	(nmdb:add-tipc-server 11))
+;(println "add-tipc-server\t"	(nmdb:add-tipc-server 12))
+;(println "add-tcp-server\t"	(nmdb:add-tcp-server "127.0.0.1" -1))
 (println)
 (println "db-set D1 V1\t"	(nmdb:db-set "D1" "D1"))
 (println "sync-set S2 V2\t"	(nmdb:sync-set "S2" "V2"))