Franck Pommereau

reworked stdio and preprocessor

......@@ -10,7 +10,7 @@ def _lnomap (line) :
def cpp (path, arch, args) :
lmap = {}
code = []
args = ["cpp", "-D__CCT__=%s" % arch] + args + [path]
args = ["cpp", "-D__CCT__", "-D__CCT_%s__" % arch] + args + [path]
pos = 1
out = subprocess.check_output(args)
for line in (l.rstrip() for l in out.decode().splitlines()) :
......
#ifdef __CCT__
// CCT compiler with TTC backend
#ifdef __CCT_ttc__
extern int putc(char c);
#define neg(i) -i
#define UINT(i) i
#define _DIGITS "0123456789ABCDEF"
#define _STR "65536"
#else
#endif
// CCT compiler with x86 backend
#ifdef __CCT_x86__
extern int putchar(int c);
#define putc(c) putchar(c)
#define neg(i) -i
#define UINT(i) i
#define _DIGITS "0123456789ABCDEF"
#define _STR "65536"
#endif
// regular compiler
#ifndef __CCT__
extern int putchar(int c);
#define putc(c) putchar(c)
#define neg(i) ~i + 1
......