0.7.6.15:
authorChristophe Rhodes <csr21@cam.ac.uk>
Thu, 8 Aug 2002 11:28:45 +0000 (11:28 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Thu, 8 Aug 2002 11:28:45 +0000 (11:28 +0000)
Bugfix for DEFINE-ALIEN-ROUTINE
... now alien routines with doctypes get an FTYPE DECLAIMed
which has the right number of arguments
... remove duplicate definition of get-timezone; use helper
functions defined in unix.lisp

src/code/target-alieneval.lisp
src/code/time.lisp
tests/alien.impure.lisp
version.lisp-expr

index c130387..66a2e56 100644 (file)
                ;; here, so e.g. an alien function of "int" and "char"
                ;; arguments would get Lisp arg types WORD and CHARACTER
                ;; or something. Meanwhile, for now we just punt.
-               (lisp-arg-types (mapcar (constantly t) args))
+               (lisp-arg-types (mapcar (constantly t) (lisp-args)))
                ;; KLUDGE: This is a quick hack to solve bug 133,
                ;; where PROCLAIM trying to translate alien void result
                ;; types would signal an error here ("cannot use values
index 3694425..451003a 100644 (file)
 \f
 ;;;; Encode and decode universal times.
 
-;;; Returns two values:
-;;;  - the minutes west of GMT.
-;;;  - T if daylight savings is in effect, NIL if not.
-(sb!alien:define-alien-routine get-timezone sb!alien:void
-  (when sb!alien:long :in)
-  (minutes-west sb!alien:int :out)
-  (daylight-savings-p sb!alien:boolean :out))
-
 ;;; Subtract from the returned Internal-Time to get the universal
 ;;; time. The offset between our time base and the Perq one is 2145
 ;;; weeks and five days.
           (year NIL)
           (day NIL)
           (daylight NIL)
-          (timezone (if (null time-zone)
-                        (multiple-value-bind
-                            (ignore minwest dst)
-                            (get-timezone (- universal-time
-                                             unix-to-universal-time))
-                          (declare (ignore ignore))
-                          (setf daylight dst)
-                          minwest)
-                        (* time-zone 60))))
+          (timezone (cond
+                      ((null time-zone)
+                       (multiple-value-bind
+                             (ignore minwest dst)
+                           (sb!unix::get-timezone (- universal-time
+                                                     unix-to-universal-time))
+                         (declare (ignore ignore))
+                         (declare (fixnum minwest))
+                         (setf daylight dst)
+                         minwest))
+                      (t (* time-zone 60)))))
       (declare (fixnum timezone))
       (multiple-value-bind (t1 seconds) (truncate secs 60)
        (setq second seconds)
     (if time-zone
        (+ second (* (+ minute (* (+ hours time-zone) 60)) 60))
        (let* ((minwest-guess
-               (nth-value 1
-                          (get-timezone (- (* hours 60 60)
-                                           unix-to-universal-time))))
+               (sb!unix::unix-get-minutes-west (- (* hours 60 60)
+                                                 unix-to-universal-time)))
               (guess (+ minute (* hours 60) minwest-guess))
               (minwest
-               (nth-value 1
-                          (get-timezone (- (* guess 60)
-                                           unix-to-universal-time)))))
+               (sb!unix::unix-get-minutes-west (- (* guess 60)
+                                                 unix-to-universal-time))))
          (+ second (* (+ guess (- minwest minwest-guess)) 60))))))
 \f
 ;;;; TIME
index 8638d5c..3aee388 100644 (file)
 
 ;;; bug 133, fixed in 0.7.0.5: Somewhere in 0.pre7.*, C void returns
 ;;; were broken ("unable to use values types here") when
-;;; auto-PROCLAIM-of-return-value was added to DEFINE-ALIEN_ROUTINE.
+;;; auto-PROCLAIM-of-return-value was added to DEFINE-ALIEN-ROUTINE.
 (sb-alien:define-alien-routine ("free" free) void (ptr (* t) :in))
 
+;;; Types of alien functions were being incorrectly DECLAIMED when
+;;; docstrings were included in the definition until sbcl-0.7.6.15.
+(sb-alien:define-alien-routine ("getenv" ftype-correctness) c-string
+  "docstring"
+  (name c-string))
+
+(multiple-value-bind (function warningsp failurep)
+    (compile nil '(lambda () (ftype-correctness)))
+  (assert warningsp))
+
+(multiple-value-bind (function warningsp failurep)
+    (compile nil '(lambda () (ftype-correctness "FOO")))
+  (assert (not warningsp)))
+
+(multiple-value-bind (function warningsp failurep)
+    (compile nil '(lambda () (ftype-correctness "FOO" "BAR")))
+  (assert warningsp))
+
 ;;; success
 (quit :unix-status 104)
index b990d22..18afe7f 100644 (file)
@@ -18,4 +18,4 @@
 ;;; for internal versions, especially for internal versions off the
 ;;; main CVS branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
 
-"0.7.6.14"
+"0.7.6.15"