Members of the Forum -
I just tracked down a bug in "fixargs.ijs" whereby it failed to fully
convert all my old code from using the "y." to "y" etc. argument convention.
The function "fixarg" seems to fail silently for any file with double-byte
characters in it. My subject line refers to (one place) where the problem
cropped up: I have some code converted from APL in which I've retained the
old APL code as comments. Once again, that lovely character set causes
problems.
The root cause appears to be in the regular expression code which apparently
doesn't play well with the double-byte characters. It fails to match the
target string if there's such a character anywhere in the source string.
Here's a short example of the problem:
load 'regex'
]str=. a.{~67 104 97 114 97 99 116 101 114 32 133 32 110 117 109 98 101
114
Character ? number
'er' rxmatches str NB. No result though there should be two matches.
'er' rxmatch str
_1 0
NB. But if we replace one (double-byte flag) character by a space:
'er' rxmatches (' ') 10}str
7 2
16 2
The good fix for this - removing the offending characters, fixing the code,
then replacing the removed characters - appears complicated by the fact that
the (initial) replacement in "fixarg" - the line "y=. ((sx;,2);x) rxrplc y"
- changes the length of the string. It's probably OK to remove but
not replace these characters but I'm not exactly sure how to identify them.
Any ideas?
Thanks,
Devon
--
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm