Cleaned up includes
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#include "vm.h"
|
#include "vm.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief main
|
* @brief main
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
#ifndef OPCODE_H
|
#ifndef OPCODE_H
|
||||||
#define OPCODE_H
|
#define OPCODE_H
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
/*Addition operation*/
|
/*Addition operation*/
|
||||||
IADD = 1,
|
IADD = 1,
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
#ifndef UTIL_H
|
#ifndef UTIL_H
|
||||||
#define UTIL_H
|
#define UTIL_H
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
@@ -14,4 +15,5 @@ static inline void die(int code, const char* message){
|
|||||||
fprintf(stderr, "%s\n", message);
|
fprintf(stderr, "%s\n", message);
|
||||||
exit(code);
|
exit(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#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"
|
#include "vm.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,7 +46,7 @@ void vm_execute(int code[], int ip, int datasize, unsigned long length){
|
|||||||
while(ip < length){
|
while(ip < length){
|
||||||
int opcode = code[ip];
|
int opcode = code[ip];
|
||||||
ip++;
|
ip++;
|
||||||
if(DEBUG){
|
if(DEBUG_ON){
|
||||||
if(ip+2 != length)
|
if(ip+2 != length)
|
||||||
disassemble(sp, fp, ip, opcode, ins, code, stack);
|
disassemble(sp, fp, ip, opcode, ins, code, stack);
|
||||||
}
|
}
|
||||||
|
15
src/vm.h
15
src/vm.h
@@ -1,21 +1,12 @@
|
|||||||
#ifndef VM_H
|
#ifndef VM_H
|
||||||
#define 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 MAX_SIZE 4096
|
||||||
#define TRUE 1
|
#define TRUE 1
|
||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
#ifdef DEBUG_ON
|
|
||||||
#define DEBUG TRUE
|
#ifndef DEBUG_ON
|
||||||
#else
|
#define DEBUG_ON FALSE
|
||||||
#define DEBUG FALSE
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct{
|
typedef struct{
|
||||||
|
Reference in New Issue
Block a user