From ccbf14921216614682a38c317e189d978332007d Mon Sep 17 00:00:00 2001 From: "zik.saleeba" Date: Tue, 31 Mar 2009 11:08:29 +0000 Subject: [PATCH] Fixed a problem with interactive mode error handling. Will need some extra work for Surveyor... tomorrow. git-svn-id: http://picoc.googlecode.com/svn/trunk@215 21eae674-98b7-11dd-bd71-f92a316d2d60 --- TODO | 6 ++++++ picoc.h | 1 - platform.h | 4 ++++ platform_surveyor.c | 6 ------ platform_unix.c | 6 +----- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/TODO b/TODO index 56709f1..f335e82 100644 --- a/TODO +++ b/TODO @@ -2,7 +2,13 @@ TODO Bugs: * something wrong with interactive mode after error handling - not clearing token buffer correctly? + +* interactive mode sometimes bombs out + eg. "printf("fred\n", zorch);" + * parsing of statements not quite right - seems to optionally want extra tokens at end + eg. "while (1) {" then end of file + eg. "test" then end of file Implement: * operator precedence diff --git a/picoc.h b/picoc.h index 4784216..bdb0a19 100644 --- a/picoc.h +++ b/picoc.h @@ -334,7 +334,6 @@ int PlatformGetCharacter(); void PlatformPutc(unsigned char OutCh); void PlatformPrintf(const char *Format, ...); void PlatformVPrintf(const char *Format, va_list Args); -int PlatformSetExitPoint(); void PlatformExit(); void PlatformLibraryInit(); diff --git a/platform.h b/platform.h index 62f91dd..1d12aa1 100644 --- a/platform.h +++ b/platform.h @@ -25,6 +25,8 @@ #define INTERACTIVE_PROMPT_STATEMENT "picoc> " #define INTERACTIVE_PROMPT_LINE " > " +#define PlatformSetExitPoint() setjmp(ExitBuf) + /* host platform includes */ #ifdef UNIX_HOST #include @@ -41,6 +43,8 @@ #include #endif +extern jmp_buf ExitBuf; + #else # ifdef FLYINGFOX_HOST diff --git a/platform_surveyor.c b/platform_surveyor.c index e568baa..e5c7796 100644 --- a/platform_surveyor.c +++ b/platform_surveyor.c @@ -43,12 +43,6 @@ int PlatformGetCharacter() return getch(); } -/* mark where to end the program for platforms which require this */ -int PlatformSetExitPoint() -{ - return 0; -} - /* exit the program */ extern int errjmp[]; diff --git a/platform_unix.c b/platform_unix.c index f883aac..ff65a49 100644 --- a/platform_unix.c +++ b/platform_unix.c @@ -75,11 +75,7 @@ void PlatformScanFile(const char *FileName) } /* mark where to end the program for platforms which require this */ -static jmp_buf ExitBuf; -int PlatformSetExitPoint() -{ - return setjmp(ExitBuf); -} +jmp_buf ExitBuf; /* exit the program */ void PlatformExit()