proper debug func prototypes, remove DEBUGGER compile switch double negative :/

This commit is contained in:
Joseph Poirier 2015-06-07 21:12:20 -05:00
parent 1a4b9a92c4
commit a755ebfbe6
7 changed files with 21 additions and 25 deletions

View file

@ -1,5 +1,5 @@
CC=gcc 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 LIBS=-lm -lreadline
TARGET = picoc TARGET = picoc

View file

@ -1,6 +1,6 @@
/* picoc interactive debugger */ /* picoc interactive debugger */
#ifndef NO_DEBUGGER #ifdef DEBUGGER
#include "interpreter.h" #include "interpreter.h"
@ -115,4 +115,4 @@ void DebugCheckStatement(struct ParseState *Parser)
void DebugStep() void DebugStep()
{ {
} }
#endif /* !NO_DEBUGGER */ #endif /* DEBUGGER */

View file

@ -586,10 +586,10 @@ extern void IncludeFile(Picoc *pc, char *Filename);
/* the following is defined in picoc.h: /* the following is defined in picoc.h:
* void PicocIncludeAllSystemHeaders(); */ * void PicocIncludeAllSystemHeaders(); */
#ifndef NO_DEBUGGER #ifdef DEBUGGER
/* debug.c */ /* debug.c */
extern void DebugInit(); extern void DebugInit(Picoc *pc);
extern void DebugCleanup(); extern void DebugCleanup(Picoc *pc);
extern void DebugCheckStatement(struct ParseState *Parser); extern void DebugCheckStatement(struct ParseState *Parser);
#endif #endif

View file

@ -528,7 +528,7 @@ enum ParseResult ParseStatement(struct ParseState *Parser, int CheckTrailingSemi
/* if we're debugging, check for a breakpoint */ /* if we're debugging, check for a breakpoint */
if (Parser->DebugMode && Parser->Mode == RunModeRun) if (Parser->DebugMode && Parser->Mode == RunModeRun)
#ifndef NO_DEBUGGER #ifdef DEBUGGER
DebugCheckStatement(Parser) DebugCheckStatement(Parser)
#endif #endif
; ;

View file

@ -4,10 +4,10 @@
#include "picoc.h" #include "picoc.h"
#include "interpreter.h" #include "interpreter.h"
#ifdef NO_DEBUGGER #ifdef DEBUGGER
static int gEnableDebugger = FALSE;
#else
static int gEnableDebugger = TRUE; static int gEnableDebugger = TRUE;
#else
static int gEnableDebugger = FALSE;
#endif #endif
@ -25,7 +25,7 @@ void PicocInitialise(Picoc *pc, int StackSize)
IncludeInit(pc); IncludeInit(pc);
LibraryInit(pc); LibraryInit(pc);
PlatformLibraryInit(pc); PlatformLibraryInit(pc);
#ifndef NO_DEBUGGER #ifdef DEBUGGER
DebugInit(pc); DebugInit(pc);
#endif #endif
} }
@ -33,7 +33,7 @@ void PicocInitialise(Picoc *pc, int StackSize)
/* free memory */ /* free memory */
void PicocCleanup(Picoc *pc) void PicocCleanup(Picoc *pc)
{ {
#ifndef NO_DEBUGGER #ifdef DEBUGGER
DebugCleanup(pc); DebugCleanup(pc);
#endif #endif
IncludeCleanup(pc); IncludeCleanup(pc);

View file

@ -1,10 +1,10 @@
#include "../picoc.h" #include "../picoc.h"
#include "../interpreter.h" #include "../interpreter.h"
#ifdef NO_DEBUGGER #ifdef DEBUGGER
static int gEnableDebugger = FALSE;
#else
static int gEnableDebugger = TRUE; static int gEnableDebugger = TRUE;
#else
static int gEnableDebugger = FALSE;
#endif #endif
/* mark where to end the program for platforms which require this */ /* mark where to end the program for platforms which require this */

View file

@ -6,16 +6,16 @@
#include <readline/history.h> #include <readline/history.h>
#endif #endif
#ifdef NO_DEBUGGER #ifdef DEBUGGER
static int gEnableDebugger = FALSE;
#else
static int gEnableDebugger = TRUE; static int gEnableDebugger = TRUE;
#else
static int gEnableDebugger = FALSE;
#endif #endif
/* mark where to end the program for platforms which require this */ /* mark where to end the program for platforms which require this */
jmp_buf PicocExitBuf; jmp_buf PicocExitBuf;
#ifndef NO_DEBUGGER #ifdef DEBUGGER
#include <signal.h> #include <signal.h>
Picoc *break_pc = NULL; Picoc *break_pc = NULL;
@ -32,14 +32,10 @@ void PlatformInit(Picoc *pc)
signal(SIGINT, BreakHandler); signal(SIGINT, BreakHandler);
} }
#else #else
void PlatformInit(Picoc *pc) void PlatformInit(Picoc *pc) { }
{
}
#endif #endif
void PlatformCleanup(Picoc *pc) void PlatformCleanup(Picoc *pc) { }
{
}
/* get a line of interactive input */ /* get a line of interactive input */
char *PlatformGetLine(char *Buf, int MaxLen, const char *Prompt) char *PlatformGetLine(char *Buf, int MaxLen, const char *Prompt)