Skip to content

Commit 5c4c5d6

Browse files
committed
Fix debug prints in resolve_primitive
1 parent 5c5613f commit 5c4c5d6

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

src/Interpreter/interpreter.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
#include <cstring>
55
#include <set>
66

7+
#include "../Utils/macros.h"
78
#include "../WARDuino/internals.h"
8-
// #include "../Utils/macros.h"
99

1010
class Interpreter {
1111
public:
@@ -66,19 +66,18 @@ class Interpreter {
6666
//------------------------------------------------------
6767
// ReSharper disable once CppDFAConstantFunctionResult
6868
bool resolve_primitive(const char *symbol, Primitive *val) {
69-
// debug("Resolve primitives (%d) for %s \n", ALL_PRIMITIVES, symbol);
69+
debug("Resolve primitives (%d) for %s \n", ALL_PRIMITIVES, symbol);
7070

7171
for (auto &primitive : primitives) {
7272
// printf("Checking %s = %s \n", symbol, primitive.name);
7373
if (!strcmp(symbol, primitive.name)) {
74-
// debug("FOUND PRIMITIVE\n");
74+
debug("FOUND PRIMITIVE\n");
7575
*val = primitive.f;
7676
return true;
7777
}
7878
}
79-
// FATAL("Could not find primitive %s \n", symbol);
80-
return false;
81-
// return false; // unreachable
79+
FATAL("Could not find primitive %s \n", symbol);
80+
return false; // unreachable
8281
}
8382

8483
//------------------------------------------------------
@@ -94,7 +93,7 @@ class Interpreter {
9493
for (PrimitiveEntry &p : primitives) {
9594
if (prim_names.find(p.name) != prim_names.end()) {
9695
if (p.f_reverse) {
97-
printf("Reversing state for primitive %s\n", p.name);
96+
dbg_info("Reversing state for primitive %s\n", p.name);
9897
p.f_reverse(m, external_state);
9998
}
10099
}

src/Utils/macros.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include <cstdio>
44

5-
#include "../WARDuino.h"
5+
#include "../WARDuino/internals.h"
66

77
#ifndef DEBUG
88
#define DEBUG 0

src/WARDuino/CallbackHandler.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "../Debug/debugger.h"
66
#include "../Interpreter/interpreter.h"
77
#include "../Utils/macros.h"
8+
#include "../WARDuino.h"
89

910
void push_guard(Module *m) {
1011
if (m == nullptr) {

src/WARDuino/WARDuino.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -622,9 +622,10 @@ void WARDuino::instantiate_module(Module *m, uint8_t *bytes,
622622
// Allocate memory
623623
// for (uint32_t c=0; c<memory_count; c++) {
624624
parse_memory_type(m, &pos);
625-
m->memory.bytes = (uint8_t *)acalloc(
626-
m->memory.pages * PAGE_SIZE, 1, // sizeof(uint32_t),
627-
"Module->memory.bytes");
625+
m->memory.bytes =
626+
(uint8_t *)acalloc(m->memory.pages * PAGE_SIZE,
627+
1, // sizeof(uint32_t),
628+
"Module->memory.bytes");
628629
//}
629630
break;
630631
}

0 commit comments

Comments
 (0)