about summary refs log tree commit diff stats
path: root/dbm.lsp
blob: 52a0a27b6dee34702336fa4af28b5ed25f87915b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
;; No package, this is for eisl

(c-include "<ndbm.h>")

(defclass <dbm> () (db :accessor db))

(defgeneric clearerr (self))
(defmethod clearerr ((self <dbm>))
   (flet ((clearerr-h (db)
             (c-lang "dbm_clearerr(DB);")))
      (clearerr-h (db self))))

(defgeneric close (self))

(defgeneric delete (self key))

(defgeneric open (self openflags))
(defmethod open ((self <dbm>) file openflags)
   (flet ((open-h (file openflags)
             (c-lang "res = dbm_open(FILE, OPENFLAGS, MODE);")))
      (setf (db self) (open-h file openflags))))

(defgeneric create (self openflags modes))
(defmethod create ((self <dbm>) file openflags modes)
   (flet ((open-h (file openflags modes)
             (c-lang "res = dbm_open(FILE, OPENFLAGS, MODE);")))
      (setf (db self) (open-h file openflags modes))))