/[cparse]/cparse/00debug.lisp
ViewVC logotype

Contents of /cparse/00debug.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Wed Nov 24 20:29:32 2004 UTC (9 years, 4 months ago) by clynbech
Branch: MAIN
* test1.h: New file.
* test2.h: New file.
* test3.h: New file.
* 00debug.lisp: New file.
* 01debug.lisp: New file.
* dir-test-ffi.lisp: New file.
* dir-test.c: New file.
* uffi-alien.lisp: New file.
* system.lisp: Removed.
1 clynbech 1.1 ;;;; debug.lisp --- various forms usefull when doing debugging.
2    
3     (defparameter *uffi* '|1.4.30|)
4    
5     (case *uffi*
6     (cl-home (load "../../cl-home/cl-uffi/uffi.asd")
7     (asdf:operate 'asdf:load-op :uffi))
8     (|1.4.29| (load "../cl-uffi-1.4.29/uffi.asd")
9     (asdf:operate 'asdf:load-op :uffi))
10     (|1.4.30| (load "../cl-uffi-1.4.30/uffi.asd")
11     (asdf:operate 'asdf:load-op :uffi))
12     (dist (clc:clc-require :uffi)))
13    
14     (load "/usr/share/common-lisp/source/defsystem/defsystem.lisp")
15    
16     (load "cparse.system")
17    
18     #+nil
19     (mk:clean-system :cparse)
20    
21     (progn
22     (mk:compile-system :cparse) (mk:load-system :cparse))
23    
24     (defun dotest (&rest files)
25     (flet ((test-1 (file)
26     (let ((ffi (uffi-alien:make-alien-defs file)))
27     (mapc (lambda (form)
28     (typecase form
29     (symbol)
30     (list (format t "=== Form: ~S~%" form)
31     (format t "--> Eval: ~S~%" (eval form)))))
32     ffi))))
33     (mapc #'test-1 files)))
34    
35     #|
36    
37     (setq cparse::*cparse-debug* nil)
38     (setq cparse::*cparse-debug* t)
39     (setq cparse::*cparse-debug* 'much)
40    
41     (UFFI:DEF-FOREIGN-TYPE OBEX-EVENT-T
42     (*
43     (FUNCTION :VOID (HANDLE (* :POINTER-VOID))
44     (OBJ (* :POINTER-VOID)) (MODE :INT) (EVENT :INT)
45     (OBEX-CMD :INT) (OBEX-RSP :INT))))
46    
47     (uffi:def-foreign-type int-func (* (function :int :int)))
48     (uffi:def-foreign-type void-func (* (function :void :int)))
49    
50     (alien:def-alien-type ipointer (* (alien:signed 32)))
51     (alien:def-alien-type lpointer (* (alien:signed 64)))
52     (alien:def-alien-type vpointer (* t))
53     (alien:def-alien-type int-func (* (function (alien:signed 32) (alien:signed 32))))
54     (alien:def-alien-type void-func (* (function t (alien:signed 32))))
55    
56    
57     (uffi-alien:make-alien-defs "test1.h")
58     (uffi-alien:make-alien-defs "test2.h")
59     (uffi-alien:make-alien-defs "test3.h")
60     (uffi-alien:make-alien-defs "/usr/include/string.h")
61     (uffi-alien:make-alien-defs "/usr/include/bits/sigset.h")
62    
63     (progn (uffi-alien:make-alien-defs "/usr/include/sys/types.h")
64     (uffi-alien:make-alien-defs "/usr/include/dirent.h"))
65    
66     (dotest "test1.h")
67     (dotest "test2.h")
68     (dotest "test3.h")
69     (dotest "/usr/include/string.h")
70     (dotest "/usr/include/openobex/obex.h")
71     (dotest "/usr/include/bits/sigset.h")
72     (dotest "/usr/include/sys/types.h" "/usr/include/dirent.h")
73    
74     (defpackage :obex (:use :cl) (:shadow :listen))
75     (uffi-alien:make-alien-defs "/usr/include/openobex/obex.h")
76     (uffi-alien:make-alien-defs "/usr/include/openobex/obex.h"
77     :file "obex.lisp" :package :obex
78     :compile t :load t)
79    
80     (uffi:def-struct x1 (a1 :int) (a2 (:array :int 10)))
81    
82     (uffi:def-foreign-type x2 (:struct (a3 :int) (a4 (:array :int 10))))
83    
84    
85     (defun obex-test ()
86     (with-open-file (f "test3.lisp"
87     :direction :output
88     :if-exists :supersede
89     :if-does-not-exist :create)
90     (format f "~S~%~%"
91     '(unless (find-package :obex) (defpackage :obex (:shadow t))))
92     (format f "(IN-PACKAGE :OBEX)~%~%")
93     (format f "~S~%"
94     (uffi-alien:make-alien-defs "/usr/include/openobex/obex.h"))))
95    
96    
97     (defun dir-test-0 ()
98     (uffi:def-foreign-type DIR :pointer-void)
99     (uffi:def-struct dirent (d_ino :long)
100     (d_off :long)
101     (d_reclen :unsigned-short)
102     (d_type :unsigned-char)
103     (d_name (:array :char 256)))
104     (uffi:def-function "opendir" ((name (* :char))) :returning (* DIR))
105     (uffi:def-function "closedir" ((dirp (* DIR))) :returning :int)
106     (uffi:def-function "readdir" ((dirp (* DIR))) :returning (* dirent))
107     )
108    
109     (defun dir-test-1 ()
110     (with-open-file (f "test4.lisp"
111     :direction :output
112     :if-exists :supersede
113     :if-does-not-exist :create)
114     (format f "~S~%~%"
115     '(UNLESS (FIND-PACKAGE :DIR-TEST)
116     (DEFPACKAGE :DIR-TEST (:SHADOW t))))
117     (format f "(IN-PACKAGE :DIR-TEST)~%~%")
118     (format f "~S~%"
119     (uffi-alien:make-alien-defs "/usr/include/sys/types.h"))
120     (format f "~S~%"
121     (uffi-alien:make-alien-defs "/usr/include/dirent.h")))
122     (load "test4.lisp")
123     )
124    
125     |#
126    
127     ;;;; debug.lisp ends here.

  ViewVC Help
Powered by ViewVC 1.1.5