jak-project/goal_src/jak3/compiler-setup.gc

38 lines
806 B
Common Lisp
Raw Normal View History

;;
;; Compiler Setup for Jak 3
;;
;; load kernel type definitions.
;; these types/functions are provided by Jak 3's runtime.
(asm-file "goal_src/jak3/kernel-defs.gc")
;; load jak 3 project
(load-project "goal_src/jak3/game.gp")
(defmacro basic? (obj)
;; todo, make this more efficient
`(= 4 (logand (the integer ,obj) #b111))
)
(defmacro pair? (obj)
;; todo, make this more efficient
;`(= 2 (logand (the integer ,obj) #b111))
`(< (shl (the-as int ,obj) 62) 0)
)
(defmacro not-pair? (obj)
`(>= (shl (the-as int ,obj) 62) 0)
)
(defmacro binteger? (obj)
`(zero? (logand (the integer ,obj) #b111))
)
(defmacro rtype-of (obj)
`(cond ((binteger? ,obj) binteger)
((pair? ,obj) pair)
((basic? ,obj) (-> (the basic ,obj) type))
(else symbol)
)
)