handle function pointer defintions
authorD Herring <dherring@at.tentpost.dot.com>
Thu, 7 Apr 2011 03:38:15 +0000 (23:38 -0400)
committerD Herring <dherring@at.tentpost.dot.com>
Thu, 7 Apr 2011 03:38:15 +0000 (23:38 -0400)
Makefile
function-pointers.txt [new file with mode: 0644]
read-functions.lisp

index 36eefde..7b2f993 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -18,3 +18,7 @@ check-macros.txt:
 functions.txt:
        sed -n -e '/^H5_DLL [^)]*$$/,/)/ p' -e '/^H5_DLL .*)/ p' $(INCLUDEDIR)/H*public.h | cpp | sed -e '/#/ d' -e 's/H5_DLL //' -e 's/([ ]*void[ ]*)/()/' > $@.tmp
        mv $@.tmp $@
+
+function-pointers.txt:
+       sed -n -e '/^typedef[^;]*\*/ { s/.*(\*//; s/).*//; p}' $(INCLUDEDIR)/H*public.h > $@.tmp
+       mv $@.tmp $@
diff --git a/function-pointers.txt b/function-pointers.txt
new file mode 100644 (file)
index 0000000..7802794
--- /dev/null
@@ -0,0 +1,35 @@
+H5A_operator2_t
+H5A_operator1_t
+H5DS_iterate_t
+H5D_operator_t
+H5E_walk2_t
+H5E_auto2_t
+H5E_walk1_t
+H5E_auto1_t
+H5G_iterate_t
+H5I_free_t
+H5I_search_func_t
+H5L_create_func_t
+H5L_move_func_t
+H5L_copy_func_t
+H5L_traverse_func_t
+H5L_delete_func_t
+H5L_query_func_t
+H5L_iterate_t
+H5L_elink_traverse_t
+H5MM_allocate_t
+H5MM_free_t
+H5O_iterate_t
+H5P_cls_create_func_t
+H5P_cls_copy_func_t
+H5P_cls_close_func_t
+H5P_prp_cb1_t
+H5P_prp_cb2_t
+H5P_prp_compare_func_t
+H5P_iterate_t
+H5T_conv_t
+H5T_conv_except_func_t
+H5Z_filter_func_t
+H5Z_can_apply_func_t
+H5Z_set_local_func_t
+H5Z_func_t
index a4eb24c..57ebe41 100644 (file)
                (args (cdr parse)))
           (push `(cffi:defcfun (,symbol ,name) ,ret ,function ,@args) code))
         (setf function "")))))
+
+(defun read-function-pointers (&optional (filename "function-pointers.txt"))
+  (with-open-file (file filename)
+    (do (code
+         (line (read-line file nil)
+               (read-line file nil)))
+        ((not line)
+         (cons 'progn code))
+      (push `(cffi:defctype ,(normal-symbol line) :pointer) code))))