r1544: *** empty log message ***
authorKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 10 Mar 2002 22:29:47 +0000 (22:29 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 10 Mar 2002 22:29:47 +0000 (22:29 +0000)
doc/notes.sgml
doc/ref.sgml
examples/gettime.cl
src/aggregates.cl
src/primitives.cl
tests/gettime.cl

index 8dfb3e5906178cb2e57dffe47857bd799ddd2d98..cdb5f6d8788a7e81bf3a5ecdd28392874f1f461d 100644 (file)
     </sect2>
     <sect2>
       <title>Cross-Implementation Optimization</title>
-<para>To fully optimize across platforms, both explicit type information
-must be passed to dereferencing of pointers and arrays. Though this
-optimization only helps with &acl;, &uffi; is designed to require this
-type information be passed the dereference functions. Second, declarations
-of type should be made in functions, structures, and classes where
-foreign objects will be help. This will optimize access for &lw;
-</para>
-</sect2>
+      <para>
+       To fully optimize across platforms, both explicit type
+       information must be passed to dereferencing of pointers and
+       arrays. Though this optimization only helps with &acl;, &uffi;
+       is designed to require this type information be passed the
+       dereference functions. Second, declarations of type should be
+       made in functions, structures, and classes where foreign
+       objects will be help. This will optimize access for &lw;
+      </para>
+      <para>
+       Here is an example that should both methods being used for
+       maximum cross-implementation optimization:
+       <programlisting>
+(let ((a-foreign-struct (allocate-foreign-object 'the-struct-type)))
+  (uffi-declare 'the-struct-type a-foreign-struct)
+  (get-slot-value a-foreign-struct 'the-struct-type 'field-name))
+       </programlisting>
+      </para>
+    </sect2>
   </sect1>
 
 </chapter>
index 2935dcf7346c47a21c6a160b2c1819f54df683ad..33f8a568d7e317d990aade3ca42ee60cf8efaa09 100644 (file)
@@ -471,7 +471,9 @@ a session.
       <refsect1>
        <title>Examples</title>
        <programlisting>
-  (load-foreign-library #p"/usr/lib/libmysqlclient.so" "mysql" '("c"))
+  (load-foreign-library #p"/usr/lib/libmysqlclient.so" 
+                        :module "mysql" 
+                        :supporting-libraries '("c"))
     => T
        </programlisting>
       </refsect1>
index be0bdee36ddf6be971ae2ca89f4d25574c31b9cd..a0933066ff32b500401cf2c29e92764607318959 100644 (file)
@@ -9,7 +9,7 @@
 ;;;;
 ;;;; Copyright (c) 2002 Kevin M. Rosenberg
 ;;;;
-;;;; $Id: gettime.cl,v 1.3 2002/03/10 04:15:33 kevin Exp $
+;;;; $Id: gettime.cl,v 1.4 2002/03/10 22:29:47 kevin Exp $
 ;;;;
 ;;;; This file is part of UFFI. 
 ;;;;
 (defun gettime ()
   "Returns the local time"
   (let* ((time (uffi:allocate-foreign-object time-t)))
+;;    (uffi:uffi-declare time-t time)
     (c-time time)
-    (let* ((tm-ptr (c-localtime time))
-          (time-string (format nil "~2d/~2,'0d/~d ~2d:~2,'0d:~2,'0d" 
-                               (1+ (uffi:get-slot-value tm-ptr 'mon 'tm))
-                               (uffi:get-slot-value tm-ptr 'mday 'tm)
-                               (+ 1900 (uffi:get-slot-value tm-ptr 'year 'tm))
-                               (uffi:get-slot-value tm-ptr 'hour 'tm)
-                               (uffi:get-slot-value tm-ptr 'min 'tm)
-                               (uffi:get-slot-value tm-ptr 'sec 'tm)
-                               )))
-      (uffi:free-foreign-object time)
-      time-string)
+    (let ((tm-ptr (c-localtime time)))
+;;      (uffi:uffi-declare (* tm) tm-ptr)
+      (let ((time-string (format nil "~2d/~2,'0d/~d ~2d:~2,'0d:~2,'0d" 
+                                (1+ (uffi:get-slot-value tm-ptr 'tm 'mon))
+                                (uffi:get-slot-value tm-ptr 'tm 'mday)
+                                (+ 1900 (uffi:get-slot-value tm-ptr 'tm 'year))
+                                (uffi:get-slot-value tm-ptr 'tm 'hour)
+                                (uffi:get-slot-value tm-ptr 'tm 'min)
+                                (uffi:get-slot-value tm-ptr 'tm 'sec)
+                                )))
+       (uffi:free-foreign-object time)
+       time-string))
     ))
 
 #+test-uffi
index bf163c892a254c4d76a8b20ba20488814cfd7685..64a0e281f543409e4577479e5deff9b2ff748697 100644 (file)
@@ -9,7 +9,7 @@
 ;;;;
 ;;;; Copyright (c) 2002 Kevin M. Rosenberg
 ;;;;
-;;;; $Id: aggregates.cl,v 1.2 2002/03/10 11:13:07 kevin Exp $
+;;;; $Id: aggregates.cl,v 1.3 2002/03/10 22:29:47 kevin Exp $
 ;;;;
 ;;;; This file is part of the UFFI. 
 ;;;;
@@ -95,7 +95,7 @@ of the enum-name name, separator-string, and field-name"
   )
 
 
-(defmacro get-slot-value (obj slot type)
+(defmacro get-slot-value (obj type slot)
   #+(or lispworks cmu) (declare (ignore type))
   #+allegro
   `(ff:fslot-value-typed ,type :c ,obj ,slot)
@@ -105,7 +105,7 @@ of the enum-name name, separator-string, and field-name"
   `(alien:slot ,obj ,slot)
   )
 
-(defmacro get-slot-pointer (obj slot type)
+(defmacro get-slot-pointer (obj type slot)
   #+(or lispworks cmu) (declare (ignore type))
   #+allegro
   `(ff:fslot-value-typed ,type :c ,obj ,slot)
@@ -115,7 +115,7 @@ of the enum-name name, separator-string, and field-name"
   `(alien:slot ,obj ,slot)
   )
 
-(defmacro deref-array (obj i type)
+(defmacro deref-array (obj type i)
   "Returns a field from a row"
   #+(or lispworks cmu) (declare (ignore type))
   #+cmu  `(alien:deref ,obj ,i)
index c5c64502ce241ce64bf4b2b62fe58e7b4f476231..a0bcae74361768916e7d066a5478042d07e90830 100644 (file)
@@ -9,7 +9,7 @@
 ;;;;
 ;;;; Copyright (c) 2002 Kevin M. Rosenberg
 ;;;;
-;;;; $Id: primitives.cl,v 1.1 2002/03/10 21:48:50 kevin Exp $
+;;;; $Id: primitives.cl,v 1.2 2002/03/10 22:29:47 kevin Exp $
 ;;;;
 ;;;; This file is part of the UFFI. 
 ;;;;
@@ -42,7 +42,7 @@ supports this."
   #+(or lispworks allegro)
   (declare (ignore type name))
   #+cmu
-  `(declare (type (alien ,type) ,name))
+  `(declare (type (alien:alien ,type)) ,name)
   )
 
 (defmacro slot-type (type)
@@ -90,7 +90,7 @@ supports this."
     '((* . *) (:void . c-call:void) 
       (:short . c-call:short)
       (:pointer-void . (* t))
-      (:cstring . c-call:cstring)
+      (:cstring . c-call:c-string)
       (:char . c-call:char) 
       (:unsigned-char . (alien:unsigned 8))
       (:byte . (alien:unsigned 8))
index be0bdee36ddf6be971ae2ca89f4d25574c31b9cd..a0933066ff32b500401cf2c29e92764607318959 100644 (file)
@@ -9,7 +9,7 @@
 ;;;;
 ;;;; Copyright (c) 2002 Kevin M. Rosenberg
 ;;;;
-;;;; $Id: gettime.cl,v 1.3 2002/03/10 04:15:33 kevin Exp $
+;;;; $Id: gettime.cl,v 1.4 2002/03/10 22:29:47 kevin Exp $
 ;;;;
 ;;;; This file is part of UFFI. 
 ;;;;
 (defun gettime ()
   "Returns the local time"
   (let* ((time (uffi:allocate-foreign-object time-t)))
+;;    (uffi:uffi-declare time-t time)
     (c-time time)
-    (let* ((tm-ptr (c-localtime time))
-          (time-string (format nil "~2d/~2,'0d/~d ~2d:~2,'0d:~2,'0d" 
-                               (1+ (uffi:get-slot-value tm-ptr 'mon 'tm))
-                               (uffi:get-slot-value tm-ptr 'mday 'tm)
-                               (+ 1900 (uffi:get-slot-value tm-ptr 'year 'tm))
-                               (uffi:get-slot-value tm-ptr 'hour 'tm)
-                               (uffi:get-slot-value tm-ptr 'min 'tm)
-                               (uffi:get-slot-value tm-ptr 'sec 'tm)
-                               )))
-      (uffi:free-foreign-object time)
-      time-string)
+    (let ((tm-ptr (c-localtime time)))
+;;      (uffi:uffi-declare (* tm) tm-ptr)
+      (let ((time-string (format nil "~2d/~2,'0d/~d ~2d:~2,'0d:~2,'0d" 
+                                (1+ (uffi:get-slot-value tm-ptr 'tm 'mon))
+                                (uffi:get-slot-value tm-ptr 'tm 'mday)
+                                (+ 1900 (uffi:get-slot-value tm-ptr 'tm 'year))
+                                (uffi:get-slot-value tm-ptr 'tm 'hour)
+                                (uffi:get-slot-value tm-ptr 'tm 'min)
+                                (uffi:get-slot-value tm-ptr 'tm 'sec)
+                                )))
+       (uffi:free-foreign-object time)
+       time-string))
     ))
 
 #+test-uffi