mirror of
https://github.com/open-goal/jak-project
synced 2026-09-10 04:22:13 -04:00
support anonymous functions (#323)
This commit is contained in:
@@ -68,4 +68,7 @@
|
||||
(define-extern *camera-pool* process-tree)
|
||||
(define-extern *target-pool* process-tree)
|
||||
(define-extern *entity-pool* process-tree)
|
||||
(define-extern *default-pool* process-tree)
|
||||
(define-extern *default-pool* process-tree)
|
||||
(define-extern *stdcon0* string)
|
||||
(define-extern *stdcon1* string)
|
||||
(define-extern *debug-draw-pauseable* symbol)
|
||||
@@ -1160,13 +1160,19 @@
|
||||
;; definition for function process-by-name
|
||||
(defun process-by-name ((arg0 object) (arg1 process-tree))
|
||||
(set! *global-search-name* (the-as basic arg0))
|
||||
(search-process-tree arg1 (the-as (function process-tree object) L139))
|
||||
(search-process-tree
|
||||
arg1
|
||||
(lambda ((a0-0 process)) (name= (-> a0-0 name) *global-search-name*))
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function process-not-name
|
||||
(defun process-not-name ((arg0 object) (arg1 process-tree))
|
||||
(set! *global-search-name* (the-as basic arg0))
|
||||
(search-process-tree arg1 (the-as (function process-tree object) L136))
|
||||
(search-process-tree
|
||||
arg1
|
||||
(lambda ((a0-0 process)) (not (name= (-> a0-0 name) *global-search-name*)))
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function process-count
|
||||
@@ -1174,7 +1180,11 @@
|
||||
(set! *global-search-count* 0)
|
||||
(iterate-process-tree
|
||||
arg0
|
||||
(the-as (function object object) L134)
|
||||
(lambda
|
||||
((a0-0 process))
|
||||
(set! *global-search-count* (+ *global-search-count* 1))
|
||||
#t
|
||||
)
|
||||
*null-kernel-context*
|
||||
)
|
||||
*global-search-count*
|
||||
@@ -1203,7 +1213,7 @@
|
||||
((v0-0
|
||||
(search-process-tree
|
||||
arg1
|
||||
(the-as (function process-tree object) L129)
|
||||
(lambda ((a0-0 process)) (= (-> a0-0 type) *global-search-name*))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -1239,7 +1249,7 @@
|
||||
((v0-0
|
||||
(search-process-tree
|
||||
arg1
|
||||
(the-as (function process-tree object) L122)
|
||||
(lambda ((a0-0 process)) (!= (-> a0-0 type) *global-search-name*))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -1362,7 +1372,98 @@
|
||||
)
|
||||
(execute-process-tree
|
||||
*active-pool*
|
||||
(the-as (function object object) L86)
|
||||
(lambda ((a0-0 process)) (let ((s5-0 *kernel-context*)
|
||||
(v1-0 (-> a0-0 status))
|
||||
)
|
||||
(cond
|
||||
((or (= v1-0 'waiting-to-run) (= v1-0 'suspended))
|
||||
(set! (-> s5-0 current-process) a0-0)
|
||||
(cond
|
||||
((nonzero? (logand (-> a0-0 mask) 4))
|
||||
(set! *stdcon* *stdcon1*)
|
||||
(set! *debug-draw-pauseable* #t)
|
||||
)
|
||||
(else
|
||||
(set! *stdcon* *stdcon0*)
|
||||
(set! *debug-draw-pauseable* #f)
|
||||
)
|
||||
)
|
||||
(when (-> a0-0 trans-hook)
|
||||
(let*
|
||||
((s4-0
|
||||
(new
|
||||
'process
|
||||
'cpu-thread
|
||||
a0-0
|
||||
'trans
|
||||
256
|
||||
(-> a0-0 main-thread stack-top)
|
||||
)
|
||||
)
|
||||
(v0-1
|
||||
(reset-and-call s4-0 (-> a0-0 trans-hook))
|
||||
)
|
||||
)
|
||||
(delete s4-0)
|
||||
(let ((v1-12 v0-1))
|
||||
)
|
||||
)
|
||||
(if (= (-> a0-0 status) 'dead)
|
||||
(return (begin
|
||||
(set! (-> s5-0 current-process) #f)
|
||||
'dead
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if (nonzero? (logand (-> a0-0 mask) 128))
|
||||
(set! (-> a0-0 status) 'suspended)
|
||||
((-> a0-0 main-thread resume-hook)
|
||||
(-> a0-0 main-thread)
|
||||
)
|
||||
)
|
||||
(cond
|
||||
((= (-> a0-0 status) 'dead)
|
||||
(set! (-> s5-0 current-process) #f)
|
||||
'dead
|
||||
)
|
||||
(else
|
||||
(when (-> a0-0 post-hook)
|
||||
(let
|
||||
((s4-1
|
||||
(new
|
||||
'process
|
||||
'cpu-thread
|
||||
a0-0
|
||||
'post
|
||||
256
|
||||
(&-> *dram-stack* 14336)
|
||||
)
|
||||
)
|
||||
)
|
||||
(reset-and-call s4-1 (-> a0-0 post-hook))
|
||||
(delete s4-1)
|
||||
)
|
||||
(if (= (-> a0-0 status) 'dead)
|
||||
(return (begin
|
||||
(set! (-> s5-0 current-process) #f)
|
||||
'dead
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> a0-0 status) 'suspended)
|
||||
)
|
||||
(set! (-> s5-0 current-process) #f)
|
||||
#f
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-0 'dead)
|
||||
'dead
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
*kernel-context*
|
||||
)
|
||||
)
|
||||
|
||||
@@ -67,9 +67,6 @@ const std::unordered_set<std::string> skip_in_compiling = {
|
||||
//////////////////////
|
||||
// GKERNEL
|
||||
//////////////////////
|
||||
// these refer to anonymous functions, which aren't yet implemented.
|
||||
"process-by-name", "process-not-name", "process-count", "kill-by-type", "kill-not-type",
|
||||
"kill-by-name", "kill-not-name", "kernel-dispatcher",
|
||||
|
||||
// asm
|
||||
"(method 10 process)"
|
||||
|
||||
Reference in New Issue
Block a user