]> gitweb.factorcode.org Git - factor.git/commitdiff
gdbm: drop "gdbm-" prefix
authorDmitry Shubin <dmitry.sh@gmail.com>
Sun, 27 Jun 2010 22:17:11 +0000 (02:17 +0400)
committerDmitry Shubin <dmitry.sh@gmail.com>
Sun, 27 Jun 2010 22:17:11 +0000 (02:17 +0400)
extra/gdbm/gdbm-docs.factor
extra/gdbm/gdbm-tests.factor
extra/gdbm/gdbm.factor

index 80735145f293a90ed5f939651b1854fa29a958b6..e712da3c99b4de1b15a4c3f714c2ff83a60ecd5a 100644 (file)
@@ -32,7 +32,7 @@ HELP: gdbm-info
 { $values { "str" string } }
 { $description "Returns version number and build date." } ;
 
-HELP: gdbm-delete
+HELP: delete
 { $values { "key" object } }
 { $description "Removes the keyed item from the database." } ;
 
@@ -40,69 +40,69 @@ HELP: gdbm-error-message
 { $values { "error" gdbm-error } { "msg" string } }
 { $description "Returns error message in human readable format." } ;
 
-HELP: gdbm-exists
+HELP: exists?
 { $values { "key" object } { "?" boolean } }
 { $description "Searches for a particular key without retreiving it." } ;
 
-HELP: gdbm-fdesc
+HELP: gdbm-file-descriptor
 { $values { "desc" integer } }
 { $description "Returns the file descriptor of the database. This is used for manual database locking if it was opened with " { $snippet "nolock" } " flag set to " { $link t } "." } ;
 
-HELP: gdbm-fetch
+HELP: fetch
 { $values
   { "key" object }
   { "content/f" { "the value associated with " { $snippet "key" } " or " { $link f } " if there is no such key" } }
 }
 { $description "Looks up a given key and returns value associated with it. This word makes no distinction between a missing value and a value set to " { $link f } "." } ;
 
-HELP: gdbm-fetch*
+HELP: fetch*
 { $values { "key" object } { "content" object } { "?" boolean } }
 { $description "Looks up a given key and returns value associated with it. The boolean flag can decide between the case of a missing value, and a value of " { $link f } "." } ;
 
-HELP: gdbm-first-key
+HELP: first-key
 { $values { "key/f" object } }
 { $description "Returns first key in the database. This word makes no distinction between an empty database case and a case of a first value set to " { $link f } "." } ;
 
-HELP: gdbm-first-key*
+HELP: first-key*
 { $values { "key" object } { "?" boolean } }
 { $description "Returns first key in the database. The boolean flag can decide between the case of an empty database and a case of a first value set to " { $link f } "." } ;
 
-HELP: gdbm-insert
+HELP: insert
 { $values { "key" object } { "content" object } }
 { $description "Inserts record into the database. Throws an error if the key already exists." } ;
 
-HELP: gdbm-next-key
+HELP: next-key
 { $values { "key" object } { "key/f" object } }
 { $description "Given a key returns next key in the database. This word makes no distinction between reaching the end of the database case and a case of a next value set to " { $link f } "." } ;
 
-HELP: gdbm-next-key*
+HELP: next-key*
 { $values { "key" object } { "next-key" object } { "?" boolean } }
 { $description "Given a key returns next key in the database. The boolean flag can decide between the case of reaching the end of the database and a case of a next value set to " { $link f } "." } ;
 
-HELP: gdbm-reorganize
+HELP: reorganize
 { $description "Reorganisation is a process of shinking the space used by gdbm. This requires creating a new file and moving all elements from old gdbm file to new one." } ;
 
-HELP: gdbm-replace
+HELP: replace
 { $values { "key" object } { "content" object } }
 { $description "Inserts record into the database replacing old value with the new one if the key already exists." } ;
 
-HELP: gdbm-set-block-merging
+HELP: set-block-merging
 { $values { "?" boolean } }
 { $description "If set, this option causes adjacent free blocks to be merged. The default is " { $link f } "." } ;
 
-HELP: gdbm-set-block-pool
+HELP: set-block-pool
 { $values { "?" boolean } }
 { $description "If set, this option causes all subsequent free blocks to be placed in the global pool. The default is " { $link f } "."  } ;
 
-HELP: gdbm-set-cache-size
+HELP: set-cache-size
 { $values { "size" integer } }
 { $description "Sets the size of the internal bucket cache. The default value is 100. This option may only be set once." } ;
 
-HELP: gdbm-set-sync-mode
+HELP: set-sync-mode
 { $values { "?" boolean } }
 { $description "Turns on or off file system synchronization. The default is " { $link f } "." } ;
 
-HELP: gdbm-sync
+HELP: synchronize
 { $description "Performs database synchronization: make sure the disk version of the database has been completely updated." } ;
 
 HELP: with-gdbm
@@ -122,11 +122,11 @@ $nl
 "All interaction with gdbm database should be realized using special combinator which automates all work for database initialisation and cleanup. All initialisation options are passed to combinator with a database configuration object."
 { $subsections gdbm <gdbm> with-gdbm }
 "For actual record manipulation the following words are used:"
-{ $subsections gdbm-insert gdbm-exists gdbm-fetch gdbm-delete }
+{ $subsections insert exists? fetch delete }
 
 { $heading "Sequential access" }
 "It is possible to iterate through all records in the database with."
-{ $subsections gdbm-first-key gdbm-next-key }
+{ $subsections first-key next-key }
 "The order in which records are accessed has nothing to do with the order in which records have been stored. Note that these words can only be used in read-only algorithms since delete operation re-arranges the hash table."
 ;
 
