diff --git a/Makefile b/Makefile index 25dd7a8..8e09083 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ CC=gcc -CFLAGS=-Wall -pedantic -g -DNO_DEBUGGER -DUNIX_HOST -DVER=\"`git show-ref --abbrev=8 --head --hash head`\" -DTAG=\"`git describe --abbrev=0 --tags`\" +CFLAGS=-Wall -pedantic -g -DDEBUGGER -DUNIX_HOST -DVER=\"`git show-ref --abbrev=8 --head --hash head`\" -DTAG=\"`git describe --abbrev=0 --tags`\" LIBS=-lm -lreadline TARGET = picoc diff --git a/debug.c b/debug.c index b76bf5f..cd437a3 100644 --- a/debug.c +++ b/debug.c @@ -1,6 +1,6 @@ /* picoc interactive debugger */ -#ifndef NO_DEBUGGER +#ifdef DEBUGGER #include "interpreter.h" @@ -115,4 +115,4 @@ void DebugCheckStatement(struct ParseState *Parser) void DebugStep() { } -#endif /* !NO_DEBUGGER */ +#endif /* DEBUGGER */ diff --git a/interpreter.h b/interpreter.h index f5498f0..2dc9dae 100644 --- a/interpreter.h +++ b/interpreter.h @@ -586,10 +586,10 @@ extern void IncludeFile(Picoc *pc, char *Filename); /* the following is defined in picoc.h: * void PicocIncludeAllSystemHeaders(); */ -#ifndef NO_DEBUGGER +#ifdef DEBUGGER /* debug.c */ -extern void DebugInit(); -extern void DebugCleanup(); +extern void DebugInit(Picoc *pc); +extern void DebugCleanup(Picoc *pc); extern void DebugCheckStatement(struct ParseState *Parser); #endif diff --git a/parse.c b/parse.c index bd19e41..185a533 100644 --- a/parse.c +++ b/parse.c @@ -528,7 +528,7 @@ enum ParseResult ParseStatement(struct ParseState *Parser, int CheckTrailingSemi /* if we're debugging, check for a breakpoint */ if (Parser->DebugMode && Parser->Mode == RunModeRun) -#ifndef NO_DEBUGGER +#ifdef DEBUGGER DebugCheckStatement(Parser) #endif ; diff --git a/platform.c b/platform.c index d0d90b2..1b198f7 100644 --- a/platform.c +++ b/platform.c @@ -4,10 +4,10 @@ #include "picoc.h" #include "interpreter.h" -#ifdef NO_DEBUGGER -static int gEnableDebugger = FALSE; -#else +#ifdef DEBUGGER static int gEnableDebugger = TRUE; +#else +static int gEnableDebugger = FALSE; #endif @@ -25,7 +25,7 @@ void PicocInitialise(Picoc *pc, int StackSize) IncludeInit(pc); LibraryInit(pc); PlatformLibraryInit(pc); -#ifndef NO_DEBUGGER +#ifdef DEBUGGER DebugInit(pc); #endif } @@ -33,7 +33,7 @@ void PicocInitialise(Picoc *pc, int StackSize) /* free memory */ void PicocCleanup(Picoc *pc) { -#ifndef NO_DEBUGGER +#ifdef DEBUGGER DebugCleanup(pc); #endif IncludeCleanup(pc); diff --git a/platform/platform_msvc.c b/platform/platform_msvc.c index 582df64..4bc3e9e 100644 --- a/platform/platform_msvc.c +++ b/platform/platform_msvc.c @@ -1,10 +1,10 @@ #include "../picoc.h" #include "../interpreter.h" -#ifdef NO_DEBUGGER -static int gEnableDebugger = FALSE; -#else +#ifdef DEBUGGER static int gEnableDebugger = TRUE; +#else +static int gEnableDebugger = FALSE; #endif /* mark where to end the program for platforms which require this */ diff --git a/platform/platform_unix.c b/platform/platform_unix.c index 9efe780..fb47d97 100644 --- a/platform/platform_unix.c +++ b/platform/platform_unix.c @@ -6,16 +6,16 @@ #include #endif -#ifdef NO_DEBUGGER -static int gEnableDebugger = FALSE; -#else +#ifdef DEBUGGER static int gEnableDebugger = TRUE; +#else +static int gEnableDebugger = FALSE; #endif /* mark where to end the program for platforms which require this */ jmp_buf PicocExitBuf; -#ifndef NO_DEBUGGER +#ifdef DEBUGGER #include Picoc *break_pc = NULL; @@ -32,14 +32,10 @@ void PlatformInit(Picoc *pc) signal(SIGINT, BreakHandler); } #else -void PlatformInit(Picoc *pc) -{ -} +void PlatformInit(Picoc *pc) { } #endif -void PlatformCleanup(Picoc *pc) -{ -} +void PlatformCleanup(Picoc *pc) { } /* get a line of interactive input */ char *PlatformGetLine(char *Buf, int MaxLen, const char *Prompt)