(bind-func ai_find_matching_node:[aiNode*,aiNode*,aiString*]*
(lambda (node search_str)
;; (println 'aifn (cast node i8*) (cast search_str i8*)) ;search_str) ;; (cast node i8*))
(if (null? node)
null
(if (match_aiString (tref-ptr node 0) search_str)
node
(let ((num (tref node 3))
(i:i32 0)
(children (tref node 4))
(match:aiNode* null))
(while (and (null? match) (< i num))
(set! match (ai_find_matching_node (pref children i) search_str))
(set! i (+ i 1)))
match)))))