mirror of
https://github.com/open-goal/jak-project
synced 2026-05-25 15:25:31 -04:00
cd68cb671e
Major change to how `deftype` shows up in our code: - the decompiler will no longer emit the `offset-assert`, `method-count-assert`, `size-assert` and `flag-assert` parameters. There are extremely few cases where having this in the decompiled code is helpful, as the types there come from `all-types` which already has those parameters. This also doesn't break type consistency because: - the asserts aren't compared. - the first step of the test uses `all-types`, which has the asserts, which will throw an error if they're bad. - the decompiler won't emit the `heap-base` parameter unless necessary now. - the decompiler will try its hardest to turn a fixed-offset field into an `overlay-at` field. It falls back to the old offset if all else fails. - `overlay-at` now supports field "dereferencing" to specify the offset that's within a field that's a structure, e.g.: ```lisp (deftype foobar (structure) ((vec vector :inline) (flags int32 :overlay-at (-> vec w)) ) ) ``` in this structure, the offset of `flags` will be 12 because that is the final offset of `vec`'s `w` field within this structure. - **removed ID from all method declarations.** IDs are only ever automatically assigned now. Fixes #3068. - added an `:overlay` parameter to method declarations, in order to declare a new method that goes on top of a previously-defined method. Syntax is `:overlay <method-name>`. Please do not ever use this. - added `state-methods` list parameter. This lets you quickly specify a list of states to be put in the method table. Same syntax as the `states` list parameter. The decompiler will try to put as many states in this as it can without messing with the method ID order. Also changes `defmethod` to make the first type definition (before the arguments) optional. The type can now be inferred from the first argument. Fixes #3093. --------- Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
757 lines
20 KiB
Common Lisp
Vendored
Generated
757 lines
20 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition for method 4 of type string
|
|
(defmethod length ((this string))
|
|
(let ((v1-0 (-> this data)))
|
|
(while (nonzero? (-> v1-0 0))
|
|
(nop!)
|
|
(nop!)
|
|
(nop!)
|
|
(set! v1-0 (&-> v1-0 1))
|
|
)
|
|
(&- v1-0 (the-as uint (-> this data)))
|
|
)
|
|
)
|
|
|
|
;; definition for method 5 of type string
|
|
(defmethod asize-of ((this string))
|
|
(+ (-> this allocated-length) 1 (-> string size))
|
|
)
|
|
|
|
;; definition for function copy-string<-string
|
|
(defun copy-string<-string ((arg0 string) (arg1 string))
|
|
(let ((v1-0 (-> arg0 data)))
|
|
(let ((a1-1 (-> arg1 data)))
|
|
(while (nonzero? (-> a1-1 0))
|
|
(set! (-> v1-0 0) (-> a1-1 0))
|
|
(set! v1-0 (&-> v1-0 1))
|
|
(set! a1-1 (&-> a1-1 1))
|
|
)
|
|
)
|
|
(set! (-> v1-0 0) (the-as uint 0))
|
|
)
|
|
arg0
|
|
)
|
|
|
|
;; definition for method 0 of type string
|
|
(defmethod new string ((allocation symbol) (type-to-make type) (arg0 int) (arg1 string))
|
|
(cond
|
|
(arg1
|
|
(let* ((s2-1 (max (length arg1) arg0))
|
|
(a0-4 (object-new allocation type-to-make (+ s2-1 1 (-> type-to-make size))))
|
|
)
|
|
(set! (-> a0-4 allocated-length) s2-1)
|
|
(copy-string<-string a0-4 arg1)
|
|
)
|
|
)
|
|
(else
|
|
(let ((v0-2 (object-new allocation type-to-make (+ arg0 1 (-> type-to-make size)))))
|
|
(set! (-> v0-2 allocated-length) arg0)
|
|
v0-2
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for function string=
|
|
(defun string= ((arg0 string) (arg1 string))
|
|
(let ((a2-0 (-> arg0 data))
|
|
(v1-0 (-> arg1 data))
|
|
)
|
|
(if (or (zero? arg0) (zero? arg1))
|
|
(return #f)
|
|
)
|
|
(while (and (nonzero? (-> a2-0 0)) (nonzero? (-> v1-0 0)))
|
|
(if (!= (-> a2-0 0) (-> v1-0 0))
|
|
(return #f)
|
|
)
|
|
(set! a2-0 (&-> a2-0 1))
|
|
(set! v1-0 (&-> v1-0 1))
|
|
)
|
|
(and (zero? (-> a2-0 0)) (zero? (-> v1-0 0)))
|
|
)
|
|
)
|
|
|
|
;; definition for function string-prefix=
|
|
(defun string-prefix= ((arg0 string) (arg1 string))
|
|
(let ((v1-0 (-> arg0 data)))
|
|
(let ((a2-0 (-> arg1 data)))
|
|
(if (or (zero? arg0) (zero? arg1))
|
|
(return #f)
|
|
)
|
|
(while (and (nonzero? (-> v1-0 0)) (nonzero? (-> a2-0 0)))
|
|
(if (!= (-> v1-0 0) (-> a2-0 0))
|
|
(return #f)
|
|
)
|
|
(set! v1-0 (&-> v1-0 1))
|
|
(set! a2-0 (&-> a2-0 1))
|
|
)
|
|
)
|
|
(zero? (-> v1-0 0))
|
|
)
|
|
)
|
|
|
|
;; definition for function charp-prefix=
|
|
(defun charp-prefix= ((arg0 (pointer uint8)) (arg1 (pointer uint8)))
|
|
(while (and (nonzero? (-> arg0 0)) (nonzero? (-> arg1 0)))
|
|
(if (!= (-> arg0 0) (-> arg1 0))
|
|
(return #f)
|
|
)
|
|
(set! arg0 (&-> arg0 1))
|
|
(set! arg1 (&-> arg1 1))
|
|
)
|
|
(zero? (-> arg0 0))
|
|
)
|
|
|
|
;; definition for function string-suffix=
|
|
(defun string-suffix= ((arg0 string) (arg1 string))
|
|
(let ((s5-0 (-> arg0 data))
|
|
(gp-0 (-> arg1 data))
|
|
)
|
|
(if (or (zero? arg0) (zero? arg1))
|
|
(return #f)
|
|
)
|
|
(let ((s4-0 (length arg0))
|
|
(v1-5 (length arg1))
|
|
)
|
|
(if (< s4-0 v1-5)
|
|
(return #f)
|
|
)
|
|
(let ((v1-7 (&+ s5-0 (- s4-0 v1-5))))
|
|
(while (and (nonzero? (-> v1-7 0)) (nonzero? (-> gp-0 0)))
|
|
(if (!= (-> v1-7 0) (-> gp-0 0))
|
|
(return #f)
|
|
)
|
|
(set! v1-7 (&-> v1-7 1))
|
|
(set! gp-0 (&-> gp-0 1))
|
|
)
|
|
(zero? (-> v1-7 0))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for function string-position
|
|
(defun string-position ((arg0 string) (arg1 string))
|
|
(let ((s5-0 0)
|
|
(s4-0 (-> arg1 data))
|
|
)
|
|
(while (nonzero? (-> s4-0 0))
|
|
(if (charp-prefix= (-> arg0 data) s4-0)
|
|
(return s5-0)
|
|
)
|
|
(+! s5-0 1)
|
|
(set! s4-0 (&-> s4-0 1))
|
|
)
|
|
)
|
|
-1
|
|
)
|
|
|
|
;; definition for function string-charp=
|
|
(defun string-charp= ((arg0 string) (arg1 (pointer uint8)))
|
|
(let ((v1-0 (-> arg0 data)))
|
|
(while (and (nonzero? (-> v1-0 0)) (nonzero? (-> arg1 0)))
|
|
(if (!= (-> v1-0 0) (-> arg1 0))
|
|
(return #f)
|
|
)
|
|
(set! v1-0 (&-> v1-0 1))
|
|
(set! arg1 (&-> arg1 1))
|
|
)
|
|
(and (zero? (-> v1-0 0)) (zero? (-> arg1 0)))
|
|
)
|
|
)
|
|
|
|
;; definition for function name=
|
|
;; ERROR: function was not converted to expressions. Cannot decompile.
|
|
|
|
;; definition for function copyn-string<-charp
|
|
(defun copyn-string<-charp ((arg0 string) (arg1 (pointer uint8)) (arg2 int))
|
|
(let ((v1-0 (-> arg0 data)))
|
|
(dotimes (a3-0 arg2)
|
|
(set! (-> v1-0 0) (-> arg1 0))
|
|
(set! v1-0 (&-> v1-0 1))
|
|
(set! arg1 (&-> arg1 1))
|
|
)
|
|
(set! (-> v1-0 0) (the-as uint 0))
|
|
)
|
|
arg0
|
|
)
|
|
|
|
;; definition for function string<-charp
|
|
(defun string<-charp ((arg0 string) (arg1 (pointer uint8)))
|
|
(let ((v1-0 (-> arg0 data)))
|
|
(while (nonzero? (-> arg1 0))
|
|
(set! (-> v1-0 0) (-> arg1 0))
|
|
(set! v1-0 (&-> v1-0 1))
|
|
(set! arg1 (&-> arg1 1))
|
|
)
|
|
(set! (-> v1-0 0) (the-as uint 0))
|
|
)
|
|
arg0
|
|
)
|
|
|
|
;; definition for function charp<-string
|
|
(defun charp<-string ((arg0 (pointer uint8)) (arg1 string))
|
|
(let ((v1-0 (-> arg1 data)))
|
|
(while (nonzero? (-> v1-0 0))
|
|
(set! (-> arg0 0) (-> v1-0 0))
|
|
(set! arg0 (&-> arg0 1))
|
|
(set! v1-0 (&-> v1-0 1))
|
|
)
|
|
)
|
|
(set! (-> arg0 0) (the-as uint 0))
|
|
0
|
|
)
|
|
|
|
;; definition for function copyn-charp<-string
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defun copyn-charp<-string ((arg0 (pointer uint8)) (arg1 string) (arg2 int))
|
|
(let ((v1-0 (-> arg1 data)))
|
|
(while (and (nonzero? (-> v1-0 0)) (< 1 arg2))
|
|
(set! (-> arg0 0) (-> v1-0 0))
|
|
(set! arg0 (&-> arg0 1))
|
|
(set! v1-0 (&-> v1-0 1))
|
|
(set! arg2 (+ arg2 -1))
|
|
)
|
|
)
|
|
(while (> arg2 0)
|
|
(set! (-> arg0 0) (the-as uint 0))
|
|
(set! arg0 (&-> arg0 1))
|
|
(set! arg2 (+ arg2 -1))
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for function copy-charp<-charp
|
|
(defun copy-charp<-charp ((arg0 (pointer uint8)) (arg1 (pointer uint8)))
|
|
(while (nonzero? (-> arg1 0))
|
|
(set! (-> arg0 0) (-> arg1 0))
|
|
(set! arg0 (&-> arg0 1))
|
|
(set! arg1 (&-> arg1 1))
|
|
)
|
|
(set! (-> arg0 0) (the-as uint 0))
|
|
arg0
|
|
)
|
|
|
|
;; definition for function cat-string<-string
|
|
(defun cat-string<-string ((arg0 string) (arg1 string))
|
|
(let ((v1-0 (-> arg0 data)))
|
|
(let ((a1-1 (-> arg1 data)))
|
|
(while (nonzero? (-> v1-0 0))
|
|
(nop!)
|
|
(nop!)
|
|
(nop!)
|
|
(set! v1-0 (&-> v1-0 1))
|
|
)
|
|
(while (nonzero? (-> a1-1 0))
|
|
(set! (-> v1-0 0) (-> a1-1 0))
|
|
(set! v1-0 (&-> v1-0 1))
|
|
(set! a1-1 (&-> a1-1 1))
|
|
)
|
|
)
|
|
(set! (-> v1-0 0) (the-as uint 0))
|
|
)
|
|
arg0
|
|
)
|
|
|
|
;; definition for function catn-string<-charp
|
|
(defun catn-string<-charp ((arg0 string) (arg1 (pointer uint8)) (arg2 int))
|
|
(let ((v1-0 (-> arg0 data)))
|
|
(while (nonzero? (-> v1-0 0))
|
|
(nop!)
|
|
(nop!)
|
|
(nop!)
|
|
(set! v1-0 (&-> v1-0 1))
|
|
)
|
|
(dotimes (a3-2 arg2)
|
|
(set! (-> v1-0 0) (-> arg1 0))
|
|
(set! v1-0 (&-> v1-0 1))
|
|
(set! arg1 (&-> arg1 1))
|
|
)
|
|
(set! (-> v1-0 0) (the-as uint 0))
|
|
)
|
|
arg0
|
|
)
|
|
|
|
;; definition for function cat-string<-string_to_charp
|
|
(defun cat-string<-string_to_charp ((arg0 string) (arg1 string) (arg2 (pointer uint8)))
|
|
(let ((v1-0 (-> arg1 data))
|
|
(v0-0 (-> arg0 data))
|
|
)
|
|
(while (nonzero? (-> v0-0 0))
|
|
(nop!)
|
|
(nop!)
|
|
(nop!)
|
|
(set! v0-0 (&-> v0-0 1))
|
|
)
|
|
(while (and (>= (the-as int arg2) (the-as int v1-0)) (nonzero? (-> v1-0 0)))
|
|
(set! (-> v0-0 0) (-> v1-0 0))
|
|
(set! v0-0 (&-> v0-0 1))
|
|
(set! v1-0 (&-> v1-0 1))
|
|
)
|
|
(set! (-> v0-0 0) (the-as uint 0))
|
|
v0-0
|
|
)
|
|
)
|
|
|
|
;; definition for function append-character-to-string
|
|
(defun append-character-to-string ((arg0 string) (arg1 uint8))
|
|
(let ((v1-0 (-> arg0 data)))
|
|
(while (nonzero? (-> v1-0 0))
|
|
(nop!)
|
|
(nop!)
|
|
(nop!)
|
|
(set! v1-0 (&-> v1-0 1))
|
|
)
|
|
(set! (-> v1-0 0) (the-as uint arg1))
|
|
(set! (-> v1-0 1) (the-as uint 0))
|
|
)
|
|
0
|
|
0
|
|
)
|
|
|
|
;; definition for function charp-basename
|
|
(defun charp-basename ((arg0 (pointer uint8)))
|
|
(let ((v1-0 arg0))
|
|
(while (nonzero? (-> v1-0 0))
|
|
(set! v1-0 (&-> v1-0 1))
|
|
)
|
|
(while (< (the-as int arg0) (the-as int v1-0))
|
|
(set! v1-0 (&-> v1-0 -1))
|
|
(if (or (= (-> v1-0 0) 47) (= (-> v1-0 0) 92))
|
|
(return (&-> v1-0 1))
|
|
)
|
|
)
|
|
)
|
|
arg0
|
|
)
|
|
|
|
;; definition for function clear
|
|
(defun clear ((arg0 string))
|
|
(set! (-> arg0 data 0) (the-as uint 0))
|
|
arg0
|
|
)
|
|
|
|
;; definition for function string<?
|
|
(defun string<? ((arg0 string) (arg1 string))
|
|
(let ((s4-1 (min (length arg0) (length arg1))))
|
|
(dotimes (v1-4 s4-1)
|
|
(cond
|
|
((< (-> arg0 data v1-4) (-> arg1 data v1-4))
|
|
(return #t)
|
|
)
|
|
((< (-> arg1 data v1-4) (-> arg0 data v1-4))
|
|
(return #f)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
#f
|
|
)
|
|
|
|
;; definition for function string>?
|
|
(defun string>? ((arg0 string) (arg1 string))
|
|
(let ((s4-1 (min (length arg0) (length arg1))))
|
|
(dotimes (v1-4 s4-1)
|
|
(cond
|
|
((< (-> arg0 data v1-4) (-> arg1 data v1-4))
|
|
(return #f)
|
|
)
|
|
((< (-> arg1 data v1-4) (-> arg0 data v1-4))
|
|
(return #t)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
#f
|
|
)
|
|
|
|
;; definition for function string<=?
|
|
(defun string<=? ((arg0 string) (arg1 string))
|
|
(let ((s4-1 (min (length arg0) (length arg1))))
|
|
(dotimes (v1-4 s4-1)
|
|
(cond
|
|
((< (-> arg0 data v1-4) (-> arg1 data v1-4))
|
|
(return #t)
|
|
)
|
|
((< (-> arg1 data v1-4) (-> arg0 data v1-4))
|
|
(return #f)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
#t
|
|
)
|
|
|
|
;; definition for function string>=?
|
|
(defun string>=? ((arg0 string) (arg1 string))
|
|
(let ((s4-1 (min (length arg0) (length arg1))))
|
|
(dotimes (v1-4 s4-1)
|
|
(cond
|
|
((< (-> arg0 data v1-4) (-> arg1 data v1-4))
|
|
(return #f)
|
|
)
|
|
((< (-> arg1 data v1-4) (-> arg0 data v1-4))
|
|
(return #t)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
#t
|
|
)
|
|
|
|
;; definition for symbol *string-tmp-str*, type string
|
|
(define *string-tmp-str* (new 'global 'string 128 (the-as string #f)))
|
|
|
|
;; definition for function string-skip-to-char
|
|
(defun string-skip-to-char ((arg0 (pointer uint8)) (arg1 uint))
|
|
(while (and (nonzero? (-> arg0 0)) (!= (-> arg0 0) arg1))
|
|
(set! arg0 (&-> arg0 1))
|
|
)
|
|
arg0
|
|
)
|
|
|
|
;; definition for function string-cat-to-last-char
|
|
(defun string-cat-to-last-char ((arg0 string) (arg1 string) (arg2 uint))
|
|
(let ((s4-0 (&-> (the-as (pointer uint8) arg1) 3)))
|
|
(let ((v1-0 (string-skip-to-char (-> arg1 data) arg2)))
|
|
(when (= (-> v1-0 0) arg2)
|
|
(until (!= (-> v1-0 0) arg2)
|
|
(set! s4-0 v1-0)
|
|
(set! v1-0 (string-skip-to-char (&-> v1-0 1) arg2))
|
|
)
|
|
)
|
|
)
|
|
(cat-string<-string_to_charp arg0 arg1 s4-0)
|
|
)
|
|
)
|
|
|
|
;; definition for function string-skip-whitespace
|
|
(defun string-skip-whitespace ((arg0 (pointer uint8)))
|
|
(while (and (nonzero? (-> arg0 0)) (or (= (-> arg0 0) 32) (= (-> arg0 0) 9) (= (-> arg0 0) 13) (= (-> arg0 0) 10)))
|
|
(set! arg0 (&-> arg0 1))
|
|
)
|
|
arg0
|
|
)
|
|
|
|
;; definition for function string-suck-up!
|
|
(defun string-suck-up! ((arg0 string) (arg1 (pointer uint8)))
|
|
(when (!= arg1 (-> arg0 data))
|
|
(let ((v1-2 (-> arg0 data)))
|
|
(while (nonzero? (-> arg1 0))
|
|
(set! (-> v1-2 0) (-> arg1 0))
|
|
(set! v1-2 (&-> v1-2 1))
|
|
(set! arg1 (&-> arg1 1))
|
|
)
|
|
(set! (-> v1-2 0) (the-as uint 0))
|
|
)
|
|
0
|
|
)
|
|
#f
|
|
)
|
|
|
|
;; definition for function string-strip-leading-whitespace!
|
|
(defun string-strip-leading-whitespace! ((arg0 string))
|
|
(let ((a1-0 (string-skip-whitespace (-> arg0 data))))
|
|
(string-suck-up! arg0 a1-0)
|
|
)
|
|
#f
|
|
)
|
|
|
|
;; definition for function string-strip-trailing-whitespace!
|
|
(defun string-strip-trailing-whitespace! ((arg0 string))
|
|
(when (nonzero? (length arg0))
|
|
(let ((v1-6 (&+ (-> arg0 data) (+ (length arg0) -1))))
|
|
(while (and (>= (the-as int v1-6) (the-as int (-> arg0 data)))
|
|
(or (= (-> v1-6 0) 32) (= (-> v1-6 0) 9) (= (-> v1-6 0) 13) (= (-> v1-6 0) 10))
|
|
)
|
|
(set! v1-6 (&-> v1-6 -1))
|
|
)
|
|
(set! (-> v1-6 1) (the-as uint 0))
|
|
)
|
|
0
|
|
)
|
|
#f
|
|
)
|
|
|
|
;; definition for function string-strip-whitespace!
|
|
(defun string-strip-whitespace! ((arg0 string))
|
|
(string-strip-trailing-whitespace! arg0)
|
|
(string-strip-leading-whitespace! arg0)
|
|
#f
|
|
)
|
|
|
|
;; definition for function string-upcase
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defun string-upcase ((arg0 string) (arg1 string))
|
|
(let* ((a0-1 (-> arg0 data))
|
|
(a3-0 (-> a0-1 0))
|
|
(a2-0 1)
|
|
(v1-0 0)
|
|
)
|
|
(while (nonzero? a3-0)
|
|
(if (and (>= a3-0 (the-as uint 97)) (>= (the-as uint 122) a3-0))
|
|
(+! a3-0 -32)
|
|
)
|
|
(set! (-> arg1 data v1-0) a3-0)
|
|
(set! a3-0 (-> a0-1 a2-0))
|
|
(+! a2-0 1)
|
|
(+! v1-0 1)
|
|
)
|
|
(set! (-> arg1 data v1-0) (the-as uint 0))
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for function string-get-arg!!
|
|
(defun string-get-arg!! ((arg0 string) (arg1 string))
|
|
(let ((s4-0 (string-skip-whitespace (-> arg1 data))))
|
|
(cond
|
|
((= (-> s4-0 0) 34)
|
|
(let ((s4-1 (&-> s4-0 1)))
|
|
(let ((v1-3 s4-1))
|
|
(while (and (nonzero? (-> s4-1 0)) (!= (-> s4-1 0) 34))
|
|
(set! s4-1 (&-> s4-1 1))
|
|
)
|
|
(copyn-string<-charp arg0 v1-3 (&- s4-1 (the-as uint v1-3)))
|
|
)
|
|
(if (= (-> s4-1 0) 34)
|
|
(set! s4-1 (&-> s4-1 1))
|
|
)
|
|
(let ((a1-3 (string-skip-whitespace s4-1)))
|
|
(string-suck-up! arg1 a1-3)
|
|
)
|
|
)
|
|
(return #t)
|
|
)
|
|
((nonzero? (-> s4-0 0))
|
|
(let ((v1-11 s4-0))
|
|
(while (and (nonzero? (-> s4-0 0)) (!= (-> s4-0 0) 32) (!= (-> s4-0 0) 9) (!= (-> s4-0 0) 13) (!= (-> s4-0 0) 10))
|
|
(set! s4-0 (&-> s4-0 1))
|
|
)
|
|
(copyn-string<-charp arg0 v1-11 (&- s4-0 (the-as uint v1-11)))
|
|
)
|
|
(let ((a1-9 (string-skip-whitespace s4-0)))
|
|
(string-suck-up! arg1 a1-9)
|
|
)
|
|
(return #t)
|
|
)
|
|
)
|
|
)
|
|
#f
|
|
)
|
|
|
|
;; definition for function string->int
|
|
(defun string->int ((arg0 string))
|
|
(let ((a0-1 (-> arg0 data))
|
|
(v0-0 0)
|
|
(v1-0 #f)
|
|
)
|
|
(cond
|
|
((= (-> a0-1 0) 35)
|
|
(let ((a0-2 (&-> a0-1 1)))
|
|
(cond
|
|
((or (= (-> a0-2 0) 120) (= (-> a0-2 0) 88))
|
|
(let ((a0-3 (&-> a0-2 1)))
|
|
(when (= (-> a0-3 1) 45)
|
|
(set! v1-0 #t)
|
|
(set! a0-3 (&-> a0-3 1))
|
|
)
|
|
(while (or (and (>= (-> a0-3 0) (the-as uint 48)) (>= (the-as uint 57) (-> a0-3 0)))
|
|
(and (>= (-> a0-3 0) (the-as uint 65)) (>= (the-as uint 70) (-> a0-3 0)))
|
|
(and (>= (-> a0-3 0) (the-as uint 97)) (>= (the-as uint 102) (-> a0-3 0)))
|
|
)
|
|
(cond
|
|
((and (>= (-> a0-3 0) (the-as uint 65)) (>= (the-as uint 70) (-> a0-3 0)))
|
|
(set! v0-0 (the-as int (+ (-> a0-3 0) -55 (* v0-0 16))))
|
|
)
|
|
((and (>= (-> a0-3 0) (the-as uint 97)) (>= (the-as uint 102) (-> a0-3 0)))
|
|
(set! v0-0 (the-as int (+ (-> a0-3 0) -87 (* v0-0 16))))
|
|
)
|
|
(else
|
|
(set! v0-0 (the-as int (+ (-> a0-3 0) -48 (* v0-0 16))))
|
|
)
|
|
)
|
|
(set! a0-3 (&-> a0-3 1))
|
|
)
|
|
)
|
|
)
|
|
((or (= (-> a0-2 0) 98) (= (-> a0-2 0) 66))
|
|
(let ((a0-4 (&-> a0-2 1)))
|
|
(while (and (>= (-> a0-4 0) (the-as uint 48)) (>= (the-as uint 49) (-> a0-4 0)))
|
|
(set! v0-0 (the-as int (+ (-> a0-4 0) -48 (* v0-0 2))))
|
|
(set! a0-4 (&-> a0-4 1))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(when (= (-> a0-1 1) 45)
|
|
(set! v1-0 #t)
|
|
(set! a0-1 (&-> a0-1 1))
|
|
)
|
|
(while (and (>= (-> a0-1 0) (the-as uint 48)) (>= (the-as uint 57) (-> a0-1 0)))
|
|
(set! v0-0 (the-as int (+ (-> a0-1 0) -48 (* 10 v0-0))))
|
|
(set! a0-1 (&-> a0-1 1))
|
|
)
|
|
)
|
|
)
|
|
(cond
|
|
(v1-0
|
|
(- v0-0)
|
|
)
|
|
(else
|
|
(empty)
|
|
v0-0
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for function string->float
|
|
(defun string->float ((arg0 string))
|
|
(let ((a0-1 (-> arg0 data))
|
|
(f0-0 0.0)
|
|
(v1-0 #f)
|
|
)
|
|
(when (= (-> a0-1 0) 45)
|
|
(set! v1-0 #t)
|
|
(set! a0-1 (&-> a0-1 1))
|
|
)
|
|
(while (and (>= (-> a0-1 0) (the-as uint 48)) (>= (the-as uint 57) (-> a0-1 0)))
|
|
(set! f0-0 (+ (* 10.0 f0-0) (the float (+ (-> a0-1 0) -48))))
|
|
(set! a0-1 (&-> a0-1 1))
|
|
)
|
|
(when (= (-> a0-1 0) 46)
|
|
(set! a0-1 (&-> a0-1 1))
|
|
(let ((a2-4 #xf4240)
|
|
(a1-12 0)
|
|
)
|
|
(while (and (>= (-> a0-1 0) (the-as uint 48)) (>= (the-as uint 57) (-> a0-1 0)))
|
|
(+! a1-12 (* (+ (-> a0-1 0) -48) (the-as uint a2-4)))
|
|
(set! a2-4 (/ a2-4 10))
|
|
(set! a0-1 (&-> a0-1 1))
|
|
)
|
|
(+! f0-0 (* 0.0000001 (the float a1-12)))
|
|
)
|
|
)
|
|
(when (= (-> a0-1 0) 101)
|
|
(let ((a1-16 (&-> a0-1 1))
|
|
(f1-5 0.0)
|
|
(a0-2 #f)
|
|
)
|
|
(cond
|
|
((= (-> a1-16 0) 45)
|
|
(set! a0-2 #t)
|
|
(set! a1-16 (&-> a1-16 1))
|
|
)
|
|
((= (-> a1-16 0) 43)
|
|
(set! a1-16 (&-> a1-16 1))
|
|
)
|
|
)
|
|
(while (and (>= (-> a1-16 0) (the-as uint 48)) (>= (the-as uint 57) (-> a1-16 0)))
|
|
(set! f1-5 (+ (* 10.0 f1-5) (the float (+ (-> a1-16 0) -48))))
|
|
(set! a1-16 (&-> a1-16 1))
|
|
)
|
|
(when (!= f1-5 0.0)
|
|
(let ((f2-6 1.0))
|
|
(cond
|
|
(a0-2
|
|
(dotimes (a0-3 (the int f1-5))
|
|
(set! f2-6 (* 0.1 f2-6))
|
|
(nop!)
|
|
(nop!)
|
|
)
|
|
)
|
|
(else
|
|
(dotimes (a0-6 (the int f1-5))
|
|
(set! f2-6 (* 10.0 f2-6))
|
|
(nop!)
|
|
(nop!)
|
|
)
|
|
)
|
|
)
|
|
(set! f0-0 (* f0-0 f2-6))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(if v1-0
|
|
(- f0-0)
|
|
f0-0
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for function string-get-int32!!
|
|
(defun string-get-int32!! ((arg0 (pointer int32)) (arg1 string))
|
|
(cond
|
|
((string-get-arg!! *string-tmp-str* arg1)
|
|
(set! (-> arg0 0) (string->int *string-tmp-str*))
|
|
#t
|
|
)
|
|
(else
|
|
#f
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for function string-get-float!!
|
|
(defun string-get-float!! ((arg0 (pointer float)) (arg1 string))
|
|
(cond
|
|
((string-get-arg!! *string-tmp-str* arg1)
|
|
(set! (-> arg0 0) (string->float *string-tmp-str*))
|
|
#t
|
|
)
|
|
(else
|
|
#f
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for function string-get-flag!!
|
|
(defun string-get-flag!! ((arg0 (pointer symbol)) (arg1 string) (arg2 string) (arg3 string))
|
|
(cond
|
|
((string-get-arg!! *string-tmp-str* arg1)
|
|
(cond
|
|
((or (string= *string-tmp-str* arg2) (string= *string-tmp-str* arg3))
|
|
(set! (-> arg0 0) (string= *string-tmp-str* arg2))
|
|
#t
|
|
)
|
|
(else
|
|
#f
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
#f
|
|
)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(kmemopen global "gstring-globals")
|
|
|
|
;; definition for symbol *debug-draw-pauseable*, type symbol
|
|
(define *debug-draw-pauseable* #f)
|
|
|
|
;; definition for symbol *stdcon0*, type string
|
|
(define *stdcon0* (new 'global 'string #x4000 (the-as string #f)))
|
|
|
|
;; definition for symbol *stdcon1*, type string
|
|
(define *stdcon1* (new 'global 'string #x4000 (the-as string #f)))
|
|
|
|
;; definition for symbol *stdcon*, type string
|
|
(define *stdcon* *stdcon0*)
|
|
|
|
;; definition for symbol *temp-string*, type string
|
|
(define *temp-string* (new 'global 'string 2048 (the-as string #f)))
|
|
|
|
;; failed to figure out what this is:
|
|
(kmemclose)
|