mirror of
https://github.com/open-goal/jak-project
synced 2026-06-23 09:29:56 -04:00
a3e004f475
Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
56 lines
1.0 KiB
Common Lisp
Vendored
Generated
56 lines
1.0 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition for function strlen
|
|
(defun strlen ((arg0 pointer))
|
|
(let ((v1-0 arg0)
|
|
(v0-0 0)
|
|
)
|
|
(while (nonzero? (-> (the-as (pointer int8) v1-0)))
|
|
(+! v0-0 1)
|
|
(&+! v1-0 1)
|
|
)
|
|
v0-0
|
|
)
|
|
)
|
|
|
|
;; definition for function strncmp
|
|
(defun strncmp ((arg0 pointer) (arg1 pointer) (arg2 int))
|
|
(let ((v1-0 arg0)
|
|
(a0-1 arg1)
|
|
)
|
|
(while (nonzero? arg2)
|
|
(if (!= (-> (the-as (pointer int8) v1-0)) (-> (the-as (pointer int8) a0-1)))
|
|
(return #f)
|
|
)
|
|
(if (zero? (-> (the-as (pointer int8) v1-0)))
|
|
(return #t)
|
|
)
|
|
(set! arg2 (+ arg2 -1))
|
|
(&+! v1-0 1)
|
|
(&+! a0-1 1)
|
|
)
|
|
)
|
|
#t
|
|
)
|
|
|
|
;; definition for function strstr
|
|
(defun strstr ((arg0 pointer) (arg1 pointer))
|
|
(let ((s4-0 (strlen arg1)))
|
|
(while (nonzero? (-> (the-as (pointer int8) arg0)))
|
|
(if (strncmp arg0 arg1 s4-0)
|
|
(return arg0)
|
|
)
|
|
(&+! arg0 1)
|
|
)
|
|
)
|
|
(the-as pointer #f)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
0
|
|
|
|
|
|
|
|
|