index ab3cb912f6692b9c9298238b78a33d75882b55a4..373ae1c624fe114fc34a6cddeb80717961a1e1d1 100644 (file)
@@ -20,30 +20,30 @@ CLEANUP
     test.db reader >>role [ ] with-gdbm
 ] [ gdbm-file-open-error = ] must-fail-with
 
-[ f ] [ [ "foo" gdbm-exists ] with-test.db ] unit-test
+[ f ] [ [ "foo" exists? ] with-test.db ] unit-test
 
-[ ] [ [ "foo" 41 gdbm-insert ] with-test.db ] unit-test
+[ ] [ [ "foo" 41 insert ] with-test.db ] unit-test
 
 [
-    [ "foo" 42 gdbm-insert ] with-test.db
+    [ "foo" 42 insert ] with-test.db
 ] [ gdbm-cannot-replace = ] must-fail-with
 
 [ ]
 [
     [
-        "foo" 42 gdbm-replace
-        "bar" 43 gdbm-replace
-        "baz" 44 gdbm-replace
+        "foo" 42 replace
+        "bar" 43 replace
+        "baz" 44 replace
     ] with-test.db
 ] unit-test
 
-[ 42 t ] [ [ "foo" gdbm-fetch* ] with-test.db ] unit-test
+[ 42 t ] [ [ "foo" fetch* ] with-test.db ] unit-test
 
-[ f f ] [ [ "unknown" gdbm-fetch* ] with-test.db ] unit-test
+[ f f ] [ [ "unknown" fetch* ] with-test.db ] unit-test
 
 [
     [
-        300 gdbm-set-cache-size 300 gdbm-set-cache-size
+        300 set-cache-size 300 set-cache-size
     ] with-test.db
 ] [ gdbm-option-already-set = ] must-fail-with
 
@@ -51,8 +51,8 @@ CLEANUP
 [
     V{ }
     [
-        gdbm-first-key
-        [ gdbm-next-key* ] [ [ swap push ] 2keep ] do while drop
+        first-key
+        [ next-key* ] [ [ swap push ] 2keep ] do while drop
     ] with-test.db
     V{ "foo" "bar" "baz" } set=
 
@@ -60,7 +60,7 @@ CLEANUP
 
 [ f ]
 [
-    test.db newdb >>role [ "foo" gdbm-exists ] with-gdbm
+    test.db newdb >>role [ "foo" exists? ] with-gdbm
 ] unit-test
 
 
index 7993864643588218bc975c0f47ec5a47db161ff5..021fadd514c2c29a2741049f369cb93e57eada07 100644 (file)
@@ -71,42 +71,42 @@ PRIVATE>
 
 : gdbm-error-message ( error -- msg ) gdbm_strerror ;
 
-: gdbm-replace ( key content -- ) GDBM_REPLACE gdbm-store ;
-: gdbm-insert ( key content -- ) GDBM_INSERT gdbm-store ;
+: replace ( key content -- ) GDBM_REPLACE gdbm-store ;
+: insert ( key content -- ) GDBM_INSERT gdbm-store ;
 
-: gdbm-delete ( key -- )
+: delete ( key -- )
     [ dbf swap object>datum gdbm_delete check-error ]
     with-destructors ;
 
-: gdbm-fetch* ( key -- content ? )
+: fetch* ( key -- content ? )
     [ dbf swap object>datum gdbm_fetch datum>object* ]
     with-destructors ;
 
-: gdbm-first-key* ( -- key ? )
+: first-key* ( -- key ? )
     [ dbf gdbm_firstkey datum>object* ] with-destructors ;
 
-: gdbm-next-key* ( key -- next-key ? )
+: next-key* ( key -- next-key ? )
     [ dbf swap object>datum gdbm_nextkey datum>object* ]
     with-destructors ;
 
-: gdbm-fetch ( key -- content/f ) gdbm-fetch* drop ;
-: gdbm-first-key ( -- key/f ) gdbm-first-key* drop ;
-: gdbm-next-key ( key -- key/f ) gdbm-next-key* drop ;
+: fetch ( key -- content/f ) fetch* drop ;
+: first-key ( -- key/f ) first-key* drop ;
+: next-key ( key -- key/f ) next-key* drop ;
 
-: gdbm-reorganize ( -- ) dbf gdbm_reorganize check-error ;
+: reorganize ( -- ) dbf gdbm_reorganize check-error ;
 
-: gdbm-sync ( -- ) dbf gdbm_sync ;
+: synchronize ( -- ) dbf gdbm_sync ;
 
-: gdbm-exists ( key -- ? )
+: exists? ( key -- ? )
     [ dbf swap object>datum gdbm_exists c-bool> ]
     with-destructors ;
 
-: gdbm-set-cache-size ( size -- ) GDBM_CACHESIZE setopt ;
-: gdbm-set-sync-mode ( ? -- ) GDBM_SYNCMODE setopt ;
-: gdbm-set-block-pool ( ? -- ) GDBM_CENTFREE setopt ;
-: gdbm-set-block-merging ( ? -- ) GDBM_COALESCEBLKS setopt ;
+: set-cache-size ( size -- ) GDBM_CACHESIZE setopt ;
+: set-sync-mode ( ? -- ) GDBM_SYNCMODE setopt ;
+: set-block-pool ( ? -- ) GDBM_CENTFREE setopt ;
+: set-block-merging ( ? -- ) GDBM_COALESCEBLKS setopt ;
 
-: gdbm-fdesc ( -- desc ) dbf gdbm_fdesc ;
+: gdbm-file-descriptor ( -- desc ) dbf gdbm_fdesc ;
 
 : with-gdbm ( gdbm quot -- )
     [ gdbm-open &gdbm-close current-dbf set ] prepose curry