Commit a31965f5 authored by -urso-'s avatar -urso-

documentation and exmaples update

darcs-hash:9d6928a257aecdbbb8c9a6d57faee06965f79807
parent d381d88e
...@@ -17,10 +17,12 @@ ...@@ -17,10 +17,12 @@
<h3>Example Usage (Secondary Databases)</h3> <h3>Example Usage (Secondary Databases)</h3>
<p>WARNING: this 'native' kind of using secondary databases with Berkeley DB is very C-centric, thus for <p>WARNING: this 'native' kind of using secondary databases with Berkeley DB is very C-centric, thus for
every callback function you create, cffi will create one and those functions and associated data (when using closures for example) every callback function you create, cffi will create one and those functions and associated data (when using closures for example)
will not being garbage collected, even if databases were closed. Thus if you use alot of secondary databases, there will be will not being garbage collected, even if databases were closed. Thus if you use alot of secondary databases, there may be
a lot of garbage being produced over time... a lot of garbage being produced over time...<br>
Using transactional databases, C-Style callbacks are not used anymore and you must not be "afraid" about anything...
</p> </p>
<pre> <pre>
CL-USER&gt; (asdf:oos 'asdf:load-op :bdb-playground) CL-USER&gt; (asdf:oos 'asdf:load-op :bdb-playground)
NIL NIL
CL-USER&gt; (in-package :bdb-playground) CL-USER&gt; (in-package :bdb-playground)
...@@ -30,10 +32,10 @@ BDB-PLAYGROUND&gt; (defun first-callback (sdb key data) ...@@ -30,10 +32,10 @@ BDB-PLAYGROUND&gt; (defun first-callback (sdb key data)
FIRST-CALLBACK FIRST-CALLBACK
BDB-PLAYGROUND&gt; (setq *callback* (create-assoc-callback #'first-callback)) BDB-PLAYGROUND&gt; (setq *callback* (create-assoc-callback #'first-callback))
#.(SB-SYS:INT-SAP #X050006F8) #.(SB-SYS:INT-SAP #X050006F8)
BDB-PLAYGROUND&gt; (setq *db* (db-open "test.db" :create t)) BDB-PLAYGROUND&gt; (setq *db* (db-open "test.db" :create t :exclusive t))
#.(SB-SYS:INT-SAP #X08197120) #&lt;DB-STD {A866C31}&gt;
BDB-PLAYGROUND&gt; (setq *sdb* (db-open "sec.db" :create t :dup-sort t)) BDB-PLAYGROUND&gt; (setq *sdb* (db-open "sec.db" :create t :exclusive t :dup-sort t))
#.(SB-SYS:INT-SAP #X081995A0) #&lt;DB-STD {A9DEB49}&gt;
BDB-PLAYGROUND&gt; (db-associate *db* *sdb* *callback*) BDB-PLAYGROUND&gt; (db-associate *db* *sdb* *callback*)
T T
BDB-PLAYGROUND&gt; (db-put *db* 1 '(max mustermann)) BDB-PLAYGROUND&gt; (db-put *db* 1 '(max mustermann))
...@@ -43,7 +45,7 @@ T ...@@ -43,7 +45,7 @@ T
BDB-PLAYGROUND&gt; (db-put *db* 3 '(micky maus)) BDB-PLAYGROUND&gt; (db-put *db* 3 '(micky maus))
T T
BDB-PLAYGROUND&gt; (setq *cursor* (db-cursor *db*)) BDB-PLAYGROUND&gt; (setq *cursor* (db-cursor *db*))
#.(SB-SYS:INT-SAP #X0819CF28) #&lt;BDB::CURSOR {B350ED1}&gt;
BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t) BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t)
1 1
(MAX MUSTERMANN) (MAX MUSTERMANN)
...@@ -57,9 +59,9 @@ BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t) ...@@ -57,9 +59,9 @@ BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t)
NIL NIL
NIL NIL
BDB-PLAYGROUND&gt; (db-cursor-close *cursor*) BDB-PLAYGROUND&gt; (db-cursor-close *cursor*)
T NIL
BDB-PLAYGROUND&gt; (setq *cursor* (db-cursor *sdb*)) BDB-PLAYGROUND&gt; (setq *cursor* (db-cursor *sdb*))
#.(SB-SYS:INT-SAP #X0819BB28) #&lt;BDB::CURSOR {B4CF249}&gt;
BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t) BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t)
KATER KATER
(KATER KARLO) (KATER KARLO)
...@@ -72,8 +74,15 @@ MAX ...@@ -72,8 +74,15 @@ MAX
BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t) BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t)
NIL NIL
NIL NIL
BDB-PLAYGROUND&gt; (db-cursor-close *cursor*)
NIL
BDB-PLAYGROUND&gt; (db-close *sdb*)
NIL
BDB-PLAYGROUND&gt; (db-close *db*)
NIL
BDB-PLAYGROUND&gt; ;;bye bye BDB-PLAYGROUND&gt; ;;bye bye
</pre> </pre>
<p> </p>
<div class="footer"> <div class="footer">
<a href="mailto:-urso-@web.de">Email</a> <a href="mailto:-urso-@web.de">Email</a>
......
...@@ -20,85 +20,84 @@ CL-USER&gt; (asdf:oos 'asdf:load-op :bdb-playground) ...@@ -20,85 +20,84 @@ CL-USER&gt; (asdf:oos 'asdf:load-op :bdb-playground)
NIL NIL
CL-USER&gt; (in-package :bdb-playground) CL-USER&gt; (in-package :bdb-playground)
#&lt;PACKAGE "BDB-PLAYGROUND"&gt; #&lt;PACKAGE "BDB-PLAYGROUND"&gt;
BDB-PLAYGROUND&gt; (setq *db* (db-open "test-db.db" :create t :exclusive t)) BDB-PLAYGROUND&gt; (setq *db* (db-open "test.db" :create t :exclusive t))
#.(SB-SYS:INT-SAP #X08197120) #&lt;DB-STD {AB8B471}&gt;
BDB-PLAYGROUND&gt; (db-put *db* "key1" "data1") BDB-PLAYGROUND&gt; (db-put *db* 'key1 "data1")
T T
BDB-PLAYGROUND&gt; (db-put *db* "key2" "data2") BDB-PLAYGROUND&gt; (db-put *db* 'key2 "data2")
T T
BDB-PLAYGROUND&gt; (db-put *db* "key3" "data3") BDB-PLAYGROUND&gt; (db-put *db* 'key3 "data3")
T T
BDB-PLAYGROUND&gt; (db-put *db* "key4" "data4") BDB-PLAYGROUND&gt; (db-put *db* 'key4 "data4")
T T
BDB-PLAYGROUND&gt; (db-get *db* "key2") BDB-PLAYGROUND&gt; (db-get *db* 'key2)
"data2" "data2"
BDB-PLAYGROUND&gt; (db-get *db* "key4") BDB-PLAYGROUND&gt; (db-get *db* 'key4)
"data4" "data4"
BDB-PLAYGROUND&gt; (db-get *db* "key1012") BDB-PLAYGROUND&gt; (db-get *db* 'key1022)
NIL NIL
BDB-PLAYGROUND&gt; (db-get *db* "key1012" :not-found t) BDB-PLAYGROUND&gt; (db-get *db* 'key1022 :not-found t))
; Evaluation aborted | comment: used debugger to abort, cause of exception... ; Evaluation aborted | comment: used debugger to abort, cause of exception...
BDB-PLAYGROUND&gt; (db-get *db* "key1012" :not-found (lambda () "uhoh")) BDB-PLAYGROUND&gt; (db-get *db* 'key1022 :not-found (lambda () 'uhoh))
"uhoh" UHOH
BDB-PLAYGROUND&gt; (setq *cursor* (db-cursor *db*)) BDB-PLAYGROUND&gt; (setq *cursor* (db-cursor *db*))
#.(SB-SYS:INT-SAP #X08198338) #&lt;BDB::CURSOR {B97D641}&gt;
BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t) BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t)
"key1" KEY1
"data1" "data1"
BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t) BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t)
"key2" KEY2
"data2" "data2"
BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t) BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t)
"key3" KEY3
"data3" "data3"
BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t) BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t)
"key4" KEY4
"data4" "data4"
BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t) BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t)
NIL NIL
NIL NIL
BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :first t) BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :first t)
"key1" KEY1
"data1" "data1"
BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :key "key3" :set t) BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :key 'key3 :set t)
"key3" KEY3
"data3" "data3"
BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t) BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t)
"key4" KEY4
"data4" "data4"
BDB-PLAYGROUND&gt; (db-cursor-count *cursor*) ;;number of duplicates BDB-PLAYGROUND&gt; (db-cursor-count *cursor*) ;;number of duplicates
1 1
BDB-PLAYGROUND&gt; (db-cursor-close *cursor*) BDB-PLAYGROUND&gt; (db-cursor-close *cursor*)
T NIL
BDB-PLAYGROUND&gt; (db-close *db*) BDB-PLAYGROUND&gt; (db-close *db*)
T NIL
BDB-PLAYGROUND&gt; (setq *db* (db-open "test-db.db")) BDB-PLAYGROUND&gt; (setq *db* (db-open "test.db"))
#.(SB-SYS:INT-SAP #X08197120) #&lt;DB-STD {A7EB5E9}&gt;
BDB-PLAYGROUND&gt; (setq *cursor* (db-cursor *db*)) BDB-PLAYGROUND&gt; (setq *cursor* (db-cursor *db*))
#.(SB-SYS:INT-SAP #X081982F0) #&lt;BDB::CURSOR {A81DD71}&gt;
BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t) BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t)
"key1" KEY1
"data1" "data1"
BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t) BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t)
"key2" KEY2
"data2" "data2"
BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t) BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t)
"key3" KEY3
"data3" "data3"
BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t) BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t)
"key4" KEY4
"data4" "data4"
BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t) BDB-PLAYGROUND&gt; (db-cursor-get *cursor* :next t)
NIL NIL
NIL NIL
BDB-PLAYGROUND&gt; (db-cursor-close *cursor*) BDB-PLAYGROUND&gt; (db-cursor-close *cursor*)
T NIL
BDB-PLAYGROUND&gt; (db-close *db*) BDB-PLAYGROUND&gt; (db-close *db*)
T NIL
BDB-PLAYGROUND&gt; ;;thats it...
; No value
BDB-PLAYGROUND&gt; BDB-PLAYGROUND&gt;
</pre> </pre>
<p> </p>
<div class="footer"> <div class="footer">
<a href="mailto:-urso-@web.de">Email</a> <a href="mailto:-urso-@web.de">Email</a>
...@@ -109,4 +108,3 @@ BDB-PLAYGROUND&gt; ...@@ -109,4 +108,3 @@ BDB-PLAYGROUND&gt;
</div> </div>
</body> </body>
</html> </html>
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>BDB</title>
<link rel="stylesheet" type="text/css" href="../style.css"/>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
</head>
<body>
<div class="header">
<h1>BDB</h1>
<h2>Berkeley DB CFFI bindings</h2>
</div>
<h3>Example Usage (Transactions)</h3>
<pre>
CL-USER&gt; (asdf:oos 'asdf:load-op :bdb-playground)
NIL
CL-USER&gt; (in-package :bdb-playground)
#&lt;PACKAGE "BDB-PLAYGROUND"&gt;
BDB-PLAYGROUND&gt; (setq *env* (db-env-open "/home/main/tdb" :init-txn t :init-log t :init-lock t :init-mpool t :create t))
#&lt;DB-ENV {B7A4221}&gt;
BDB-PLAYGROUND&gt; (setq *db* (db-open "test.db" :env *env* :auto-commit t :create t))
#&lt;DB-TXN {B8042D1}&gt;
BDB-PLAYGROUND&gt; (with-txn (txn *env*)
(db-put *db* 1 "data1" :txn txn)
(db-put *db* 2 "data2" :txn txn))
T
BDB-PLAYGROUND&gt; (db-get *db* 1)
"data1"
BDB-PLAYGROUND&gt; (db-get *db* 2)
"data2"
BDB-PLAYGROUND&gt; (db-get *db* 3)
NIL
BDB-PLAYGROUND&gt; (with-txn (txn *env*)
(db-put *db* 3 "data3" :txn txn)
(db-put *db* 4 "data4" :txn txn)
(error "ohoh, abort transaction"))
BDB-PLAYGROUND&gt; (db-get *db* 1)
"data1"
BDB-PLAYGROUND&gt; (db-get *db* 2)
"data2"
BDB-PLAYGROUND&gt; (db-get *db* 3)
NIL
BDB-PLAYGROUND&gt; (db-get *db* 4)
NIL
BDB-PLAYGROUND&gt; (db-del *db* 1)
; Evaluation aborted | comment: if you want to delete an entry, you must use a txn
BDB-PLAYGROUND&gt; (with-txn (txn *env*)
(db-del *db* 1 :txn txn))
T
BDB-PLAYGROUND&gt; (db-get *db* 1)
NIL
BDB-PLAYGROUND&gt; (db-get *db* 2)
"data2"
BDB-PLAYGROUND&gt; (db-get *db* 3)
NIL
BDB-PLAYGROUND&gt; (db-get *db* 4)
NIL
BDB-PLAYGROUND&gt; (db-close *db*)
T
BDB-PLAYGROUND&gt; (db-env-close *env*)
NIL
BDB-PLAYGROUND&gt; ;; bye bye
</pre>
<p> </p>
<div class="footer">
<a href="mailto:-urso-@web.de">Email</a>
</div>
<div class="check">
<a href="http://validator.w3.org/check/referer"> Valid XHTML 1.0 Strict</a>
</div>
</body>
</html>
...@@ -146,6 +146,7 @@ ...@@ -146,6 +146,7 @@
<ol> <ol>
<li><a href="examples/simple.html">Simple db Example</a></li> <li><a href="examples/simple.html">Simple db Example</a></li>
<li><a href="examples/secondary.html">Secondary Databases</a></li> <li><a href="examples/secondary.html">Secondary Databases</a></li>
<li><a href="examples/txn.html">Transactions</a></li>
</ol> </ol>
<h3>Mailing Lists</h3> <h3>Mailing Lists</h3>
......
...@@ -24,8 +24,7 @@ ...@@ -24,8 +24,7 @@
> | <a href="index.html" > | <a href="index.html"
>toc</a >toc</a
></div ></div
><p> (to be used by this library only) ><p><p> (to be used by this library only) </p>
<pre class="code" <pre class="code"
><span class="first-line"><span class="paren">(</span>defcfun &quot;strlen&quot; :int</span><span class"body"> ><span class="first-line"><span class="paren">(</span>defcfun &quot;strlen&quot; :int</span><span class"body">
<span class="paren">(</span>str :pointer<span class="paren">)</span><span class="paren">)</span></span></pre <span class="paren">(</span>str :pointer<span class="paren">)</span><span class="paren">)</span></span></pre
......
<html
><head
><title
>Berkley DB CFFI-Bindings</title
><link href="style.css" rel="stylesheet"
/><link title="Print" href="print.css" rel="alternate stylesheet"
/></head
><body
><div class="qbook"
><h1 class="title"
>Berkley DB CFFI-Bindings</h1
><div class="contents"
><h2
><a name="Secondary_0020Databases"
>Secondary Databases</a
>&nbsp;</h2
><div class="nav-links"
><a class="nav-link" href="Logging.html"
>prev</a
> | <span class="dead-nav-link"
>up</span
> | <a href="Utilities.html"
>next</a
> | <a href="index.html"
>toc</a
></div
><p>
Notes:
the C library handles secondaries like this:
db_create: - will create environment, if none specified and
add to db pointer
db_put/__db_put: - create cursor with write-lock
- use __db_c_put on cursor to insert data
__db_c_put: - uses private flag DB_UPDATE_SECONDARY to do puts on
secondary databases
- use __db_s_first and __db_s_next for iterating over
secondaries, they will take care of thread-locking
- in first loop add new keys:
- call callback to get secondary key
- open cursor on secondary with transaction and
lock id of primary database
- use __db_c_put with DB_UPDATE_SECONDARY flag
to insert data into secondary
- close cursor
- in second loop remove old secondary indicies:
- get old secondary key
- if secondary key needs to be deleted than:
- get cursor
- use get to move cursor to position
- delete entry
- update primary database now
perl/tcl/python/ruby libs weren't much more helpfull :(
for the lisp library:
- when opening a database it depends on the environment,
wether we'll use the C-based (using db-associate-ll)
implementation or a transaction based if transactions
are supported by environment.
Todo so, db-open returns different kind of classes:
- db-std ;; standard db-class, if txn not allowed
- db-txn ;; if environment supports transactions
- db-associate needs different implementations for db-std
and db-txn:
- db-std:
- use the old low level method
- use defcallback and go on
- no changes to db-put
- db-txn:
- add callback function and secondary to table
in database
- when closing secondary, remove from table
- don't use defcallback, use lambda directly
- overwrite db-put:
- create an transaction
- add data to primary
- in a loop, add keys to secondaries
<pre class="code"
><span class="first-line"><span class="paren">(</span>defcstruct DBT ;;tried to avoid using DBT directly... :'<span class="paren">(</span></span><span class"body">
<span class="paren">(</span>data :pointer<span class="paren">)</span>
<span class="paren">(</span>size :uint32<span class="paren">)</span>
<span class="paren">(</span>ulen :uint32<span class="paren">)</span>
<span class="paren">(</span>dlen :uint32<span class="paren">)</span>
<span class="paren">(</span>doff :uint32<span class="paren">)</span>
<span class="paren">(</span>flags :uint32<span class="paren">)</span><span class="paren">)</span></span></pre
>
<div class="computational-element-link computational-element-link-function"
><p
><a href="api/function_005FBDB_003A_003ACREATE-DB-ASSOC-CALLBACK.html" name="function_005FBDB_003A_003ACREATE-DB-ASSOC-CALLBACK"
>Function CREATE-DB-ASSOC-CALLBACK</a
> </p
></div
>
<div class="computational-element-link computational-element-link-function"
><p
><a href="api/function_005FBDB_003A_003ACREATE-CBUFFERED-DB-ASSOC-CALLBACK.html" name="function_005FBDB_003A_003ACREATE-CBUFFERED-DB-ASSOC-CALLBACK"
>Function CREATE-CBUFFERED-DB-ASSOC-CALLBACK</a
> </p
></div
>
<div class="computational-element-link computational-element-link-function"
><p
><a href="api/function_005FBDB_003A_003ABUILD-ASSOC-CALLBACK-MAKER.html" name="function_005FBDB_003A_003ABUILD-ASSOC-CALLBACK-MAKER"
>Function BUILD-ASSOC-CALLBACK-MAKER</a
> </p
></div
>
<div class="computational-element-link computational-element-link-function"
><p
><a href="api/function_005FBDB_003A_003ABUILD-CBUFFERED-ASSOC-LAMBDA.html" name="function_005FBDB_003A_003ABUILD-CBUFFERED-ASSOC-LAMBDA"
>Function BUILD-CBUFFERED-ASSOC-LAMBDA</a
> </p
></div
>
<div class="computational-element-link computational-element-link-method"
><p
><a href="api/method_005FBDB_003A_003A_0028DB-ASSOCIATE_0020DB-STD_0020DB_0020T_0029.html" name="method_005FBDB_003A_003A_0028DB-ASSOCIATE_0020DB-STD_0020DB_0020T_0029"
>Method (DB-ASSOCIATE DB-STD DB T)</a
> </p
></div
>
<div class="computational-element-link computational-element-link-method"
><p
><a href="api/method_005FBDB_003A_003A_0028DB-ASSOCIATE_0020DB-TXN_0020DB-TXN_0020T_0029.html" name="method_005FBDB_003A_003A_0028DB-ASSOCIATE_0020DB-TXN_0020DB-TXN_0020T_0029"
>Method (DB-ASSOCIATE DB-TXN DB-TXN T)</a
> </p
></div
>
<div class="computational-element-link computational-element-link-method"
><p
><a href="api/method_005FBDB_003A_003A_0028DB-DISASSOCIATE_0020DB-TXN_0020DB-TXN_0029.html" name="method_005FBDB_003A_003A_0028DB-DISASSOCIATE_0020DB-TXN_0020DB-TXN_0029"
>Method (DB-DISASSOCIATE DB-TXN DB-TXN)</a
> </p
></div
>
<div class="computational-element-link computational-element-link-method"
><p
><a href="api/method_005FBDB_003A_003A_0028DB-JOIN_0020DB_0020T_0029.html" name="method_005FBDB_003A_003A_0028DB-JOIN_0020DB_0020T_0029"
>Method (DB-JOIN DB T)</a
> </p
></div
>
</div
></div
></body
></html
>
\ No newline at end of file
...@@ -14,13 +14,7 @@ ...@@ -14,13 +14,7 @@
><h2 ><h2
>Documentation</h2 >Documentation</h2
><blockquote ><blockquote
>creates and opens a new Database ><p>creates and opens a new Database <br>&nbsp;&nbsp;&nbsp;params: env = Environment the database shall be opened in txn = Transaction db = Database in File (optional) mode = file mode, use create-umask or 0 for default type = :db-btree :db-hash :db-recno or :db-queue flags... see BDB documentation or db.h </p></blockquote
params: env = Environment the database shall be opened in
txn = Transaction
db = Database in File (optional)
mode = file mode, use create-umask or 0 for default
type = :db-btree :db-hash :db-recno or :db-queue
flags... see BDB documentation or db.h</blockquote
><h2 ><h2
>Source</h2 >Source</h2
><pre class="code" ><pre class="code"
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
><h2 ><h2
>Documentation</h2 >Documentation</h2
><blockquote ><blockquote
>callback returns a cbuffer, which will be freed by this put function</blockquote ><p>callback returns a cbuffer, which will be freed by this put function </p></blockquote
><h2 ><h2
>Source</h2 >Source</h2
><pre class="code" ><pre class="code"
......
...@@ -26,33 +26,15 @@ ...@@ -26,33 +26,15 @@
></div ></div
> >
<pre class="code" <pre class="code"
><span class="first-line"><span class="paren">(</span>eval-when <span class="paren">(</span>:compile-toplevel :load-toplevel :execute<span class="paren">)</span></span><span class"body"> ><span class="first-line"><p><span class="paren">(</span>eval-when <span class="paren">(</span>:compile-toplevel :load-toplevel :execute<span class="paren">)</span> <br>&nbsp;&nbsp;<span class="paren">(</span>unless <span class="paren">(</span>find-package :cffi-util-system<span class="paren">)</span> <span class="paren">(</span>defpackage :cffi-util-system <span class="paren">(</span>:use :common-lisp :asdf<span class="paren">)</span><span class="paren">)</span><span class="paren">)</span><span class="paren">)</span> </p></span><span class"body"></span></pre
<span class="paren">(</span>unless <span class="paren">(</span>find-package :cffi-util-system<span class="paren">)</span>
<span class="paren">(</span>defpackage :cffi-util-system
<span class="paren">(</span>:use :common-lisp :asdf<span class="paren">)</span><span class="paren">)</span><span class="paren">)</span><span class="paren">)</span></span></pre
> >
<pre class="code" <pre class="code"
><span class="first-line"><span class="paren">(</span>in-package :cffi-util-system<span class="paren">)</span></span><span class"body"></span></pre ><span class="first-line"><p><span class="paren">(</span>in-package :cffi-util-system<span class="paren">)</span> </p></span><span class"body"></span></pre
> >
<pre class="code" <pre class="code"
><span class="first-line"><span class="paren">(</span>defsystem :cffi-util</span><span class"body"> ><span class="first-line"><p><span class="paren">(</span>defsystem :cffi-util <br>&nbsp;&nbsp;:description "some utilities" <br>&nbsp;&nbsp;:author "" <br>&nbsp;&nbsp;:version "0.0,0" <br>&nbsp;&nbsp;:components <br>&nbsp;&nbsp;<span class="paren">(</span><span class="paren">(</span>:module :src :components <span class="paren">(</span><span class="paren">(</span>:file "packages"<span class="paren">)</span> <span class="paren">(</span>:file "flags" :depends-on <span class="paren">(</span>"packages"<span class="paren">)</span><span class="paren">)</span> <span class="paren">(</span>:file "defcfun" :depends-on <span class="paren">(</span>"packages" "flags"<span class="paren">)</span><span class="paren">)</span> <span class="paren">(</span>:file "cbuffer" :depends-on <span class="paren">(</span>"packages"<span class="paren">)</span><span class="paren">)</span> <span class="paren">(</span>:file "cbuffer-streams" :depends-on <span class="paren">(</span>"cbuffer"<span class="paren">)</span><span class="paren">)</span><span class="paren">)</span><span class="paren">)</span><span class="paren">)</span> <br>&nbsp;&nbsp;:depends-on <span class="paren">(</span>:cffi :mycl-util :trivial-gray-streams :flexi-streams<span class="paren">)</span><span class="paren">)</span> </p></span><span class"body"></span></pre
:description &quot;some utilities&quot;
:author &quot;&quot;
:version &quot;0.0,0&quot;
:components
<span class="paren">(</span><span class="paren">(</span>:module :src
:components <span class="paren">(</span><span class="paren">(</span>:file &quot;packages&quot;<span class="paren">)</span>
<span class="paren">(</span>:file &quot;flags&quot;
:depends-on <span class="paren">(</span>&quot;packages&quot;<span class="paren">)</span><span class="paren">)</span>
<span class="paren">(</span>:file &quot;defcfun&quot;
:depends-on <span class="paren">(</span>&quot;packages&quot; &quot;flags&quot;<span class="paren">)</span><span class="paren">)</span>
<span class="paren">(</span>:file &quot;cbuffer&quot;
:depends-on <span class="paren">(</span>&quot;packages&quot;<span class="paren">)</span><span class="paren">)</span>
<span class="paren">(</span>:file &quot;cbuffer-streams&quot;
:depends-on <span class="paren">(</span>&quot;cbuffer&quot;<span class="paren">)</span><span class="paren">)</span><span class="paren">)</span><span class="paren">)</span><span class="paren">)</span>
:depends-on <span class="paren">(</span>:cffi :mycl-util :trivial-gray-streams :flexi-streams<span class="paren">)</span><span class="paren">)</span></span></pre
> >
</div </div
......
...@@ -26,10 +26,7 @@ ...@@ -26,10 +26,7 @@
></div ></div
> >
<pre class="code" <pre class="code"
><span class="first-line"><span class="paren">(</span>defstruct cbuffer</span><span class"body"> ><span class="first-line"><p><span class="paren">(</span>defstruct cbuffer <br>&nbsp;&nbsp;<span class="paren">(</span>data <span class="paren">(</span>foreign-alloc :uchar :count 16<span class="paren">)</span><span class="paren">)</span> <br>&nbsp;&nbsp;<span class="paren">(</span>size 0<span class="paren">)</span> <br>&nbsp;&nbsp;<span class="paren">(</span>length 16<span class="paren">)</span><span class="paren">)</span> </p></span><span class"body"></span></pre
<span class="paren">(</span>data <span class="paren">(</span>foreign-alloc :uchar :count 16<span class="paren">)</span><span class="paren">)</span>
<span class="paren">(</span>size 0<span class="paren">)</span>
<span class="paren">(</span>length 16<span class="paren">)</span><span class="paren">)</span></span></pre
> >
...@@ -90,11 +87,7 @@ ...@@ -90,11 +87,7 @@
> >
<pre class="code" <pre class="code"
><span class="first-line"><span class="paren">(</span>defcfun &quot;memcpy&quot;</span><span class"body"> ><span class="first-line"><p><span class="paren">(</span>defcfun "memcpy" :pointer <br>&nbsp;&nbsp;<span class="paren">(</span>dest :pointer<span class="paren">)</span> <br>&nbsp;&nbsp;<span class="paren">(</span>src :pointer<span class="paren">)</span> <br>&nbsp;&nbsp;<span class="paren">(</span>length :int<span class="paren">)</span><span class="paren">)</span> </p></span><span class"body"></span></pre
:pointer
<span class="paren">(</span>dest :pointer<span class="paren">)</span>
<span class="paren">(</span>src :pointer<span class="paren">)</span>
<span class="paren">(</span>length :int<span class="paren">)</span><span class="paren">)</span></span></pre
> >
<div class="computational-element-link computational-element-link-function" <div class="computational-element-link computational-element-link-function"
......
...@@ -42,9 +42,7 @@ ...@@ -42,9 +42,7 @@
> >
<pre class="code" <pre class="code"
><span class="first-line"><span class="paren">(</span>def-construct flag-system</span><span class"body"> ><span class="first-line"><p><span class="paren">(</span>def-construct flag-system parent <br>&nbsp;&nbsp;<span class="paren">(</span>flags <span class="paren">(</span>make-hash-table<span class="paren">)</span><span class="paren">)</span><span class="paren">)</span> </p></span><span class"body"></span></pre
parent
<span class="paren">(</span>flags <span class="paren">(</span>make-hash-table<span class="paren">)</span><span class="paren">)</span><span class="paren">)</span></span></pre
> >
<div class="computational-element-link computational-element-link-function" <div class="computational-element-link computational-element-link-function"
......
...@@ -26,66 +26,7 @@ ...@@ -26,66 +26,7 @@
></div ></div
> >
<pre class="code" <pre class="code"
><span class="first-line"><span class="paren">(</span>defpackage :cffi-util</span><span class"body"> ><span class="first-line"><p><span class="paren">(</span>defpackage :cffi-util <br>&nbsp;&nbsp;<span class="paren">(</span>:use :cl :cffi :mycl-util :trivial-gray-streams :flexi-streams<span class="paren">)</span> <br>&nbsp;&nbsp;<span class="paren">(</span>:export <br>&nbsp;&nbsp;&nbsp;;;flag-system <br>&nbsp;&nbsp;&nbsp;#:<em>current-flag-system</em> <br>&nbsp;&nbsp;&nbsp;#:make-flag-system #:flag-system-parent <br>&nbsp;&nbsp;&nbsp;#:find-flag-system <br>&nbsp;&nbsp;&nbsp;#:delete-flag-system <br>&nbsp;&nbsp;&nbsp;#:clear-flag-systems <br>&nbsp;&nbsp;&nbsp;#:use-flagsystem <br>&nbsp;&nbsp;&nbsp;#:def-flag-system <br>&nbsp;&nbsp;&nbsp;#:with-flag-system <br>&nbsp;&nbsp;&nbsp;#:direct-flag-value <br>&nbsp;&nbsp;&nbsp;#:flag-value <br>&nbsp;&nbsp;&nbsp;#:clear-flags <br>&nbsp;&nbsp;&nbsp;#:concat-flags <br>&nbsp;&nbsp;&nbsp;#:flags <br>&nbsp;&nbsp;&nbsp;#:def-flag <br>&nbsp;&nbsp;&nbsp;#:def-flag* <br>&nbsp;&nbsp;&nbsp;#:has-flag <br>&nbsp;&nbsp;&nbsp;#:flag-list </p><p> ;;helpers <br>&nbsp;&nbsp;&nbsp;#:defcfun* <br>&nbsp;&nbsp;&nbsp;#:defmethod* </p><p> ;;cbuffer <br>&nbsp;&nbsp;&nbsp;#:make-cbuffer <br>&nbsp;&nbsp;&nbsp;#:make-cbuffer-from-pointer <br>&nbsp;&nbsp;&nbsp;#:cbuffer-p <br>&nbsp;&nbsp;&nbsp;#:cbuffer-data <br>&nbsp;&nbsp;&nbsp;#:cbuffer-size <br>&nbsp;&nbsp;&nbsp;#:cbuffer-length </p><p> #:<em>use-cbuffer-pool</em> <br>&nbsp;&nbsp;&nbsp;#:<em>cbuffer-pool-max-size</em> <br>&nbsp;&nbsp;&nbsp;#:<em>cbuffer-pool-min-buffer-size</em> <br>&nbsp;&nbsp;&nbsp;#:<em>cbuffer-pool-max-buffer-size</em> <br>&nbsp;&nbsp;&nbsp;#:make-cbuffer-pool <br>&nbsp;&nbsp;&nbsp;#:<em>cbuffer-pool</em> <br>&nbsp;&nbsp;&nbsp;#:clear-cbuffer-pool <br>&nbsp;&nbsp;&nbsp;#:alloc-cbuffer <br>&nbsp;&nbsp;&nbsp;#:free-cbuffer </p><p> #:cbuffer-resize <br>&nbsp;&nbsp;&nbsp;#:cbuffer-eob-p <br>&nbsp;&nbsp;&nbsp;#:cbuffer-ensure-size <br>&nbsp;&nbsp;&nbsp;#:cbuffer-adjust-min-size <br>&nbsp;&nbsp;&nbsp;#:with-cbuffer </p><p> #:cbuffer-checkbounds <br>&nbsp;&nbsp;&nbsp;#:cbuffer-byte <br>&nbsp;&nbsp;&nbsp;#:make-cbuffer-input-stream <br>&nbsp;&nbsp;&nbsp;#:make-cbuffer-output-stream <br>&nbsp;&nbsp;&nbsp;#:stream-position <br>&nbsp;&nbsp;&nbsp;#:stream-cbuffer </p><p> <span class="paren">)</span><span class="paren">)</span> </p></span><span class"body"></span></pre
<span class="paren">(</span>:use :cl :cffi :mycl-util
:trivial-gray-streams
:flexi-streams<span class="paren">)</span>
<span class="paren">(</span>:export
;;flag-system
#:*current-flag-system*
#:make-flag-system #:flag-system-parent
#:find-flag-system
#:delete-flag-system
#:clear-flag-systems
#:use-flagsystem
#:def-flag-system
#:with-flag-system
#:direct-flag-value
#:flag-value
#:clear-flags
#:concat-flags
#:flags
#:def-flag
#:def-flag*
#:has-flag
#:flag-list
;;helpers
#:defcfun*
#:defmethod*
;;cbuffer
#:make-cbuffer
#:make-cbuffer-from-pointer
#:cbuffer-p
#:cbuffer-data
#:cbuffer-size
#:cbuffer-length
#:*use-cbuffer-pool*
#:*cbuffer-pool-max-size*
#:*cbuffer-pool-min-buffer-size*
#:*cbuffer-pool-max-buffer-size*
#:make-cbuffer-pool
#:*cbuffer-pool*
#:clear-cbuffer-pool
#:alloc-cbuffer
#:free-cbuffer
#:cbuffer-resize
#:cbuffer-eob-p
#:cbuffer-ensure-size
#:cbuffer-adjust-min-size
#:with-cbuffer
#:cbuffer-checkbounds
#:cbuffer-byte
#:make-cbuffer-input-stream
#:make-cbuffer-output-stream
#:stream-position
#:stream-cbuffer
<span class="paren">)</span><span class="paren">)</span></span></pre
> >
</div </div
......
...@@ -14,9 +14,7 @@ ...@@ -14,9 +14,7 @@
><h2 ><h2
>Documentation</h2 >Documentation</h2
><blockquote ><blockquote