Mercurial > repos > rhope
annotate test/fib.c @ 138:1411de6050e1
First stab at transaction data structures, needs work
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 16 Nov 2010 21:53:18 -0500 |
parents | d4b44ae2e34a |
children |
rev | line source |
---|---|
11
3021dac0d8f5
Stack unwind is so close I can almost taste it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 #include <stdio.h> |
3021dac0d8f5
Stack unwind is so close I can almost taste it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
2 #include "builtin.h" |
3021dac0d8f5
Stack unwind is so close I can almost taste it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 #include "object.h" |
3021dac0d8f5
Stack unwind is so close I can almost taste it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
4 #include "context.h" |
3021dac0d8f5
Stack unwind is so close I can almost taste it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
5 #include "func.h" |
12
31f8182f3433
Finished fib test and did some small work on the c backend
Mike Pavone <pavone@retrodev.com>
parents:
11
diff
changeset
|
6 #include "integer.h" |
66
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
7 #include "bool.h" |
11
3021dac0d8f5
Stack unwind is so close I can almost taste it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
8 |
66
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
9 typedef enum { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
10 FUNC__LT_, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
11 FUNC__LT__AT_Int32, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
12 FUNC__MN_, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
13 FUNC__MN__AT_Int32, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
14 FUNC__PL_, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
15 FUNC__PL__AT_Int32, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
16 FUNC_Fib, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
17 FUNC_Fib_1, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
18 FUNC_Fib_2, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
19 FUNC_Fib_3, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
20 FUNC_Fib_4, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
21 FUNC_Fib_5, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
22 FUNC_Fib_6, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
23 FUNC_If, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
24 FUNC_If_AT_Yes_SP_No, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
25 FUNC_Main, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
26 FUNC_Main_1, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
27 FUNC_Main_2, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
28 FUNC_Print, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
29 END |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
30 } funcids; |
11
3021dac0d8f5
Stack unwind is so close I can almost taste it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
31 |
66
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
32 #define DISPATCH switch(func) { \ |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
33 case FUNC__LT_: goto f__LT_;\ |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
34 case FUNC__LT__AT_Int32: goto f__LT__AT_Int32;\ |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
35 case FUNC__MN_: goto f__MN_;\ |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
36 case FUNC__MN__AT_Int32: goto f__MN__AT_Int32;\ |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
37 case FUNC__PL_: goto f__PL_;\ |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
38 case FUNC__PL__AT_Int32: goto f__PL__AT_Int32;\ |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
39 case FUNC_Fib: goto f_Fib;\ |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
40 case FUNC_Fib_1: goto r1_Fib;\ |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
41 case FUNC_Fib_2: goto r2_Fib;\ |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
42 case FUNC_Fib_3: goto r3_Fib;\ |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
43 case FUNC_Fib_4: goto r4_Fib;\ |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
44 case FUNC_Fib_5: goto r5_Fib;\ |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
45 case FUNC_Fib_6: goto r6_Fib;\ |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
46 case FUNC_If: goto f_If;\ |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
47 case FUNC_If_AT_Yes_SP_No: goto f_If_AT_Yes_SP_No;\ |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
48 case FUNC_Main: goto f_Main;\ |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
49 case FUNC_Main_1: goto r1_Main;\ |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
50 case FUNC_Main_2: goto r2_Main;\ |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
51 case FUNC_Print: goto f_Print;\ |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
52 case END: goto DO_END;\ |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
53 } |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
54 |
11
3021dac0d8f5
Stack unwind is so close I can almost taste it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
55 |
66
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
56 typedef struct { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
57 struct object *____result__0__0; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
58 struct object *____result__0__1; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
59 struct object *____result__10__0; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
60 struct object *____result__11__0; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
61 struct object *____result__1__0; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
62 struct object *____result__5__0; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
63 struct object *____result__6__0; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
64 struct object *____result__7__0; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
65 struct object *out; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
66 } lt_Fib; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
67 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
68 typedef struct { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
69 struct object *____result__0__0; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
70 struct object *____result__1__0; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
71 } lt_Main; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
72 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
73 object * _const_Whole_SP_Number__1; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
74 object * _const_Whole_SP_Number__2; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
75 object * _const_Whole_SP_Number__30; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
76 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
77 void rhope(uint32_t func) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
78 { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
79 uint16_t resume,idx; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
80 context * ct; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
81 calldata * cdata, *temp_cdata; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
82 FuncDef(Fib) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
83 FuncDef(Main) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
84 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
85 ct = new_context(); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
86 cdata = alloc_cdata(ct, NULL, 0); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
87 cdata->num_params = 0; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
88 cdata->func = END; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
89 DISPATCH |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
90 Method(_LT_) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
91 MethodDispatch(TYPE_INT32,_LT_,Int32) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
92 EndMethod |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
93 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
94 MethodImplNoLocals(_LT_,Int32,TYPE_INT32, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
95 NumParams 2) |
12
31f8182f3433
Finished fib test and did some small work on the c backend
Mike Pavone <pavone@retrodev.com>
parents:
11
diff
changeset
|
96 |
66
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
97 Param(1, TYPE_INT32) |
12
31f8182f3433
Finished fib test and did some small work on the c backend
Mike Pavone <pavone@retrodev.com>
parents:
11
diff
changeset
|
98 |
66
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
99 if(((t_Int32 *)cdata->params[0])->num < ((t_Int32 *)cdata->params[-1])->num) |
15
b71bab34ec65
Added forgotten release_ref to fib test
Mike Pavone <pavone@retrodev.com>
parents:
12
diff
changeset
|
100 { |
66
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
101 release_ref(cdata->params[0]); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
102 Ret(0, Yes) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
103 } else { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
104 release_ref(cdata->params[0]); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
105 Ret(0, No) |
15
b71bab34ec65
Added forgotten release_ref to fib test
Mike Pavone <pavone@retrodev.com>
parents:
12
diff
changeset
|
106 } |
12
31f8182f3433
Finished fib test and did some small work on the c backend
Mike Pavone <pavone@retrodev.com>
parents:
11
diff
changeset
|
107 |
66
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
108 release_ref(cdata->params[-1]); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
109 EndFuncNoLocals |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
110 DISPATCH |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
111 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
112 Method(_MN_) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
113 MethodDispatch(TYPE_INT32,_MN_,Int32) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
114 EndMethod |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
115 DISPATCH |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
116 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
117 MethodImplNoLocals(_MN_,Int32,TYPE_INT32, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
118 NumParams 2) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
119 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
120 Param(1, TYPE_INT32) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
121 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
122 cdata->params[0] = copy_object(cdata->params[0]); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
123 ((t_Int32 *)cdata->params[0])->num -= ((t_Int32 *)cdata->params[-1])->num; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
124 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
125 release_ref(cdata->params[-1]); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
126 EndFuncNoLocals |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
127 DISPATCH |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
128 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
129 Method(_PL_) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
130 MethodDispatch(TYPE_INT32,_PL_,Int32) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
131 EndMethod |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
132 DISPATCH |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
133 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
134 MethodImplNoLocals(_PL_,Int32,TYPE_INT32, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
135 NumParams 2) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
136 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
137 Param(1, TYPE_INT32) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
138 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
139 cdata->params[0] = copy_object(cdata->params[0]); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
140 ((t_Int32 *)cdata->params[0])->num += ((t_Int32 *)cdata->params[-1])->num; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
141 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
142 release_ref(cdata->params[-1]); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
143 EndFuncNoLocals |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
144 DISPATCH |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
145 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
146 Func(Fib, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
147 NumParams 1) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
148 lv_Fib->____result__0__0 = NULL; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
149 lv_Fib->____result__0__1 = NULL; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
150 lv_Fib->____result__1__0 = NULL; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
151 lv_Fib->____result__5__0 = NULL; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
152 lv_Fib->____result__6__0 = NULL; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
153 lv_Fib->____result__7__0 = NULL; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
154 lv_Fib->____result__10__0 = NULL; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
155 lv_Fib->____result__11__0 = NULL; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
156 lv_Fib->out = NULL; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
157 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
158 PrepCall(2) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
159 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
160 SetParam(0, add_ref(cdata->lastframe->params[0])) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
161 SetParam(1, add_ref(_const_Whole_SP_Number__2)) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
162 Call(_LT_, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
163 NumParams 2, 1, Fib) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
164 lv_Fib->____result__1__0 = cdata->params[0]; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
165 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
166 SetParam(0, add_ref(lv_Fib->____result__1__0)) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
167 Call(If, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
168 NumParams 1, 2, Fib) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
169 lv_Fib->____result__0__0 = cdata->params[0]; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
170 lv_Fib->____result__0__1 = cdata->params[-1]; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
171 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
172 if(lv_Fib->____result__0__1) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
173 { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
174 SetParam(0, add_ref(cdata->lastframe->params[0])) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
175 SetParam(1, add_ref(_const_Whole_SP_Number__1)) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
176 Call(_MN_, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
177 NumParams 2, 3, Fib) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
178 lv_Fib->____result__7__0 = cdata->params[0]; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
179 } |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
180 if(lv_Fib->____result__0__1) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
181 { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
182 SetParam(0, add_ref(cdata->lastframe->params[0])) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
183 SetParam(1, add_ref(_const_Whole_SP_Number__2)) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
184 Call(_MN_, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
185 NumParams 2, 4, Fib) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
186 lv_Fib->____result__11__0 = cdata->params[0]; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
187 } |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
188 if(lv_Fib->____result__0__0) |
12
31f8182f3433
Finished fib test and did some small work on the c backend
Mike Pavone <pavone@retrodev.com>
parents:
11
diff
changeset
|
189 { |
66
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
190 lv_Fib->out = add_ref(_const_Whole_SP_Number__1); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
191 } |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
192 if(lv_Fib->____result__0__1) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
193 { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
194 SetParam(0, add_ref(lv_Fib->____result__7__0)) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
195 Call(Fib, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
196 NumParams 1, 5, Fib) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
197 lv_Fib->____result__6__0 = cdata->params[0]; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
198 } |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
199 if(lv_Fib->____result__0__1) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
200 { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
201 SetParam(0, add_ref(lv_Fib->____result__11__0)) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
202 Call(Fib, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
203 NumParams 1, 6, Fib) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
204 lv_Fib->____result__10__0 = cdata->params[0]; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
205 } |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
206 if(lv_Fib->____result__0__1) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
207 { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
208 if(lv_Fib->____result__0__0) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
209 { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
210 release_ref(lv_Fib->____result__0__0); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
211 } |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
212 if(lv_Fib->____result__0__1) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
213 { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
214 release_ref(lv_Fib->____result__0__1); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
215 } |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
216 if(lv_Fib->____result__1__0) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
217 { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
218 release_ref(lv_Fib->____result__1__0); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
219 } |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
220 if(lv_Fib->____result__7__0) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
221 { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
222 release_ref(lv_Fib->____result__7__0); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
223 } |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
224 if(lv_Fib->____result__11__0) |
12
31f8182f3433
Finished fib test and did some small work on the c backend
Mike Pavone <pavone@retrodev.com>
parents:
11
diff
changeset
|
225 { |
66
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
226 release_ref(lv_Fib->____result__11__0); |
12
31f8182f3433
Finished fib test and did some small work on the c backend
Mike Pavone <pavone@retrodev.com>
parents:
11
diff
changeset
|
227 } |
66
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
228 TPrepCall(2) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
229 SetParam(0, lv_Fib->____result__6__0) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
230 SetParam(1, lv_Fib->____result__10__0) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
231 TCall(_PL_, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
232 NumParams 2) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
233 //lv_Fib->____result__5__0 = cdata->params[0]; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
234 } |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
235 FreeCall |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
236 if(lv_Fib->____result__0__1) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
237 { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
238 lv_Fib->out = add_ref(lv_Fib->____result__5__0); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
239 } |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
240 if(lv_Fib->____result__0__0) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
241 { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
242 release_ref(lv_Fib->____result__0__0); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
243 } |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
244 if(lv_Fib->____result__0__1) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
245 { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
246 release_ref(lv_Fib->____result__0__1); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
247 } |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
248 if(lv_Fib->____result__1__0) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
249 { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
250 release_ref(lv_Fib->____result__1__0); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
251 } |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
252 if(lv_Fib->____result__5__0) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
253 { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
254 release_ref(lv_Fib->____result__5__0); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
255 } |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
256 if(lv_Fib->____result__6__0) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
257 { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
258 release_ref(lv_Fib->____result__6__0); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
259 } |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
260 if(lv_Fib->____result__7__0) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
261 { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
262 release_ref(lv_Fib->____result__7__0); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
263 } |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
264 if(lv_Fib->____result__10__0) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
265 { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
266 release_ref(lv_Fib->____result__10__0); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
267 } |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
268 if(lv_Fib->____result__11__0) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
269 { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
270 release_ref(lv_Fib->____result__11__0); |
12
31f8182f3433
Finished fib test and did some small work on the c backend
Mike Pavone <pavone@retrodev.com>
parents:
11
diff
changeset
|
271 } |
31f8182f3433
Finished fib test and did some small work on the c backend
Mike Pavone <pavone@retrodev.com>
parents:
11
diff
changeset
|
272 release_ref(cdata->params[0]); |
66
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
273 Ret(0, lv_Fib->out) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
274 EndFunc(Fib) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
275 DISPATCH |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
276 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
277 Method(If) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
278 MethodDispatch(TYPE_BOOLEAN,If,Yes_SP_No) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
279 EndMethod |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
280 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
281 MethodImplNoLocals(If,Yes_SP_No,TYPE_BOOLEAN, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
282 NumParams 1) |
12
31f8182f3433
Finished fib test and did some small work on the c backend
Mike Pavone <pavone@retrodev.com>
parents:
11
diff
changeset
|
283 |
66
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
284 if(((t_Boolean *)(cdata->params[0]))->val) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
285 { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
286 Ret(1, NULL) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
287 } else { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
288 Ret(1, cdata->params[0]); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
289 Ret(0, NULL) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
290 } |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
291 EndFuncNoLocals |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
292 DISPATCH |
11
3021dac0d8f5
Stack unwind is so close I can almost taste it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
293 |
66
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
294 Func(Main, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
295 NumParams 0) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
296 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
297 lv_Main->____result__0__0 = NULL; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
298 lv_Main->____result__1__0 = NULL; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
299 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
300 PrepCall(1) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
301 SetParam(0, add_ref(_const_Whole_SP_Number__30)) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
302 Call(Fib, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
303 NumParams 1, 1, Main) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
304 lv_Main->____result__1__0 = cdata->params[0]; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
305 FreeCall |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
306 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
307 PrepCall(1) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
308 SetParam(0, add_ref(lv_Main->____result__1__0)) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
309 Call(Print, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
310 NumParams 1, 2, Main) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
311 lv_Main->____result__0__0 = cdata->params[0]; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
312 FreeCall |
11
3021dac0d8f5
Stack unwind is so close I can almost taste it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
313 |
66
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
314 if(lv_Main->____result__0__0) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
315 { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
316 release_ref(lv_Main->____result__0__0); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
317 } |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
318 if(lv_Main->____result__1__0) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
319 { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
320 release_ref(lv_Main->____result__1__0); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
321 } |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
322 EndFunc(Main) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
323 DISPATCH |
11
3021dac0d8f5
Stack unwind is so close I can almost taste it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
324 |
66
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
325 FuncNoLocals(Print, |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
326 NumParams 1) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
327 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
328 if(get_blueprint(cdata->params[0])->type_id == TYPE_INT32) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
329 { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
330 printf("%d\n", ((t_Int32 *)(cdata->params[0]))->num); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
331 } else { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
332 puts("Don't know how to print this type"); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
333 } |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
334 release_ref(cdata->params[0]); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
335 Ret(0, make_Int32(0)) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
336 EndFuncNoLocals |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
337 DISPATCH |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
338 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
339 DO_END: |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
340 return; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
341 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
342 _exception: |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
343 puts("whoops, exception!"); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
344 } |
11
3021dac0d8f5
Stack unwind is so close I can almost taste it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
345 |
3021dac0d8f5
Stack unwind is so close I can almost taste it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
346 int main(int argc, char ** argv) |
3021dac0d8f5
Stack unwind is so close I can almost taste it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
347 { |
3021dac0d8f5
Stack unwind is so close I can almost taste it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
348 register_builtin_types(); |
3021dac0d8f5
Stack unwind is so close I can almost taste it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
349 |
66
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
350 _const_Whole_SP_Number__1 = make_Int32(1); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
351 _const_Whole_SP_Number__2 = make_Int32(2); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
352 _const_Whole_SP_Number__30 = make_Int32(30); |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
353 |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
15
diff
changeset
|
354 rhope(FUNC_Main); |
11
3021dac0d8f5
Stack unwind is so close I can almost taste it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
355 return 0; |
3021dac0d8f5
Stack unwind is so close I can almost taste it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
356 } |