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

Contents of /cparse/00debug.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Tue Aug 29 20:31:54 2006 UTC (7 years, 7 months ago) by clynbech
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +9 -2 lines
2006-08-29  Christian Lynbech  <christian@defun.dk>

	* test3.lisp: New file.
	* test4.lisp: New file.

	* uffi-alien.lisp (*cpp-args-defaults*): Removed "-D_BITS_PTHREADTYPES_H"
	and docstring instead.
	(make-alien-defs): Updated docstring.

	* cparse.system: Added CLC require for UFFI. Changed from defsystem to
	asdf. Added warning for the CMUCL hash fill bug.

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

  ViewVC Help
Powered by ViewVC 1.1.5