jed-users mailing list

[2004 Date Index] [2004 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Stack Overflow problem


Hello,

I am running into an odd stack overflow problem in Slang.  The smallest script
that I can write to reproduce this problem is the following:

#!/usr/local/bin/jed -script
variable file,fp,line,count;

file="test.txt";
fp = fopen (file, "r");    % Open the file for reading
count=0;

while (-1 != fgets (&line, fp)) {

  printf("%s",line);
  count=count+1;
  
}

printf("count = %d\n",count);
fclose(fp);
#-----------------------------------------


This script should just print out to the screen the contents of the file.  If
the file is larger than around 2500 lines, then I get an error like:

S-Lang Traceback: (Error occurred processing fp)
S-Lang Error: Stack Overflow: Ref_Type cannot be used in a boolean context
S-Lang Traceback: while
S-Lang Error: Stack Overflow: called from line 13, file: blah.sl

If you comment out the printf, you have no problem.  I have received this
error in other cases, always when reading through a file line-by-line, and
printing to the screen or inserting some lines into a jed buffer.  Is there
something that I am doing wrong here?

I would use a search, instead of a line-by-line scan, but I need a regular
expression with OR (I'm looking for one of 3 things in the file, whichever one
comes first).  This doesn't seem to be supported in Slang.  Any advice?

thanks,

                 bb

-- 
-----------------

            bblais@xxxxxxxxxx
            web.bryant.edu/~bblais


--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2004 date index] [2004 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]