home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / lisp / mcl / 1969 < prev    next >
Encoding:
Internet Message Format  |  1993-01-11  |  2.7 KB

  1. Path: sparky!uunet!paladin.american.edu!howland.reston.ans.net!usc!cs.utexas.edu!sun-barr!olivea!apple!goofy!cambridge.apple.com!jbk@world.std.com
  2. From: jbk@world.std.com (Jeffrey B Kane)
  3. Newsgroups: comp.lang.lisp.mcl
  4. Subject: Calling #_Date2Secs
  5. Message-ID: <199301101732.AA28275@world.std.com>
  6. Date: 10 Jan 93 17:32:00 GMT
  7. Sender: info-mcl-request@cambridge.apple.com
  8. Lines: 79
  9. Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
  10.  
  11.  
  12. I know I must be doing something obviously wrong here, but I
  13. can't figure out what it is.  When I execute the following:
  14.  
  15.  
  16. (rlet ((the-date :DateTimeRec
  17.                      :year 1993
  18.                      :month 1
  19.                      :day 8)
  20.        (the-other-date :DateTimeRec
  21.                      :year 0
  22.                      :month 0
  23.                      :day 0)
  24.          (the-time :long 0))
  25.     (format t "~%the-time is a ~A~%" (type-of the-time))
  26.     (format t  "the-date is a ~A~%" (type-of the-date))
  27.     (format t "~%Getting Date: ~A/~A/~A~%" (rref the-date :DateTimeRec.month)
  28.             (rref the-date :DateTimeRec.day)
  29.             (rref the-date :DateTimeRec.year))
  30.  
  31.     (#_Date2Secs the-date the-time)     ; <- TRAP
  32.  
  33.     (format t "~%Got ~A from #_Date2Secs" (%get-long the-time))
  34.  
  35.     (#_Secs2Date (%get-long the-time) the-other-date) ;  <- TRAP
  36.  
  37.     (format t "~%Which is ~A/~A/~A~%" (rref the-other-date :DateTimeRec.month)
  38.             (rref the-other-date :DateTimeRec.day)
  39.             (rref the-other-date :DateTimeRec.year))
  40.     (values))
  41.  
  42.  
  43.  
  44. I get the error:
  45.  
  46. > Error: value -1482696768 is not of the expected type MACPTR.
  47. > While executing: #<Anonymous Function #xB4B766>
  48. > Type Command-. to abort.
  49.  
  50.  
  51. Now (as proven by the two print statements) both of these are being
  52. passed as MACPTRs as I would expect.  I guess the trick is that
  53. _Date2Secs wants my DateTimeRec in some other form.  Standard C
  54. header files list it as a ptr, i.e.
  55.  
  56.       Date2Secs(&dtrp, &secs);
  57.  
  58. so I'm a bit confused as to what is going on.  Should the definition
  59. in the interface file:
  60.  
  61. (deftrap _date2secs ((d :datetimerec) (secs (:pointer :signed-long)))
  62.    nil
  63.   (:no-trap
  64.    (%put-ptr secs (ccl:register-trap #xa9C7 :a0 d :d0))))
  65.  
  66. be changed to:
  67.  
  68. (deftrap _date2secs ((d :datetimerec) (secs (:pointer :signed-long)))
  69.    nil
  70.   (:no-trap
  71.     ; ??Change to %put-long??
  72.    (%put-long secs (ccl:register-trap #xa9C7 :a0 d :d0))))
  73.  
  74.              Jeffrey
  75.  
  76. (PS I also noticed the seconds are defined as unsigned-longs and signed-longs.
  77. These should probably be made consistant throughout the header files)
  78.  
  79.  
  80. ======================================
  81. Jeffrey Kane, MD
  82. Kane Biomedical Systems
  83. Boston, MA
  84.  
  85. Internet    jbk@world.std.com
  86. Compuserve  74206,640
  87. AppleLink   D0738
  88.  
  89. [Don't take life too seriously... it's not like anyone gets out of it alive.]
  90.