diff --git a/src/main.c b/src/main.c index fe23024..c304cdd 100644 --- a/src/main.c +++ b/src/main.c @@ -1,4 +1,5 @@ #include "vm.h" +#include "util.h" /** * @brief main diff --git a/src/opcode.h b/src/opcode.h index 7807abd..83ecc74 100644 --- a/src/opcode.h +++ b/src/opcode.h @@ -1,5 +1,6 @@ #ifndef OPCODE_H #define OPCODE_H + enum { /*Addition operation*/ IADD = 1, diff --git a/src/util.h b/src/util.h index 9acfa39..0ed5def 100644 --- a/src/util.h +++ b/src/util.h @@ -1,5 +1,6 @@ #ifndef UTIL_H #define UTIL_H + #include #include @@ -14,4 +15,5 @@ static inline void die(int code, const char* message){ fprintf(stderr, "%s\n", message); exit(code); } + #endif diff --git a/src/vm.c b/src/vm.c index 4af3032..584e9f7 100644 --- a/src/vm.c +++ b/src/vm.c @@ -1,3 +1,10 @@ +#include +#include +#include +#include + +#include "util.h" +#include "opcode.h" #include "vm.h" /** @@ -39,7 +46,7 @@ void vm_execute(int code[], int ip, int datasize, unsigned long length){ while(ip < length){ int opcode = code[ip]; ip++; - if(DEBUG){ + if(DEBUG_ON){ if(ip+2 != length) disassemble(sp, fp, ip, opcode, ins, code, stack); } diff --git a/src/vm.h b/src/vm.h index c635afa..a5a176f 100644 --- a/src/vm.h +++ b/src/vm.h @@ -1,21 +1,12 @@ #ifndef VM_H #define VM_H -#include -#include -#include -#include - -#include "util.h" -#include "opcode.h" - #define MAX_SIZE 4096 #define TRUE 1 #define FALSE 0 -#ifdef DEBUG_ON - #define DEBUG TRUE -#else - #define DEBUG FALSE + +#ifndef DEBUG_ON +#define DEBUG_ON FALSE #endif typedef struct{