Ticket #486: test.pir

File test.pir, 0.9 KB (added by bsdz, 6 years ago)
Line 
1.include 'datatypes.pasm'
2
3.sub main :main
4
5    # a workaround is to set this to min(2,size)
6    .local int size
7    size = 1
8
9    .local pmc a_rma, a_umc, a_n
10    a_rma = new 'ResizablePMCArray'
11    push a_rma, .DATATYPE_DOUBLE
12    push a_rma, 0
13    push a_rma, 0
14    push a_rma, .DATATYPE_DOUBLE
15    push a_rma, 0
16    push a_rma, 0
17    a_umc = new 'UnManagedStruct', a_rma
18
19    .local pmc a_rma_outer
20    a_rma_outer = new 'ResizablePMCArray'
21    push a_rma_outer, .DATATYPE_STRUCT
22    $P0 = a_rma_outer[-1]
23    setprop $P0, "_struct", a_umc
24    push a_rma_outer, size
25    push a_rma_outer, 0
26
27    a_n = new 'ManagedStruct', a_rma_outer
28
29    a_n[0;0;0] = 10.5
30    a_n[0;0;1] = 20.2
31
32    # if size = 2,3,4 then okay
33
34    #a_n[0;1;0] = 10.5
35    #a_n[0;1;1] = 20.2
36
37    #a_n[0;2;0] = 10.5
38    #a_n[0;2;1] = 20.2
39
40    #a_n[0;3;0] = 10.5
41    #a_n[0;3;1] = 20.2
42
43.end
44
45# Local Variables:
46#   mode: pir
47#   fill-column: 100
48# End:
49# vim: expandtab shiftwidth=4 ft=pir:
50