Re: type test broken

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

Kat wrote:
> 
> 
> I added the "if sequence(c)" to strtok-v2-1.e while trying to find why calling
>
> parse() didn't work properly. I called thusly:
> 
> }}}
<eucode>
> include get.e -- for wait_key()
> include wildcard.e -- for upper()
> include Strtok-v2-2.e
> include file.e
> with trace
> 
> object junk, data, writefile
> 
> trace(1)
> data = parse("AbCdEF",{"si",'c'})
> 
> writefile = open("H:\\DataMinerCode\\minenews\\newgetter-wget\\wget\\tmp2-
> parsed.txt","w")
> 
> for loop = 1 to length(data) do
>   
> puts(writefile,data[loop]&"\n====================================
> ====================================\n")
> end for
> close(writefile)
> --junk = wait_key()
> <font color="#330033"></eucode>
{{{
</font>
> 
> I have since rebooted the machine, no joy. I also tried the interpreter in 
> several project directories, in case one of them had been corrupted, no joy. I
>
> also tried both exw.exe and exw40.exe, no joy.

I only have strtok v2.1 (maybe 2.2 is unreleased, couldn't find any 
reference to it other than this post).  I modified it a bit by adding
the test for sequence (str isn't here, so I just did a "? 0").  I also
reformatted some of the code in the big if block where you test for an
atom.  I think the problem was that the "while" was on the same line
as "else" and the tracer skips right over them.  If you move the while
to its own line, you can see that the while condition is evaluated,
and just skips over it.

I did a dissassembly of the il code using ooeu, and the reason for this
I think is that an else doesn't get a STARTLINE opcode, which is what 
the tracer looks for, and since it's not a new line, the while must not
generate it.  So I think that the code is executing properly, but just
looks like it isn't because of the formatting and the peculiarities with
the tracer.
global function parse(sequence s, object c) -- "object" by kat
integer slen, spt, flag, keep, case
sequence parsed, upperc, uppers
keep = 0
case = 0
upperc = ""
uppers = ""

if sequence(c) then
	? 0
end if

if atom(c) then -- kat
  
  c = {c}
  else 
  
  	while equal(c[1],"k") or equal(c[1],"i") do
         if equal(c[1],"k") then
           keep = 1
           c = c[2..length(c)]
         end if
         if equal(c[1],"i") then
           case = 1
           c = c[2..length(c)]
         end if
    end while
end if -- kat


Matt Lewis

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

Search



Quick Links

User menu

Not signed in.

Misc Menu