// BEGIN mycpp output #include "gc_heap.h" using gc_heap::Alloc; using gc_heap::kZeroMask; using gc_heap::StackRoots; #include "my_runtime.h" #include "mylib2.h" using gc_heap::NewStr; using gc_heap::NewList; using gc_heap::NewDict; GLOBAL_STR(str0, "CPP"); GLOBAL_STR(str1, "PYTHON"); GLOBAL_STR(str2, "int = %d"); GLOBAL_STR(str3, "123"); GLOBAL_STR(str4, "bool = %d"); GLOBAL_STR(str5, "mylist"); GLOBAL_STR(str6, "x = %d"); GLOBAL_STR(str7, "yes"); GLOBAL_STR(str8, "no"); namespace test_conditional { // forward declare } // forward declare namespace test_conditional namespace test_conditional { // declare void run_tests(); void run_benchmarks(); inline Str* fmt0(int a0) { gBuf.reset(); gBuf.write_const("int = ", 6); gBuf.format_d(a0); return gBuf.getvalue(); } inline Str* fmt1(bool a0) { gBuf.reset(); gBuf.write_const("bool = ", 7); gBuf.format_d(a0); return gBuf.getvalue(); } inline Str* fmt2(int a0) { gBuf.reset(); gBuf.write_const("x = ", 4); gBuf.format_d(a0); return gBuf.getvalue(); } } // declare namespace test_conditional namespace test_conditional { // define void run_tests() { List* mylist = nullptr; int x; bool a; StackRoots _roots({&mylist}); // if MYCPP { println_stderr(str0); } // endif MYCPP // if not PYTHON { println_stderr(str1); } // endif MYCPP println_stderr(fmt0(to_int(str3))); println_stderr(fmt1(to_bool(42))); mylist = Alloc>(); if (len(mylist)) { print(str5); } x = len(mylist) ? 1 : 2; println_stderr(fmt2(x)); a = false; if ((a and (false or true))) { print(str7); } else { print(str8); } } void run_benchmarks() { throw Alloc(); } } // define namespace test_conditional