Branch: Tag:

1996-05-13

1996-05-13 20:37:23 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

new module

Rev: src/modules/gdbmmod/.cvsignore:1.1
Rev: src/modules/gdbmmod/Makefile.src:1.1
Rev: src/modules/gdbmmod/configure.in:1.1
Rev: src/modules/gdbmmod/doc/gdbm:1.1
Rev: src/modules/gdbmmod/gdbm_machine.h.in:1.1
Rev: src/modules/gdbmmod/gdbmmod.c:1.1

1937:   <r><c> a + b </c><c> summation </c></r>   <r><c> a - b </c><c> subtraction </c></r>   <r><c> a * b </c><c> multiplication </c></r> - <r><c> a / b </c><c> integer division </c></r> + <r><c> a / b </c><c> division </c></r>   <r><c> a % b </c><c> modulo ( same thing as a - floor( a / b ) * b ) </c></r>   <r><c> - a </c><c> negation </c></r>   <r><c> a == b </c><c> return 1 if a is equal to b, 0 otherwise </c></r>
3508:      <group><example/><text>   <tt><p><matrix> - <r><c> "foobar"[0..3] </c><c> returns "foo" </c></r> - <r><c> "foobar"[4..6] </c><c> returns "bar" </c></r> - <r><c> ({1,2,3})[..2] </c><c> returns ({1,2}) </c></r> - <r><c> ({1,2,3})[2..] </c><c> returns ({2,3}) </c></r> + <r><c> "foobar"[0..2] </c><c> returns "foo" </c></r> + <r><c> "foobar"[3..5] </c><c> returns "bar" </c></r> + <r><c> ({1,2,3})[..1] </c><c> returns ({1,2}) </c></r> + <r><c> ({1,2,3})[1..] </c><c> returns ({2,3}) </c></r>   <r><c> ({1,2,3})[..] </c><c> returns ({1,2,3}) </c></r>   </matrix>   </p>
5397:   </doc>   </docgroup>   </class> + <class name='/precompiled/gdbm'> + <doc placeholder='true'> + <text> + <p><tt>/precompiled/gdbm</tt> - database interface</p> +  + <p>This is the an interface to the gdbm library. This module might or + might not be available in your uLPC depending on weather gdbm was + available when uLPC was compiled. + </p> + <p>A gdbm database has essentially the same functionality as a mapping, + except the syntax is different, and it is located on disk, not in + memory. Each gdbm database is one file which contains a set of + key-value pairs. Both keys and values are strings and all keys are + unique. + </p> + <p/> + </text> +  + </doc> + <docgroup homogen-name='close' homogen-type='method'> + <method name='close'> + </method> + <doc placeholder='true'> + <text> + <p><tt>close</tt> - close database</p> +  + <tt><p>void gdbm-&gt;close();<br/> + </p> + </tt> + <p>This closes the database. + </p> + <p/> + </text> +  + </doc> + </docgroup> + <docgroup homogen-name='create' homogen-type='method'> + <method name='create'> + </method> + <doc placeholder='true'> + <text> + <p><tt>create</tt> - open database</p> +  + <tt><p>int gdbm-&gt;create();<br/> + or<br/> + int gdbm-&gt;create(string <i>file</i>);<br/> + or<br/> + int gdbm-&gt;create(string <i>file</i>, string <i>mode</i>);<br/> + </p> + </tt> + <p>Without arguments, this function does nothing. With one argument it + opens the given file as a gdbm database, if this fails for some + reason, an error will be generated. If a second argument is present, + it specifies how to open the database using one or more of the follow + flags in a string: + </p> + <p><matrix> + <r><c> r </c><c> open database for reading </c></r> + <r><c> w </c><c> open database for writing </c></r> + <r><c> c </c><c> create database if it does not exist </c></r> + <r><c> t </c><c> overwrite existing database </c></r> + <r><c> f </c><c> fast mode </c></r> + </matrix> +  + </p> + <p>The fast mode prevents the database from syncronizing each change + in the database immediately. This is dangerous because the database + can be left in an unusable state if uLPC is terminated abnormally. + </p> + <p>The default mode is "rwc".</p> + </text> +  + <group><note/><text> + <p>The gdbm manual states that it is important that the database is + closed properly. Unfortunately this will not be the case if uLPC + calls exit() or returns from main(). You should therefore make sure + you call close or destruct your gdbm objects when exiting your + program. This will probably be done automatically in the future. + </p> + <p/> + </text></group> +  + </doc> + </docgroup> + <docgroup homogen-name='delete' homogen-type='method'> + <method name='delete'> + </method> + <doc placeholder='true'> + <text> + <p><tt>delete</tt> - delete a value from the database</p> +  + <tt><p>int gdbm-&gt;delete(string <i>key</i>);<br/> + </p> + </tt> + <p>Remove a key from the database. Note that no error will be generated + if the key does not exist. + </p> + <p/> + </text> +  + </doc> + </docgroup> + <docgroup homogen-name='fetch' homogen-type='method'> + <method name='fetch'> + </method> + <doc placeholder='true'> + <text> + <p><tt>fetch</tt> - fetch a value from the databse</p> +  + <tt><p>string gdbm-&gt;fetch(string <i>key</i>);<br/> + </p> + </tt> + <p>Return the data associated with the key 'key' in the database. + If there was no such key in the database, zero is returned. + </p> + <p/> + </text> +  + </doc> + </docgroup> + <docgroup homogen-name='firstkey' homogen-type='method'> + <method name='firstkey'> + </method> + <doc placeholder='true'> + <text> + <p><tt>firstkey</tt> - get first key in database</p> +  + <tt><p>string gdbm-&gt;firstkey();<br/> + </p> + </tt> + <p>Return the first key in the database, this can be any key in the + database. + </p> + <p/> + </text> +  + </doc> + </docgroup> + <docgroup homogen-name='nextkey' homogen-type='method'> + <method name='nextkey'> + </method> + <doc placeholder='true'> + <text> + <p><tt>nextkey</tt> - get next key in database</p> +  + <tt><p>string gdbm-&gt;nextkey(string <i>key</i>);<br/> + </p> + </tt> + <p>This returns the key in database that follows the key 'key' key. + This is of course used to iterate over all keys in the database.</p> + </text> +  + <group><example/><text> + <tt><p>/* Write the contents of the database */<br/> + for(key=gdbm-&gt;firstkey(); k; k=gdbm-&gt;nextkey(k))<br/> + <dl><group><text>write(k+":"+gdbm-&gt;fetch(k)+"\n");<br/> + </text></group></dl> + </p> + <p><br/> + </p> + </tt></text></group> +  + </doc> + </docgroup> + <docgroup homogen-name='reorganize' homogen-type='method'> + <method name='reorganize'> + </method> + <doc placeholder='true'> + <text> + <p><tt>reorganize</tt> - reorganize database</p> +  + <tt><p>int gdbm-&gt;reorganize();<br/> + </p> + </tt> + <p>Deletions and insertions into the database can cause fragmentation + which will make the database bigger. This routine reorganizes the + contents to get rid of fragmentation. Note however that this function + can take a LOT of time to run. + </p> + <p/> + </text> +  + </doc> + </docgroup> + <docgroup homogen-name='store' homogen-type='method'> + <method name='store'> + </method> + <doc placeholder='true'> + <text> + <p><tt>store</tt> - store a value in the database</p> +  + <tt><p>int gdbm-&gt;store(string <i>key</i>, string <i>data</i>);<br/> + </p> + </tt> + <p>Associate the contents of 'data' with the key 'key'. If the key 'key' + already exists in the database the data for that key will be replaced. + If it does not exist it will be added. An error will be generated if + the database was not open for writing. + </p> + <p/> + </text> +  + </doc> + </docgroup> + <docgroup homogen-name='sync' homogen-type='method'> + <method name='sync'> + </method> + <doc placeholder='true'> + <text> + <p><tt>sync</tt> - synchronize database</p> +  + <tt><p>void gdbm-&gt;sync();<br/> + </p> + </tt> + <p>When opening the database with the 'f' flag writings to the database + can be cached in memory for a long time. Calling sync will write + all such caches to disk and not return until + </p> + <p/> + </text> +  + </doc> + </docgroup> + </class>   <class name='/precompiled/port'>   <doc placeholder='true'>   <text>