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:
parent
b23d1e8e06
commit
55e2183bea
2
picoc.c
2
picoc.c
|
@ -80,7 +80,7 @@ int picoc(char *SourceStr)
|
||||||
ExitBuf[40] = 0;
|
ExitBuf[40] = 0;
|
||||||
PicocPlatformSetExitPoint();
|
PicocPlatformSetExitPoint();
|
||||||
if (ExitBuf[40]) {
|
if (ExitBuf[40]) {
|
||||||
printf("leaving picoC\n\r");
|
printf("Leaving PicoC\n\r");
|
||||||
PicocCleanup();
|
PicocCleanup();
|
||||||
return ExitValue;
|
return ExitValue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,10 +92,6 @@ extern jmp_buf ExitBuf;
|
||||||
# include "../malloc.h"
|
# include "../malloc.h"
|
||||||
# include "../xmodem.h"
|
# include "../xmodem.h"
|
||||||
# define assert(x)
|
# define assert(x)
|
||||||
# undef INTERACTIVE_PROMPT_STATEMENT
|
|
||||||
# undef INTERACTIVE_PROMPT_LINE
|
|
||||||
# define INTERACTIVE_PROMPT_STATEMENT "> "
|
|
||||||
# define INTERACTIVE_PROMPT_LINE "- "
|
|
||||||
# undef BIG_ENDIAN
|
# undef BIG_ENDIAN
|
||||||
# define NO_CALLOC
|
# define NO_CALLOC
|
||||||
# define NO_REALLOC
|
# define NO_REALLOC
|
||||||
|
|
|
@ -12,12 +12,22 @@ char *PlatformGetLine(char *Buf, int MaxLen, const char *Prompt)
|
||||||
int ix;
|
int ix;
|
||||||
char ch, *cp;
|
char ch, *cp;
|
||||||
|
|
||||||
|
printf(Prompt);
|
||||||
|
|
||||||
ix = 0;
|
ix = 0;
|
||||||
cp = Buf;
|
cp = 0;
|
||||||
while (ix++ < MaxLen) {
|
|
||||||
|
// If the first character is \n or \r, eat it
|
||||||
ch = getch();
|
ch = getch();
|
||||||
if (ch == 0x1B) { // ESC character - exit
|
if (ch == '\n' || ch == '\r')
|
||||||
printf("leaving picoC\n\r");
|
{
|
||||||
|
// And get the next character
|
||||||
|
ch = getch();
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (ch == '\n') {
|
if (ch == '\n') {
|
||||||
|
@ -27,6 +37,7 @@ char *PlatformGetLine(char *Buf, int MaxLen, const char *Prompt)
|
||||||
}
|
}
|
||||||
*cp++ = ch;
|
*cp++ = ch;
|
||||||
ix++;
|
ix++;
|
||||||
|
ch = getch();
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue