[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Calling #_Date2Secs



I know I must be doing something obviously wrong here, but I
can't figure out what it is.  When I execute the following:


(rlet ((the-date :DateTimeRec
                     :year 1993
                     :month 1
                     :day 8)
       (the-other-date :DateTimeRec
                     :year 0
                     :month 0
                     :day 0)
         (the-time :long 0))
    (format t "~%the-time is a ~A~%" (type-of the-time))
    (format t  "the-date is a ~A~%" (type-of the-date))
    (format t "~%Getting Date: ~A/~A/~A~%" (rref the-date :DateTimeRec.month)
            (rref the-date :DateTimeRec.day)
            (rref the-date :DateTimeRec.year))

    (#_Date2Secs the-date the-time)     ; <- TRAP

    (format t "~%Got ~A from #_Date2Secs" (%get-long the-time))

    (#_Secs2Date (%get-long the-time) the-other-date) ;  <- TRAP

    (format t "~%Which is ~A/~A/~A~%" (rref the-other-date :DateTimeRec.month)
            (rref the-other-date :DateTimeRec.day)
            (rref the-other-date :DateTimeRec.year))
    (values))



I get the error:

> Error: value -1482696768 is not of the expected type MACPTR.
> While executing: #<Anonymous Function #xB4B766>
> Type Command-. to abort.


Now (as proven by the two print statements) both of these are being
passed as MACPTRs as I would expect.  I guess the trick is that
_Date2Secs wants my DateTimeRec in some other form.  Standard C
header files list it as a ptr, i.e.

      Date2Secs(&dtrp, &secs);

so I'm a bit confused as to what is going on.  Should the definition
in the interface file:

(deftrap _date2secs ((d :datetimerec) (secs (:pointer :signed-long)))
   nil
  (:no-trap
   (%put-ptr secs (ccl:register-trap #xa9C7 :a0 d :d0))))

be changed to:

(deftrap _date2secs ((d :datetimerec) (secs (:pointer :signed-long)))
   nil
  (:no-trap
    ; ??Change to %put-long??
   (%put-long secs (ccl:register-trap #xa9C7 :a0 d :d0))))

             Jeffrey

(PS I also noticed the seconds are defined as unsigned-longs and signed-longs.
These should probably be made consistant throughout the header files)


======================================
Jeffrey Kane, MD
Kane Biomedical Systems
Boston, MA

Internet    jbk@world.std.com
Compuserve  74206,640
AppleLink   D0738

[Don't take life too seriously... it's not like anyone gets out of it alive.]