|
Post by Stefan on Feb 23, 2022 17:58:52 GMT -5
Hi George,
It seems LOCATE is inconsistent compared to other commands, when it fails to locate whatever it is looking for.
Example:
"FIND ALL xxxx" replies either "Chars xxxx found n times" or "Chars xxxx not found" "TAG ALL OFF :DP" replies either "Tagged set off on n lines" or "No lines (re)tagged"
"LOCATE ALL :DP" replies either "LOCATE matched n lines" or "+LOCATE matched 0 lines" but followed by "Bottom of data reached"
Sharp-eyed users will spot the '+' before the word LOCATE, indicating that a further message(s) was/were issued as well.
In a macro, the additional message is an issue because the Get_Msg$ function returns the last, not the first message from the command.
Consider this:
SPF_CMD("LOCATE ALL :DP") ' Gives msg "LOCATE matched n lines" count = Parse$(Get_Msg$," ",3) It works fine if 'n' is non-zero because LOCATE issues only a single message. If 'n' is zero (nothing found), the Get_Msg$ function returns the 2nd (last) message instead.
Naturally, one can code around it, but the question "why does LOCATE issue a superflous additional message" remains.
|
|
|
Post by George on Feb 24, 2022 12:10:11 GMT -5
Stefan: LOCATE has so many variations that some errors are detected and reported by the main LOCATE command processor, some are issued directly by the lower level search routine, and some by the main command processor only after the lower level search routine has been called. A sad consequence of years of bolting on additional features.
I believe it should now be better, I'll post a Beta for you to try.
George
===> And if anyone's looking for a scapegoat to blame, by all means it is me. I'm the one that goaded George into adding all those features to LOCATE. I still think they are good, but they unquestionably add complexity, not all of which was well planned out in advance - R
|
|
|
Post by Stefan on Feb 25, 2022 4:35:35 GMT -5
No worries, Guys!
I've no complaints about LOCATE at all. It is a VERY capable and useful command. In fact, the LP.MACRO command I placed in 'Contributed Macros' started life as a SET ALIAS.L override for L (LOCATE). It was checking for its own ARGs first, but if it found other ARGs as well, it would simply pass the lot to normal LOCATE. Then, as it became more complicated, I decided to split the two concepts. These things just happen when there's a bit of unplanned scope creep.
Thanks for the beta, George. I'll give it a try in a few days.
|
|