Update of /cvsroot/sbcl/sbcl/contrib/sb-grovel
In directory sc8-pr-cvs1:/tmp/cvs-serv28280/contrib/sb-grovel
Modified Files:
def-to-lisp.lisp
Log Message:
0.8.0.7:
Various contrib/ fixes
... isolate the sb-bsd-sockets tests from the rest of the
system, so that they're not included in the
sb-simple-streams tests. (thanks to Rudi Schlatte)
... replace asm/errno.h with errno.h include in
sb-simple-streams. (thanks to Rudi Schlatte)
... make sb-grovel more likely to emit C9x compliant code, by
minimizing rightward drift.
Index: def-to-lisp.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/contrib/sb-grovel/def-to-lisp.lisp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- def-to-lisp.lisp 8 May 2003 20:37:55 -0000 1.3
+++ def-to-lisp.lisp 27 May 2003 09:20:02 -0000 1.4
@@ -6,7 +6,13 @@
(format stream "printf(\"(sb-grovel::define-c-struct ~A %d)\\n\",sizeof (~A));~%" lisp-name c-name)
(dolist (e elements)
(destructuring-bind (lisp-type lisp-el-name c-type c-el-name) e
- (format stream "printf(\"(sb-grovel::define-c-accessor ~A-~A ~A ~A \");~%"
+ ;; FIXME: this format string doesn't actually guarantee
+ ;; non-multilined-string-constantness, it just makes it more
+ ;; likely. Sort out the required behaviour (and maybe make
+ ;; the generated C more readable, while we're at it...) --
+ ;; CSR, 2003-05-27
+ (format stream "printf(\"(sb-grovel::define-c-accessor ~A-~A\\n\\~% ~
+ ~A ~A \");~%"
lisp-name lisp-el-name lisp-name lisp-type)
;; offset
(format stream "{ ~A t;printf(\"%d \",((unsigned long)&(t.~A)) - ((unsigned long)&(t)) ); }~%"
@@ -18,21 +24,11 @@
(defun c-for-function (stream lisp-name alien-defn)
(destructuring-bind (c-name &rest definition) alien-defn
- (let ((*print-right-margin* nil))
- (format stream "printf(\"(cl:declaim (cl:inline ~A))\\n\");~%"
- lisp-name)
- (princ "printf(\"(sb-grovel::define-foreign-routine (" stream)
- (princ "\\\"" stream) (princ c-name stream) (princ "\\\" " stream)
- (princ lisp-name stream)
- (princ " ) " stream)
- (terpri stream)
- (dolist (d definition)
- (write d :length nil
- :right-margin nil :stream stream)
- (princ " " stream))
- (format stream ")\\n\");")
- (terpri stream))))
-
+ (format stream "printf(\"(cl:declaim (cl:inline ~A))\\n\");~%" lisp-name)
+ (format stream
+ "printf(\"(sb-grovel::define-foreign-routine (\\\"~A\\\" ~A)\\n\\~%~
+ ~{ ~W~^\\n\\~%~})\\n\");~%"
+ c-name lisp-name definition)))
(defun print-c-source (stream headers definitions package-name)
(let ((*print-right-margin* nil))
@@ -69,7 +65,7 @@
(t
(format stream
"printf(\";; Non hablo Espagnol, Monsieur~%")))))
- (format stream "exit(0);~%}")))
+ (format stream "exit(0);~%}~%")))
(defun c-constants-extract (filename output-file package)
(with-open-file (f output-file :direction :output)
|