Just been stopped dead by a fault which I cannot track down.  My code is
rejecting a file because it doesn't pass a test, which it should.  It comes
down to comparing two strings, and rejecting the file because they aren't
equal.

But they are.  I can put the two strings into globals, and examine them;
they have the same length (ten characters) and the same characters, whether
compared as characters or as codes from chartonum.  Rev will say that the
two strings are of equal length, and that all characters are the same length
- but that the two strings are not equal.

This script runs over a bunch of files - in the current case about a dozen.
In some cases the strings are equal; some are not - and there's this one
case in which they are equal, but are reported as false.  This is repeatable
even after I've restarted the Mac; and the strange case occurs in the middle
of the run, so it's not a state it's got into; it's a totally repeatable
problem with these two strings.   Here's a function I've now added to flag
up this case:

    function checkEqStrings s1, s2
      if s1 = s2 then return true
      if length(s1) <> length(s2) then return false
      repeat with i = 1 to length(s1)
        if chartonum(char i of s1) <> chartonum(char i of s2) then \
            return false
      end repeat
      -- should never get here!
      return "*******strange case"
    end checkEqStrings

Is there a trick that this function has missed?  Is there any legitimate
situation in which the final line should be reached?

'puzzled of brighton'

  Ben Rubinstein               |  Email: [EMAIL PROTECTED]
  Cognitive Applications Ltd   |  Phone: +44 (0)1273-821600
  http://www.cogapp.com        |  Fax  : +44 (0)1273-728866


_______________________________________________
improve-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/improve-revolution

Reply via email to