Changes from Brian Schmalz for surveyor platform

git-svn-id: http://picoc.googlecode.com/svn/trunk@550 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
zik.saleeba 2011-02-17 21:52:15 +00:00
parent b23d1e8e06
commit 55e2183bea
3 changed files with 17 additions and 10 deletions

View file

@ -80,7 +80,7 @@ int picoc(char *SourceStr)
ExitBuf[40] = 0;
PicocPlatformSetExitPoint();
if (ExitBuf[40]) {
printf("leaving picoC\n\r");
printf("Leaving PicoC\n\r");
PicocCleanup();
return ExitValue;
}

View file

@ -92,10 +92,6 @@ extern jmp_buf ExitBuf;
# include "../malloc.h"
# include "../xmodem.h"
# define assert(x)
# undef INTERACTIVE_PROMPT_STATEMENT
# undef INTERACTIVE_PROMPT_LINE
# define INTERACTIVE_PROMPT_STATEMENT "> "
# define INTERACTIVE_PROMPT_LINE "- "
# undef BIG_ENDIAN
# define NO_CALLOC
# define NO_REALLOC

View file

@ -11,13 +11,23 @@ char *PlatformGetLine(char *Buf, int MaxLen, const char *Prompt)
{
int ix;
char ch, *cp;
printf(Prompt);
ix = 0;
cp = Buf;
while (ix++ < MaxLen) {
cp = 0;
// If the first character is \n or \r, eat it
ch = getch();
if (ch == '\n' || ch == '\r')
{
// And get the next character
ch = getch();
if (ch == 0x1B) { // ESC character - exit
printf("leaving picoC\n\r");
}
while (ix++ < MaxLen) {
if (ch == 0x1B || ch == 0x03) { // ESC character or ctrl-c (to avoid problem with TeraTerm) - exit
printf("Leaving PicoC\n");
return NULL;
}
if (ch == '\n') {
@ -27,6 +37,7 @@ char *PlatformGetLine(char *Buf, int MaxLen, const char *Prompt)
}
*cp++ = ch;
ix++;
ch = getch();
}
return NULL;
}