MCPcopy Create free account
hub / github.com/Singular/Singular / feReadLine

Function feReadLine

Singular/fevoices.cc:500–613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

498}
499
500int feReadLine(char* b, int l)
501{
502 char *s=NULL;
503 int offset = 0; /* will not be used if s==NULL*/
504 // try to read from the buffer into b, max l chars
505 if (currentVoice!=NULL)
506 {
507 if((currentVoice->buffer!=NULL)
508 && (currentVoice->buffer[currentVoice->fptr]!='\0'))
509 {
510 NewBuff:
511 REGISTER int i=0;
512 long startfptr=currentVoice->fptr;
513 long tmp_ptr=currentVoice->fptr;
514 l--;
515 loop
516 {
517 REGISTER char c=
518 b[i]=currentVoice->buffer[tmp_ptr/*currentVoice->fptr*/];
519 i++;
520 if (yy_noeof==noeof_block)
521 {
522 if (c<' ') yylineno++;
523 else if (c=='}') break;
524 }
525 else
526 {
527 if ((c<' ') ||
528 (c==';') ||
529 (c==')')
530 )
531 break;
532 }
533 if (i>=l) break;
534 tmp_ptr++;/*currentVoice->fptr++;*/
535 if(currentVoice->buffer[tmp_ptr/*currentVoice->fptr*/]=='\0') break;
536 }
537 currentVoice->fptr=tmp_ptr;
538 b[i]='\0';
539 if (currentVoice->sw==BI_buffer)
540 {
541 BOOLEAN show_echo=FALSE;
542 char *anf;
543 long len;
544 if (startfptr==0)
545 {
546 anf=currentVoice->buffer;
547 const char *ss=strchr(anf,'\n');
548 if (ss==NULL) len=strlen(anf);
549 else len=ss-anf;
550 show_echo=TRUE;
551 }
552 else if /*(startfptr>0) &&*/
553 (currentVoice->buffer[startfptr-1]=='\n')
554 {
555 anf=currentVoice->buffer+startfptr;
556 const char *ss=strchr(anf,'\n');
557 if (ss==NULL) len=strlen(anf);

Callers

nothing calls this directly

Calls 3

fePrintEchoFunction · 0.85
omMarkAsStaticAddrFunction · 0.85
feShowPromptFunction · 0.85

Tested by

no test coverage detected