jak-project/goal_src/engine/debug/assert.gc
ManDude 9d84ba8ca4
Decomp assert and debug-h (#282)
* [assert-h] decomp

* [assert] decomp

* Update assert.gc

* [debug-h] decomp

* oops
2021-02-24 22:58:20 -05:00

52 lines
1.9 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: assert.gc
;; name in dgo: assert
;; dgos: GAME, ENGINE
(define *run-time-assert-enable* #t) ;; where is this used?
(defun __assert ((exp symbol) (msg string))
"Assert that exp is truthy, print assert information otherwise"
(when (not exp)
(format #t "(ASSERT ~S) FAILED in "
msg)
(print-private-assert-info *__private-assert-info*)
)
0
)
(defun __assert-min-max-range-float
((exp float) (minimum float) (maximum float) (msg-exp string) (msg-min string) (msg-max string))
"Assert that float exp is a larger value than minimum and smaller than maximum, print assert information otherwise"
(when (or (< exp minimum) (< maximum exp))
(format #t "(ASSERT_MIN_MAX_RANGE_FLOAT ~S ~S ~S) FAILED (values ~F ~F ~F) in "
msg-exp msg-min msg-max exp minimum maximum)
(print-private-assert-info *__private-assert-info*)
)
0
)
(defun __assert-min-max-range-int
((exp int) (minimum int) (maximum int) (msg-exp string) (msg-min string) (msg-max string))
"Assert that integer exp is a larger value than minimum and smaller than maximum, print assert information otherwise"
(when (or (< exp minimum) (< maximum exp))
(format #t "(ASSERT_MIN_MAX_RANGE_INT ~S ~S ~S) FAILED (values ~D ~D ~D) in "
msg-exp msg-min msg-max exp minimum maximum)
(print-private-assert-info *__private-assert-info*)
)
0
)
(defun __assert-zero-lim-range-int ((exp int) (maximum int) (msg-exp string) (msg-max string))
"Assert that integer exp is a larger value than zero and smaller than maximum, print assert information otherwise"
(when (or (< exp 0) (>= exp max))
(format #t "(ASSERT_ZERO_LIM_RANGE_INT ~S ~S) FAILED (values ~D ~D) in "
msg-exp msg-max exp maximum)
(print-private-assert-info *__private-assert-info*)
)
0
)