home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / CLISP-2.LHA / CLISP960530-ki.lha / fd / ffi-findtask.lsp < prev    next >
Encoding:
Text File  |  1996-08-23  |  1.6 KB  |  67 lines

  1. #-FFI(error "Foreign Function Interface (FFI) no available")
  2.  
  3. (in-package "FFI-DEMOS")
  4. (use-package "FFI")
  5.  
  6. (def-c-struct node
  7.   (ln-Succ uint32)
  8.   (ln-Pred uint32)
  9.   (ln-Type uint8)
  10.   (ln-Pri  sint8)
  11.   (ln-Name c-string))
  12.  
  13. (def-c-struct task
  14.   (tc_Node  node)
  15.   (tc_Flags     uint8)
  16.   (tc_State     uint8)
  17.   (tc_IDNestCnt sint8)
  18.   (tc_TDNestCnt sint8)
  19.   (tc_SigAlloc  uint32)
  20.   (tc_SigWait   uint32)
  21.   (tc_SigRevd   uint32)
  22.   (tc_SigExcept uint32)
  23.   (tc_TrapAlloc uint16)
  24.   (tc_TrapAble  uint16)
  25.   (tc_ExceptData uint32)
  26.   (tc_ExceptCode c-pointer)
  27.   (tc_TrapData   uint32)
  28.   (tc_TrapCode   c-pointer)
  29.   (tc_SPReg      uint32)
  30.   (tc_SPLower    uint32)
  31.   (tc_SPUpper    uint32)
  32.   (tc_Switch     uint32) ; function
  33.   (tc_Launch     uint32) ; function
  34.  ;(tc_Mementry   list)   ; not defined here
  35.  ;(tc_UserData   uint32)
  36. )
  37.  
  38.  
  39. (def-lib-call-out FindTask-pointer "exec.library"
  40.   (:name "FindTask")
  41.   (:offset -294)
  42.   (:arguments
  43.    (name    c-string :in :alloca :a1))
  44.   (:return-type c-pointer :none))
  45. (def-lib-call-out FindTask-ptr "exec.library"
  46.   (:name "FindTask")
  47.   (:offset -294)
  48.   (:arguments
  49.    (name    c-string :in :alloca :a1))
  50.   (:return-type (c-ptr-null task) :none))
  51. (def-lib-call-out FindTask-int "exec.library"
  52.   (:name "FindTask")
  53.   (:offset -294)
  54.   (:arguments
  55.    (name    c-string :in :alloca :a1))
  56.   (:return-type uint32 :none))
  57.  
  58. ;; a FOREIGN-ADDRESS can only be tested for NULL with EQUALP against a known
  59. ;; NULL address. Where to get this first one?
  60.  
  61. #|
  62. (FindTask-pointer "ramlib")
  63. (FindTask-pointer nil)
  64. (ffi::foreign-address-variable "task" * 0 (ffi::parse-c-type 'task))
  65. (ffi::foreign-value *)
  66. |#
  67.