Files
jak-project/goal_src/jakx/compiler-setup.gc
2026-05-08 18:54:05 -04:00

38 lines
806 B
Common Lisp

;;
;; Compiler Setup for Jak X
;;
;; load kernel type definitions.
;; these types/functions are provided by Jak X's runtime.
(asm-file "goal_src/jakx/kernel-defs.gc")
;; load jak x project
(load-project "goal_src/jakx/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)
)
)