safety
This commit is contained in:
parent
7222328ace
commit
8136db2cc6
@ -8,6 +8,7 @@
|
|||||||
#include "eaxhla.h"
|
#include "eaxhla.h"
|
||||||
#include "assembler.h"
|
#include "assembler.h"
|
||||||
#include "unix.h"
|
#include "unix.h"
|
||||||
|
#include "safety.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
unsigned int * token_array = NULL;
|
unsigned int * token_array = NULL;
|
||||||
@ -50,17 +51,6 @@ void dump_variables_to_assembler(void) {
|
|||||||
tommy_hashtable_foreach(&symbol_table, dump_variable_to_assembler);
|
tommy_hashtable_foreach(&symbol_table, dump_variable_to_assembler);
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX Move these to somewhere more sane
|
|
||||||
#define check(code) do { \
|
|
||||||
if (code) { return 1; } \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define checked_fwrite(src, size, n, file) do { \
|
|
||||||
if(fwrite (src, size, n, file) != n) { \
|
|
||||||
return 1; \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
static
|
static
|
||||||
int write_output(FILE * file) {
|
int write_output(FILE * file) {
|
||||||
// XXX Where can i move these?
|
// XXX Where can i move these?
|
||||||
|
14
source/safety.h
Normal file
14
source/safety.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#ifndef SAFETY_H
|
||||||
|
#define SAFETY_H
|
||||||
|
|
||||||
|
#define check(code) do { \
|
||||||
|
if (code) { return 1; } \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define checked_fwrite(src, size, n, file) do { \
|
||||||
|
if(fwrite (src, size, n, file) != n) { \
|
||||||
|
return 1; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user