From 14d0341983c5f9832285b6b8e264078ca3cc9122 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Fri, 6 Sep 2013 16:55:50 -0700 Subject: [PATCH] gdbm: Update README. Fix test. Nomenclature. Add installation instructions from the previous commit message. Test with the newly built shim (not an installed shim). Call the Scheme code that interfaces to C "the wrapper", as in blowfish/README. --- src/gdbm/Makefile | 10 +++++----- src/gdbm/README | 26 +++++++++++++++++++------- src/gdbm/check.scm | 2 +- src/gdbm/compile.scm | 7 +++++-- src/gdbm/gdbm-adapter.c | 2 +- src/gdbm/gdbm-check.scm | 4 ++-- src/gdbm/gdbm.scm | 5 ++--- 7 files changed, 35 insertions(+), 21 deletions(-) diff --git a/src/gdbm/Makefile b/src/gdbm/Makefile index f5a855bda..f5fe3d3aa 100644 --- a/src/gdbm/Makefile +++ b/src/gdbm/Makefile @@ -23,16 +23,16 @@ MIT_SCHEME_EXE = mit-scheme EXE = '$(MIT_SCHEME_EXE)' --batch-mode -build: gdbm-shim.so +all: gdbm-shim.so echo '(load "compile")' | $(EXE) -check: +check: all echo '(load "check")' | $(EXE) -install: build +install: all echo '(install-shim "gdbm")' | $(EXE) -- *.com *.bci *.pkd make.scm -clean: +clean distclean maintainer-clean: rm -f gdbm-const.scm gdbm-const gdbm-const.c gdbm-shim.c rm -f gdbm-*.crf gdbm-*.fre gdbm-*.pkd rm -f *.o *.so *.bin *.ext *.com *.bci @@ -51,4 +51,4 @@ gdbm-shim.o: gdbm-shim.c gdbm-shim.h gdbm-shim.c: gdbm.cdecl gdbm-shim.h echo '(generate-shim "gdbm" "#include \"gdbm-shim.h\"")' | $(EXE) -.PHONY: build install clean \ No newline at end of file +.PHONY: all check install clean distclean maintainer-clean diff --git a/src/gdbm/README b/src/gdbm/README index bb998aa1c..b59f067f0 100644 --- a/src/gdbm/README +++ b/src/gdbm/README @@ -1,12 +1,24 @@ -The libgdbm wrapper. +The GDBM wrapper. -This wrapper is not part of the core build and can be built outside -the core build tree. There is no ./configure script yet. If you know -you have libgdbm installed, you should win with this command: +This is a drop-in replacement for the gdbm microcode module and +runtime/gdbm.scm. It is not part of the core build and can be built +outside the core build tree. There is no ./configure script yet. If +you know you have libgdbm installed, you should win with this command: - make build check install + make all check install The install target copies a shared library shim and compiled Scheme files into the system library path. You can override the default -command name "mit-scheme" (and system library path) by setting -MIT_SCHEME_EXE. +command name "mit-scheme" (and thus the system library path) by +setting MIT_SCHEME_EXE. + +To load via load-option, install the following in your optiondb.scm: + + (define-load-option 'GDBM2 (guarded-system-loader '(gdbm) "gdbm")) + +You will need to call it GDBM2 while GDBM refers to the original +microcode module. + +You will need to import the bindings you want to use. They are not +exported to the global environment because they would conflict with +the exports from (runtime gdbm). diff --git a/src/gdbm/check.scm b/src/gdbm/check.scm index 62d147a35..77bbd67a1 100644 --- a/src/gdbm/check.scm +++ b/src/gdbm/check.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- |# -;;;; Test the GDBM adapter. +;;;; Test the GDBM wrapper. (load "make") (with-system-library-directories diff --git a/src/gdbm/compile.scm b/src/gdbm/compile.scm index f675f5714..b94c01ac7 100644 --- a/src/gdbm/compile.scm +++ b/src/gdbm/compile.scm @@ -1,9 +1,12 @@ #| -*-Scheme-*- |# -;;;; Compile the GDBM adapter +;;;; Compile the GDBM wrapper. (fluid-let ((load/suppress-loading-message? #t)) (load-option 'CREF) (load-option 'FFI)) -(compile-system "gdbm" (directory-pathname (current-load-pathname))) \ No newline at end of file +(with-system-library-directories + '("./") + (lambda () + (compile-system "gdbm" (directory-pathname (current-load-pathname))))) \ No newline at end of file diff --git a/src/gdbm/gdbm-adapter.c b/src/gdbm/gdbm-adapter.c index d0c4c6822..333e1fc9c 100644 --- a/src/gdbm/gdbm-adapter.c +++ b/src/gdbm/gdbm-adapter.c @@ -24,7 +24,7 @@ USA. */ -/* Interface to the gdbm database library */ +/* Adapters for the GDBM database library. */ #include #include "gdbm-shim.h" diff --git a/src/gdbm/gdbm-check.scm b/src/gdbm/gdbm-check.scm index ddf029f8b..7b31c0375 100644 --- a/src/gdbm/gdbm-check.scm +++ b/src/gdbm/gdbm-check.scm @@ -24,10 +24,10 @@ USA. |# -;;;; Test the GDBM adapter. +;;;; Test the GDBM wrapper. (if (not (gdbm-available?)) - (warn "gdbm adapter not found") + (warn "gdbm wrapper not found") (let ((filename.db "gdbm-check.db")) (ignore-errors (lambda () (delete-file filename.db))) (let ((dbf (gdbm-open filename.db 0 GDBM_WRCREAT #o660))) diff --git a/src/gdbm/gdbm.scm b/src/gdbm/gdbm.scm index 6418c944e..a799b119f 100644 --- a/src/gdbm/gdbm.scm +++ b/src/gdbm/gdbm.scm @@ -24,11 +24,10 @@ USA. |# -;;;; gdbm Database Library Interface +;;;; GDBM wrapper ;;; package: (gdbm) -(declare (usual-integrations) - (integrate-external)) +(declare (usual-integrations)) (C-include "gdbm") -- 2.25.1