help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

help: fatal flex scanner internal error


From: adler
Subject: help: fatal flex scanner internal error
Date: Sat, 17 Nov 2001 22:27:48 -0500 (EST)

I'm having a wierd problem using octave
with piped stdin.

here's some testcode to illustrate it/

TESTCODE:
   #include <stdio.h>
   #include <unistd.h>

   int main() {
      FILE *fid= popen("octave -qfH","w");
      if ( ! fid ) return -1;
      fprintf(fid, "\ndisp(1)\n"
                     "sleep(1)\n"
                     "disp(2)\n" );
      fflush( fid );

      sleep(2);
      printf("3\n");
      return 0;
   }

   #> gcc ptest.c && ./a.out
   1 \
      > Octave is busy here
   2 <
      > Octave waits here
   3 /

If you press CTRL-C during interval 1-2, all is OK.

   #> gcc ptest.c && ./a.out
   1   (CTRL-C)
   #>
   2   - octave completes disp(2)

However, if you press CTRL-C during interval 2-3, you get errors

   1
   2    (CTRL-C)
   #>
   error: fatal flex scanner internal error--end of buffer missed
   error: fatal flex scanner internal error--end of buffer missed
   error: fatal flex scanner internal error--end of buffer missed
   error: fatal flex scanner internal error--end of buffer missed
   [ SNIP hundreds of times ]
   panic: Segmentation fault -- stopping myself...
   panic: attempted clean up apparently failed -- aborting...


I finally found a fix for this problem by making octave
block on a "fread(stdin,1)" whenever it's not busy.
But this still seems pretty wierd.

   int main() {
      FILE *fid= popen("octave -qfH","w");
      if ( ! fid ) return -1;
      fprintf(fid, "\ndisp(1)\n"
                     "sleep(1)\n"
                     "disp(2)\n" );
      fprintf(fid, "\nfread(stdin,1);\n");
      fflush( fid );

      sleep(2);
      printf("3\n");
      return 0;
   }

Can anyone explain what's going on?

_______________________________________
Andy Adler,                address@hidden




-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]