From 2fc1b5c4b4d167622dcbce55cb4e2581036523f3 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Wed, 17 May 2017 16:10:33 -0700 Subject: [PATCH] plugin READMEs: Suggest the new import procedures. --- src/blowfish/README | 33 ++++++++++++++++++++++----------- src/blowfish/blowfish.pkg | 4 ++-- src/blowfish/blowfish.scm | 17 +++++++++++++++++ src/gdbm/README | 33 ++++++++++++++++++++++----------- src/gdbm/gdbm.pkg | 2 ++ src/gdbm/gdbm.scm | 28 ++++++++++++++++++++++++++++ src/mcrypt/README | 36 +++++++++++++++++++++++------------- src/mcrypt/mcrypt.pkg | 2 ++ src/mcrypt/mcrypt.scm | 26 ++++++++++++++++++++++++++ src/md5/README | 32 +++++++++++++++++++++----------- src/md5/md5.pkg | 2 ++ src/md5/md5.scm | 10 ++++++++++ src/mhash/README | 36 +++++++++++++++++++++++------------- src/mhash/mhash.pkg | 2 ++ src/mhash/mhash.scm | 28 ++++++++++++++++++++++++++++ 15 files changed, 230 insertions(+), 61 deletions(-) diff --git a/src/blowfish/README b/src/blowfish/README index 3d283be3c..60186b802 100644 --- a/src/blowfish/README +++ b/src/blowfish/README @@ -1,17 +1,28 @@ -The BLOWFISH option. +The Blowfish option. -This is a drop-in replacement for the bfish microcode module and -runtime/blowfish.scm. It is not part of the core build and can be -built outside the core build tree in the customary way: +This plugin creates a (blowfish) package, a drop-in replacement for +the microcode module based (runtime blowfish) package. It is built in +the customary GNU way: ./configure [--with-openssl=directory]... make all check install -The install target copies a shared library shim and compiled Scheme -files into the system library path, and re-writes the optiondb.scm -found there. You can override the default command name "mit-scheme" -(and thus the system library path) by setting MIT_SCHEME_EXE. +To use: -To use: (load-option 'BLOWFISH) and import the bindings you want. -They are not exported to the global environment because they would -conflict with the exports from (runtime blowfish). + (load-option 'blowfish) + (import-blowfish) + +Import-blowfish will modify the REPL's current environment by adding +bindings linked to the plugin's exports. They are not exported to the +global environment because they would conflict with the exports from +(runtime blowfish). + +To import into a CREF package set, add this to your .pkg file: + + (global-definitions blowfish/) + + (define-package (your package name) + (parent (your package parent)) + (import (blowfish) + blowfish-set-key + ...)) diff --git a/src/blowfish/blowfish.pkg b/src/blowfish/blowfish.pkg index 12d8cb9f9..ea43a5647 100644 --- a/src/blowfish/blowfish.pkg +++ b/src/blowfish/blowfish.pkg @@ -29,8 +29,8 @@ USA. (define-package (blowfish) (files "blowfish") (parent ()) - ;; You'll have to import these from (global-definitions blowfish/). - ;; They are currently bound in () by exports from (runtime blowfish). + (export () + import-blowfish) (export (blowfish global) blowfish-cbc blowfish-cfb64 diff --git a/src/blowfish/blowfish.scm b/src/blowfish/blowfish.scm index ccd9b2ce3..cd5869dd6 100644 --- a/src/blowfish/blowfish.scm +++ b/src/blowfish/blowfish.scm @@ -29,6 +29,23 @@ USA. (declare (usual-integrations)) +(define (import-blowfish) + (let ((target-environment (nearest-repl/environment)) + (source-environment (->environment '(blowfish)))) + (for-each (lambda (name) + (link-variables target-environment name + source-environment name)) + '(blowfish-cbc + blowfish-cfb64 + blowfish-ecb + blowfish-encrypt-port + blowfish-file? + blowfish-ofb64 + blowfish-set-key + compute-blowfish-init-vector + read-blowfish-file-header + write-blowfish-file-header)))) + (C-include "blowfish") (define (blowfish-set-key bytes) diff --git a/src/gdbm/README b/src/gdbm/README index c7968df95..89c7aa238 100644 --- a/src/gdbm/README +++ b/src/gdbm/README @@ -1,17 +1,28 @@ -The GDBM option. +The GDBM2 option. -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 in the customary way: +This plugin creates a (gdbm) package, a drop-in replacement for the +microcode module based (runtime gdbm) package. It is built in the +customary GNU way: ./configure ... make all check install -The install target copies a shared library shim and compiled Scheme -files into the system library path and re-writes the optiondb.scm -found there. You can override the default command name "mit-scheme" -(and thus the system library path) by setting MIT_SCHEME_EXE. +To use: -To use: (load-option 'GDBM2) and import the bindings you want. They -are not exported to the global environment because they would conflict -with the exports from (runtime gdbm). + (load-option 'gdbm2) + (import-gdbm2) + +Import-gdbm2 will modify the REPL's current environment by adding +bindings linked to the plugin's exports. They are not exported to the +global environment because they would conflict with the exports from +(runtime gdbm). + +To import into a CREF package set, add this to your .pkg file: + + (global-definitions gdbm/) + + (define-package (your package name) + (parent (your package parent)) + (import (gdbm) + gdbm-open + ...)) diff --git a/src/gdbm/gdbm.pkg b/src/gdbm/gdbm.pkg index f862304ab..c3ab5dc09 100644 --- a/src/gdbm/gdbm.pkg +++ b/src/gdbm/gdbm.pkg @@ -34,6 +34,8 @@ USA. cp1-ref ustring-cp-size ustring?) + (export () + import-gdbm2) (export (gdbm global) gdbm-close gdbm-delete diff --git a/src/gdbm/gdbm.scm b/src/gdbm/gdbm.scm index 3f7a1e1ee..b337e47ff 100644 --- a/src/gdbm/gdbm.scm +++ b/src/gdbm/gdbm.scm @@ -29,6 +29,34 @@ USA. (declare (usual-integrations)) +(define (import-gdbm2) + (let ((target-environment (nearest-repl/environment)) + (source-environment (->environment '(gdbm)))) + (for-each (lambda (name) + (link-variables target-environment name + source-environment name)) + '(gdbm-close + gdbm-delete + gdbm-exists? + gdbm-fetch + gdbm-firstkey + gdbm-nextkey + gdbm-open + gdbm-reorganize + gdbm-setopt + gdbm-store + gdbm-sync + gdbm-version + gdbm_cachesize + gdbm_fast + ;;gdbm_fastmode obsolete + gdbm_insert + gdbm_newdb + gdbm_reader + gdbm_replace + gdbm_wrcreat + gdbm_writer)))) + (C-include "gdbm") (define-integrable (every-loop proc ref string start end) diff --git a/src/mcrypt/README b/src/mcrypt/README index 7a73aaf9a..99e3112f7 100644 --- a/src/mcrypt/README +++ b/src/mcrypt/README @@ -1,18 +1,28 @@ -The MCRYPT option. +The Mcrypt option. -This is a drop-in replacement for the mcrypt microcode module and the -mcrypt-* procedures in runtime/crypto.scm. It is not part of the core -build and can be built outside the core build tree in the customary -way: +This plugin creates an (mcrypt) package, a drop-in replacement for the +microcode module based mcrypt-* procedures in the (runtime crypto) +package. It is built in the customary GNU way: - ./configure + ./configure ... make all check install -The install target copies a shared library shim and compiled Scheme -files into the system library path and re-writes the optiondb.scm -found there. You can override the default command name "mit-scheme" -(and thus the system library path) by setting MIT_SCHEME_EXE. +To use: -To use: (load-option 'MCRYPT) and import the bindings you want. They -are not exported to the global environment because they would conflict -with the exports from (runtime crypto). + (load-option 'mcrypt) + (import-mcrypt) + +Import-mcrypt will modify the REPL's current environment by adding +bindings linked to the plugin's exports. They are not exported to the +global environment because they would conflict with the exports from +(runtime crypto). + +To import into a CREF package set, add this to your .pkg file: + + (global-definitions mcrypt/) + + (define-package (your package name) + (parent (your package parent)) + (import (mcrypt) + mcrypt-encrypt-port + ...)) diff --git a/src/mcrypt/mcrypt.pkg b/src/mcrypt/mcrypt.pkg index e3a5b9ebd..7f3ae5a8f 100644 --- a/src/mcrypt/mcrypt.pkg +++ b/src/mcrypt/mcrypt.pkg @@ -29,6 +29,8 @@ USA. (define-package (mcrypt) (files "mcrypt") (parent ()) + (export () + import-mcrypt) (export (mcrypt global) mcrypt-algorithm-name mcrypt-algorithm-names diff --git a/src/mcrypt/mcrypt.scm b/src/mcrypt/mcrypt.scm index a8b659286..b52411bd4 100644 --- a/src/mcrypt/mcrypt.scm +++ b/src/mcrypt/mcrypt.scm @@ -85,6 +85,32 @@ USA. ;;; alist that is periodically scanned for objects that were GCed and ;;; not freed. +(define (import-mcrypt) + (let ((target-environment (nearest-repl/environment)) + (source-environment (->environment '(mcrypt)))) + (for-each (lambda (name) + (link-variables target-environment name + source-environment name)) + '(mcrypt-algorithm-name + mcrypt-algorithm-names + mcrypt-block-algorithm-mode? + mcrypt-block-algorithm? + mcrypt-block-mode? + mcrypt-context? + mcrypt-decrypt! + mcrypt-encrypt + mcrypt-encrypt! + mcrypt-encrypt-port + mcrypt-end + mcrypt-init + mcrypt-init-vector-size + mcrypt-key-size + mcrypt-mode-name + mcrypt-mode-names + mcrypt-open-module + mcrypt-self-test + mcrypt-supported-key-sizes)))) + (C-include "mcrypt") (define mcrypt-initialized? #f) diff --git a/src/md5/README b/src/md5/README index d3a4fdda3..eb5da29a5 100644 --- a/src/md5/README +++ b/src/md5/README @@ -1,18 +1,28 @@ The MD5 option. -This is a drop-in replacement for the md5 microcode module and the -md5-* procedures in runtime/crypto.scm. It is not part of the core -build and can be built outside the core build tree in the customary -way: +This plugin creates an (md5) package, a drop-in replacement for the +microcode module based md5-* procedures in the (runtime crypto) +package. It is built in the customary GNU way: ./configure [--with-openssl=directory]... make all check install -The install target copies a shared library shim and compiled Scheme -files into the system library path, and re-writes the optiondb.scm -found there. You can override the default command name "mit-scheme" -(and thus the system library path) by setting MIT_SCHEME_EXE. +To use: -To use: (load-option 'MD5) and import the bindings you want. They are -not exported to the global environment because they would conflict -with the exports from (runtime crypto). + (load-option 'md5) + (import-md5) + +Import-md5 will modify the REPL's current environment by adding +bindings linked to the plugin's exports. They are not exported to the +global environment because they would conflict with the exports from +(runtime crypto). + +To import into a CREF package set, add this to your .pkg file: + + (global-definitions md5/) + + (define-package (your package name) + (parent (your package parent)) + (import (md5) + md5-file + ...)) diff --git a/src/md5/md5.pkg b/src/md5/md5.pkg index ece7a2878..de847317a 100644 --- a/src/md5/md5.pkg +++ b/src/md5/md5.pkg @@ -29,6 +29,8 @@ USA. (define-package (md5) (files "md5") (parent ()) + (export () + import-md5) (export (md5 global) md5-bytevector md5-file diff --git a/src/md5/md5.scm b/src/md5/md5.scm index abf60355c..416a2404e 100644 --- a/src/md5/md5.scm +++ b/src/md5/md5.scm @@ -29,6 +29,16 @@ USA. (declare (usual-integrations)) +(define (import-md5) + (let ((target-environment (nearest-repl/environment)) + (source-environment (->environment '(md5)))) + (for-each (lambda (name) + (link-variables target-environment name + source-environment name)) + '(md5-bytevector + md5-file + md5-string)))) + (C-include "md5") (define (%md5-init) diff --git a/src/mhash/README b/src/mhash/README index f83f43d52..ce97f35b8 100644 --- a/src/mhash/README +++ b/src/mhash/README @@ -1,18 +1,28 @@ -The MHASH option. +The Mhash option. -This is a drop-in replacement for the mhash microcode module and the -mhash-* procedures in runtime/crypto.scm. It is not part of the core -build and can be built outside the core build tree in the customary -way: +This plugin creates an (mhash) package, a drop-in replacement for the +microcode module based mhash-* procedures in the (runtime crypto) +package. It is built in the customary GNU way: - ./configure [--with-mhash=directory]... + ./configure ... make all check install -The install target copies a shared library shim and compiled Scheme -files into the system library path, and re-writes the optiondb.scm -found there. You can override the default command name "mit-scheme" -(and thus the system library path) by setting MIT_SCHEME_EXE. +To use: -To use: (load-option 'MHASH) and import the bindings you want. They -are not exported to the global environment because they would conflict -with the exports from (runtime crypto). + (load-option 'mhash) + (import-mhash) + +Import-mhash will modify the REPL's current environment by adding +bindings linked to the plugin's exports. They are not exported to the +global environment because they would conflict with the exports from +(runtime crypto). + +To import into a CREF package set, add this to your .pkg file: + + (global-definitions mhash/) + + (define-package (your package name) + (parent (your package parent)) + (import (mhash) + mhash-file + ...)) diff --git a/src/mhash/mhash.pkg b/src/mhash/mhash.pkg index 5264c21c9..617f7eb7c 100644 --- a/src/mhash/mhash.pkg +++ b/src/mhash/mhash.pkg @@ -29,6 +29,8 @@ USA. (define-package (mhash) (files "mhash") (parent ()) + (export () + import-mhash) (initialization (initialize-package!)) (export (mhash global) make-mhash-keygen-type diff --git a/src/mhash/mhash.scm b/src/mhash/mhash.scm index c618699a5..c086ceb1f 100644 --- a/src/mhash/mhash.scm +++ b/src/mhash/mhash.scm @@ -29,6 +29,34 @@ USA. (declare (usual-integrations)) +(define (import-mhash) + (let ((target-environment (nearest-repl/environment)) + (source-environment (->environment '(mhash)))) + (for-each (lambda (name) + (link-variables target-environment name + source-environment name)) + '(make-mhash-keygen-type + mhash-bytevector + mhash-context? + mhash-end + mhash-file + mhash-get-block-size + mhash-hmac-end + mhash-hmac-init + mhash-hmac-update + mhash-init + mhash-keygen + mhash-keygen-max-key-size + mhash-keygen-salt-size + mhash-keygen-type-names + mhash-keygen-type? + mhash-keygen-uses-count? + mhash-keygen-uses-hash-algorithm + mhash-keygen-uses-salt? + mhash-string + mhash-type-names + mhash-update)))) + (C-include "mhash") (define mhash-algorithm-names) -- 2.25.1