Cleaned up includes
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "vm.h"
|
||||
#include "util.h"
|
||||
|
||||
/**
|
||||
* @brief main
|
||||
|
@@ -1,5 +1,6 @@
|
||||
#ifndef OPCODE_H
|
||||
#define OPCODE_H
|
||||
|
||||
enum {
|
||||
/*Addition operation*/
|
||||
IADD = 1,
|
||||
|
@@ -1,5 +1,6 @@
|
||||
#ifndef UTIL_H
|
||||
#define UTIL_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -14,4 +15,5 @@ static inline void die(int code, const char* message){
|
||||
fprintf(stderr, "%s\n", message);
|
||||
exit(code);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
9
src/vm.c
9
src/vm.c
@@ -1,3 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <alloca.h>
|
||||
|
||||
#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);
|
||||
}
|
||||
|
15
src/vm.h
15
src/vm.h
@@ -1,21 +1,12 @@
|
||||
#ifndef VM_H
|
||||
#define VM_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <alloca.h>
|
||||
|
||||
#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{
|
||||
|
Reference in New Issue
Block a user