MKGLOBAL(name); \
} while(0)
+#define MKCONSTVECTOR(name, valx, valy, valz) \
+do { \
+ name->isconst = true; \
+ name->constval.vvec.x = (valx); \
+ name->constval.vvec.y = (valy); \
+ name->constval.vvec.z = (valz); \
+ MKGLOBAL(name); \
+} while(0)
+
#define STATE(a) \
do { \
ast_expression *exp = (ast_expression*)(a); \
DEFVAR(f0);
DEFVAR(f1);
DEFVAR(f5);
+ DEFVAR(cv3x4x5);
+ DEFVAR(cv1x1x1);
DEFVAR(sHello);
+ DEFVAR(sNL);
DEFVAR(print);
DEFVAR(ftos);
DEFVAR(spawn);
DEFVAR(mema);
+ DEFVAR(memb);
+ DEFVAR(memv);
DEFVAR(pawn);
/* opts_debug = true; */
VAR(TYPE_FLOAT, f1);
VAR(TYPE_FLOAT, f5);
VAR(TYPE_STRING, sHello);
+VAR(TYPE_STRING, sNL);
+VAR(TYPE_VECTOR, cv3x4x5);
+VAR(TYPE_VECTOR, cv1x1x1);
FIELD(TYPE_FLOAT, mema);
+FIELD(TYPE_FLOAT, memb);
+FIELD(TYPE_VECTOR, memv);
MKCONSTFLOAT(f0, 0.0);
MKCONSTFLOAT(f1, 1.0);
MKCONSTFLOAT(f5, 5.0);
MKCONSTSTRING(sHello, "Hello, World\n");
+MKCONSTSTRING(sNL, "\n");
+MKCONSTVECTOR(cv3x4x5, 3, 4, 5);
+MKCONSTVECTOR(cv1x1x1, 1, 1, 1);
FUNCTION(foo, TYPE_VOID);
ENDFUNCTION(foo);
+#define PRINTNL() do { CALL(print) CALLPARAM(sNL) ENDCALL(); } while(0)
+
FUNCTION(main, TYPE_VOID);
VAR(TYPE_FLOAT, vi);
ENDCALLWITH(newent, STATE(ASSIGN(STORE_ENT, pawn, newent)));
STATE(ASSIGN(STOREP_F, ENTFIELD(pawn, mema), f5));
+ STATE(ASSIGN(STOREP_F, ENTFIELD(pawn, memb), f1));
+ STATE(ASSIGN(STOREP_V, ENTFIELD(pawn, memv), cv3x4x5));
CALL(ftos)
CALLPARAM(ENTFIELD(pawn, mema))
-#if 0
- ENDCALLWITH(output, STATE(ASSIGN(STORE_F, vi, output)));
-
- CALL(print)
- CALLPARAM(vi)
- ENDCALL();
-#else
ENDCALLWITH(output,
CALL(print)
CALLPARAM(output)
+ CALLPARAM(sNL)
+ ENDCALL();
+ );
+ CALL(ftos)
+ CALLPARAM(ENTFIELD(pawn, memb))
+ ENDCALLWITH(output,
+ CALL(print)
+ CALLPARAM(output)
+ CALLPARAM(sNL)
ENDCALL();
);
-#endif
ENDFUNCTION(main);