Possible EU interpreter error

new topic     » topic index » view thread      » older message » newer message

Has somebody had a problem like this?
I am using version 2.1 complete under DOS.
I think there is a problem with garbage collection routines.
The only difference is that the routine that works, does all the testing
and changes
on the same input line, which after that is written to the output.
The one that fails (first one), uses a u sequence that is intializad
every line
read from the input, and a c character value that is used to copy
and compare every character of the input line (substitute 2 special
occurrences by 'N'),
and then append it to the u output variable before it is sent to the
output file.

Although the example is trivial, it could indicate an important error in
the interpreter.

The code listed next gives me an end of memory or memory exhausted
error:

x=1
while 1 do
    t=gets(f1)   --read input line
    if atom(t) then
 if t<0 then
     exit
 end if
    end if
    x=x+1
    if remainder(x,200)=1 then
 puts(1,'.')          --show the program is running......
    end if
    u={}                  --initialize output u sequence before every
line is processed
    for i=1 to length(t) by 1 do
 c=t[i]               --temporary variable for every character in input
line t
 if c=209 or c=241 then
     c='N'
 end if
 u&=c                 --append character to output sequence
    end for
    puts(f2,u)   --write output line
end while

I modified it as follows (all the work is done on the same input
sequence t),
and it worked OK:

x=1
while 1 do
    t=gets(f1)
    if atom(t) then
 if t<0 then
     exit
 end if
    end if
    x=x+1
    if remainder(x,200)=1 then
 puts(1,'.')
    end if
    u={}
    for i=1 to length(t) by 1 do
 if t[i]=209 or t[i]=241 then
     t[i]='N'
 end if
    end for
    puts(f2,t)
end while

--NOTE: all of the input lines are less than 200 characters each

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu