;; 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
\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
;;; 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)