10 #ifndef STANDALONE_PARSER 27 #define fePutChar(c) fputc((unsigned char)(c),stdout) 37 #define MAX_FILE_BUFFER 4*4096 58 if ((currentVoice!=
NULL)
75 PrintS(
"-- called from ? --\n");
77 Print(
"-- called from %s --\n",s);
91 if (currentVoice !=
NULL)
121 currentVoice->
Next();
126 if (strcmp(fname,
"STDIN") == 0)
128 currentVoice->
files = stdin;
158 currentVoice->
Next();
168 strcat(currentVoice->
filename,
"::");
170 currentVoice->
pi =
pi;
177 currentVoice->
pi = currentVoice->
prev->
pi;
182 currentVoice->
pi =
pi;
187 currentVoice->
typ = t;
250 while (p != currentVoice)
276 while (p != currentVoice)
309 while (p != currentVoice)
314 currentVoice->
fptr=0;
346 if (currentVoice!=
NULL)
365 &&(currentVoice->
files!=stdin))
384 fclose(currentVoice->
files);
393 return currentVoice==
NULL;
410 char *ss=strrchr(anf,
'\n');
421 int mrc=
si_min(len_s,79)-1;
432 && (strncmp(anf,
";return();",10)!=0)
445 fwrite(anf,1,len_s,stdout);
450 while(fgetc(stdin)!=
'\n');
474 && (currentVoice->
pi!=
NULL)
477 sdb(currentVoice, anf, len_s);
489 if (currentVoice!=
NULL)
492 && (currentVoice->
buffer[currentVoice->
fptr]!=
'\0'))
496 long startfptr=currentVoice->
fptr;
497 long tmp_ptr=currentVoice->
fptr;
502 b[
i]=currentVoice->
buffer[tmp_ptr];
507 else if (c==
'}')
break;
519 if(currentVoice->
buffer[tmp_ptr]==
'\0')
break;
521 currentVoice->
fptr=tmp_ptr;
531 const char *ss=strchr(anf,
'\n');
532 if (ss==
NULL) len=strlen(anf);
537 (currentVoice->
buffer[startfptr-1]==
'\n'))
539 anf=currentVoice->
buffer+startfptr;
540 const char *ss=strchr(anf,
'\n');
541 if (ss==
NULL) len=strlen(anf);
548 char *s=(
char *)
omAlloc(len+2);
549 strncpy(s,anf,len+2);
555 currentVoice->
fptr++;
561 currentVoice->
fptr=0;
575 &(currentVoice->
buffer[offset]),
585 currentVoice->
files);
608 rc-=3;
if (rc<0) rc=0;
644 Werror(
"premature end of file while reading %s",err);
653 #define STDIN_FILENO 0 662 p->
files=freopen(
"/dev/tty",
"r",stdin);
const CanonicalForm int s
#define TRACE_SHOW_LINENO
char *(* fe_fgets_stdin)(const char *pr, char *s, int size)
static void feShowPrompt(void)
static int si_min(const int a, const int b)
size_t omSizeOfAddr(const void *addr)
BOOLEAN newFile(char *fname)
BOOLEAN exitBuffer(feBufferTypes typ)
void sdb(Voice *currentVoice, const char *currLine, int len)
Voice * feInitStdin(Voice *pp)
static int fePrintEcho(char *anf, char *)
FILE * feFopen(const char *path, const char *mode, char *where, short useWerror, short path_only)
void PrintS(const char *s)
void myyoldbuffer(void *oldb)
void newBuffer(char *s, feBufferTypes t, procinfo *pi, int lineno)
void omMarkAsStaticAddr(void *addr)
int feReadLine(char *b, int l)
void Werror(const char *fmt,...)
BOOLEAN contBuffer(feBufferTypes typ)