Added changes from Howard
git-svn-id: http://picoc.googlecode.com/svn/trunk@135 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
7003b55ead
commit
24b47c58f4
9
picoc.c
9
picoc.c
|
@ -38,11 +38,18 @@ for (Count = 1; Count <= 10; Count++)\n\
|
||||||
printf(\"%d\n\", Count);\n\
|
printf(\"%d\n\", Count);\n\
|
||||||
";
|
";
|
||||||
|
|
||||||
|
int errjmp[41];
|
||||||
|
|
||||||
int picoc()
|
int picoc()
|
||||||
{
|
{
|
||||||
Initialise();
|
Initialise();
|
||||||
if (PlatformSetExitPoint())
|
|
||||||
|
errjmp[40] = 0;
|
||||||
|
setjmp(errjmp);
|
||||||
|
if (errjmp[40]) {
|
||||||
|
printf("\n\rgoodbye ...\n\r");
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
Parse("test.c", SourceStr, strlen(SourceStr), TRUE);
|
Parse("test.c", SourceStr, strlen(SourceStr), TRUE);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
# define NO_CTYPE
|
# define NO_CTYPE
|
||||||
# include "../string.h"
|
# include "../string.h"
|
||||||
# include "../print.h"
|
# include "../print.h"
|
||||||
# include "../malloc.h"
|
# include "../srv.h"
|
||||||
# include "../setjmp.h"
|
# include "../setjmp.h"
|
||||||
# include "../stdarg.h"
|
# include "../stdarg.h"
|
||||||
# define assert(x)
|
# define assert(x)
|
||||||
|
|
|
@ -71,19 +71,30 @@ char *PlatformGetLine(char *Buf, int MaxLen)
|
||||||
/* write a character to the console */
|
/* write a character to the console */
|
||||||
void PlatformPutc(unsigned char OutCh)
|
void PlatformPutc(unsigned char OutCh)
|
||||||
{
|
{
|
||||||
|
putchar(OutCh);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mark where to end the program for platforms which require this */
|
/* mark where to end the program for platforms which require this */
|
||||||
static jmp_buf ExitPoint;
|
int errjmp[41];
|
||||||
|
|
||||||
int PlatformSetExitPoint()
|
int PlatformSetExitPoint()
|
||||||
{
|
{
|
||||||
return setjmp(ExitPoint);
|
errjmp[40] = 0;
|
||||||
|
setjmp(errjmp);
|
||||||
|
if (errjmp[40]) {
|
||||||
|
printf("\n\rgoodbye ...\n\r");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* exit the program */
|
/* exit the program */
|
||||||
|
extern int errjmp[];
|
||||||
|
|
||||||
void PlatformExit()
|
void PlatformExit()
|
||||||
{
|
{
|
||||||
longjmp(ExitPoint, 1);
|
errjmp[40] = 1;
|
||||||
|
longjmp(errjmp, 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue