|
Post by mueh on Aug 16, 2023 1:09:50 GMT -5
Hi George ! LOC LONG xx fails with msg "Line reference xx is undefined" if xx is greater then lines in file . Problem occures since 2.7.22344 . No Problem in 2.6.22194 . No problem with LOC SIZE xx . Code in pCmdLOCATE only has ISFALSE %LocSize check but not for %LocLong .
CASE %OpDotd, %OpNum ' A .Label or simple number
IF TRIM$(gCmdOps(i)) = "." THEN _ ' just a dot?
MErrExit(%eFail, "Line reference " + gCmdOps(i) + " is invalid") ' Oops!
j = me.LineNoRef(gCmdOps(i)) ' Get the line number
IF j = -1 AND ISFALSE BIT(LocFlag, %LocSize) THEN _ ' If invalid
MErrExit(%eFail, "Line reference " + gCmdOps(i) + " is undefined") ' Oops!
Thanks to be back .
|
|
|
Post by Robert on Aug 16, 2023 11:15:40 GMT -5
Mueh,
I was able to confirm this. There appears to be a parsing error in Locate.
LOC LONG n is supposed locate lines longer than 'n' columns. (P.S. George, I wish the test were for >= instead of > than.)
What happens is that FIRST, 'n' is being (incorrectly) treated like a line number.
Then, IF the 'line number' is valid, the 'n' is treated like a length.
Conclusion: Mass confusion is going on; there is a dire need for a fix. ---
Also: I issued LOC LONG 2 3 and got, "Using LONG requires LRECL > 0 or a length operand". Very strange.
WHILE I'M AT IT ...
George, there is another locate problem, dealing with colors.
If I have a file with one line that has RED data, and I say LOC RED, the line is not found. If I exclude the whole file and then do FIND P'=' ALL RED, the line is found.
(P.S. I don't want to add work for you, but I find myself wishing that if I say FIND ALL RED that the FIND command would 'see' the color name RED and just assume P'=' but that would be asking a lot.)
R
===> More information
I had a 5-line file with one line having RED. I excluded the file and then said LOC NOT RED ALL
Result: All 5 lines were unexcluded, and I get a message, "LOCATE matched 6 lines". YES, six lines.
If I re-issue the command with all of the lines unexcluded, I get a correct message of 5 lines.
Hmm ...
|
|
|
Post by George on Aug 16, 2023 13:19:16 GMT -5
I hate you guys. I don't need to come back to this.
George
These aren't even triggered by latest changes, they're old ancient bugs.
|
|
|
Post by George on Aug 16, 2023 13:30:23 GMT -5
MUEH: Your correction is valid, thanks for tracking it down.
Robert: LOCATE has been a dumping ground forever for all the various little "let's provide a search for xxx, lets add a search for yyy etc. As such it is a dogs breakfast of pile-on additions and kludges; you couldn't pick a worse command to uncover some obscure bug.
George
|
|
|
Post by Robert on Aug 16, 2023 14:07:22 GMT -5
You know, George, from day one, I knew that adding support for colors as a search criteria - at all - was going to be a problem. It's a complex addition to the logic. You can totally blame me, it's all my fault.
BUT ... I have to say, now that it's here, I have found it really useful. No, not every day in every single edit. But there are times when its invaluable for marking things of 'importance' when I don't want to use labels or tabs or excluded lines.
I *knew* there was a reason you were dragging your feet over getting back online.
YEP, that's my fault too. Hell, every damn thing is my fault. I take the blame. Don't hold back now ...
R
|
|
|
Post by George on Aug 16, 2023 14:08:17 GMT -5
OK, both bugs corrected.
George
Both were very old errors that just had never been stumbled on. I did not even waste time looking for the LOC LONG 10 20 error. If the user codes stupid values and the error message is not quite right - Meh!
|
|