Change syntax for boxed array to support different length and allocated-length (#568)

* change syntax for boxed array

* fix test and make the flava thing kind of work
This commit is contained in:
water111
2021-06-07 20:22:06 -04:00
committed by GitHub
parent f516737cf7
commit 5b24e43143
20 changed files with 197 additions and 106 deletions
@@ -36,8 +36,7 @@
(new
'static
'boxed-array
vif-disasm-element
34
:type vif-disasm-element :length 34 :allocated-length 34
(new 'static 'vif-disasm-element :mask #x7f :string1 "nop")
(new 'static 'vif-disasm-element
:mask #x7f
@@ -26,8 +26,7 @@
(new
'static
'boxed-array
uint8
32
:type uint8 :length 32 :allocated-length 32
#x2
#x5
#x2
@@ -98,7 +97,3 @@
63
)
)
@@ -4,13 +4,17 @@
;; definition for symbol EulSafe, type (array int32)
(define
EulSafe
(the-as (array int32) (new 'static 'boxed-array int32 4 0 1 2 0))
(the-as (array int32)
(new 'static 'boxed-array :type int32 :length 4 :allocated-length 4 0 1 2 0)
)
)
;; definition for symbol EulNext, type (array int32)
(define
EulNext
(the-as (array int32) (new 'static 'boxed-array int32 4 1 2 0 1))
(the-as (array int32)
(new 'static 'boxed-array :type int32 :length 4 :allocated-length 4 1 2 0 1)
)
)
;; definition of type euler-angles
@@ -37,7 +41,3 @@
;; failed to figure out what this is:
(let ((v0-1 0))
)
@@ -92,8 +92,7 @@
(new
'static
'boxed-array
float
32
:type float :length 32 :allocated-length 32
1.0
0.5
0.25
@@ -137,8 +136,7 @@
(new
'static
'boxed-array
float
32
:type float :length 32 :allocated-length 32
0.7853982
0.4636476
0.24497867
@@ -35,7 +35,19 @@
(define
*title-credits-scale*
(the-as (array float)
(new 'static 'boxed-array float 8 0.9 0.9 0.6 0.6 1.0 0.9 1.1 0.9)
(new
'static
'boxed-array
:type float :length 8 :allocated-length 8
0.9
0.9
0.6
0.6
1.0
0.9
1.1
0.9
)
)
)
@@ -43,7 +55,19 @@
(define
*title-credits-spacing*
(the-as (array int32)
(new 'static 'boxed-array int32 8 15 20 15 15 20 15 20 15)
(new
'static
'boxed-array
:type int32 :length 8 :allocated-length 8
15
20
15
15
20
15
20
15
)
)
)
@@ -196,7 +220,3 @@
)
)
)
@@ -48,7 +48,14 @@
;; definition for symbol *text-group-names*, type (array string)
(define
*text-group-names*
(the-as (array string) (new 'static 'boxed-array string 1 "common"))
(the-as (array string)
(new
'static
'boxed-array
:type string :length 1 :allocated-length 1
"common"
)
)
)
;; definition for symbol *common-text-heap*, type kheap
+6 -1
View File
@@ -210,7 +210,12 @@ TEST_F(DataDecompTest, VifDisasmArray) {
auto decomp =
decompile_at_label_guess_type(parsed.label("L148"), parsed.labels, {parsed.words}, dts->ts);
check_forms_equal(decomp.print(),
"(new 'static 'boxed-array vif-disasm-element 3\n"
"(new 'static 'boxed-array :type\n"
" vif-disasm-element\n"
" :length\n"
" 3\n"
" :allocated-length\n"
" 3\n"
" (new 'static 'vif-disasm-element :mask #x7f :string1 \"nop\")\n"
" (new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 stcycl) :print "
"#x2 :string1 \"stcycl\")\n"
@@ -21,11 +21,11 @@
(format #t "int: ~d~%" obj)
obj)
(let ((test-arr (new 'static 'boxed-array test-bitfield 12)))
(let ((test-arr (new 'static 'boxed-array :type test-bitfield :length 12)))
(format #t "content type: ~A~%" (-> test-arr content-type))
)
(let ((test-arr (new 'static 'boxed-array test-enum 12)))
(let ((test-arr (new 'static 'boxed-array :type test-enum :length 12)))
(format #t "content type: ~A~%" (-> test-arr content-type))
)
@@ -1,4 +1,4 @@
(let ((arr (new 'static 'boxed-array object 12 32 'asdf "test" '( a b ))))
(let ((arr (new 'static 'boxed-array :type object :length 12 32 'asdf "test" '( a b ))))
(dotimes (i 5)
(format #t "~A " (-> arr i))
)