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
21
picoc.c
21
picoc.c
|
@ -38,14 +38,21 @@ for (Count = 1; Count <= 10; Count++)\n\
|
|||
printf(\"%d\n\", Count);\n\
|
||||
";
|
||||
|
||||
int errjmp[41];
|
||||
|
||||
int picoc()
|
||||
{
|
||||
Initialise();
|
||||
if (PlatformSetExitPoint())
|
||||
return 1;
|
||||
|
||||
Parse("test.c", SourceStr, strlen(SourceStr), TRUE);
|
||||
return 0;
|
||||
{
|
||||
Initialise();
|
||||
|
||||
errjmp[40] = 0;
|
||||
setjmp(errjmp);
|
||||
if (errjmp[40]) {
|
||||
printf("\n\rgoodbye ...\n\r");
|
||||
return 1;
|
||||
}
|
||||
|
||||
Parse("test.c", SourceStr, strlen(SourceStr), TRUE);
|
||||
return 0;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
# define NO_CTYPE
|
||||
# include "../string.h"
|
||||
# include "../print.h"
|
||||
# include "../malloc.h"
|
||||
# include "../srv.h"
|
||||
# include "../setjmp.h"
|
||||
# include "../stdarg.h"
|
||||
# define assert(x)
|
||||
|
|
|
@ -65,25 +65,36 @@ void PlatformExit()
|
|||
/* get a line of interactive input */
|
||||
char *PlatformGetLine(char *Buf, int MaxLen)
|
||||
{
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* write a character to the console */
|
||||
void PlatformPutc(unsigned char OutCh)
|
||||
{
|
||||
putchar(OutCh);
|
||||
}
|
||||
|
||||
/* mark where to end the program for platforms which require this */
|
||||
static jmp_buf ExitPoint;
|
||||
int errjmp[41];
|
||||
|
||||
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 */
|
||||
extern int errjmp[];
|
||||
|
||||
void PlatformExit()
|
||||
{
|
||||
longjmp(ExitPoint, 1);
|
||||
errjmp[40] = 1;
|
||||
longjmp(errjmp, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue