Post by Robert on Jul 1, 2024 14:43:11 GMT -5
Hi George,
SPFLite defines certain "special" line labels, among them .ZFIND and .ZLOC. HELP defines these under "Line Labels" as follows:
.ZFIND - to indicate the last (most recent) line found by a FIND command
.ZLOC - to indicate the last (most recent) line found by a LOCATE command
For .ZFIND and .ZLOC, you must have issued at least one prior FIND, CHANGE or LOCATE command for the current file.
This definition implies that the last-processed line, in chronological order, is the line pointed to by .ZFIND or .ZLOC. Up until now, the actual line pointed to is instead the first-processed line, in chronological order. This can be considered to be a "bug" in the sense of non-compliance with the HELP.
Macro users, especially, could make use of having both the first and last lines, chronologically, when ALL is specified on the primary command. It is also desirable not to introduce a new meaning for the current labels, to avoid breaking any existing macros.
For that reason, the following new special labels are proposed:
.ZFINDA, .ZLOCA
first-processed line, in chronological order
.ZFINDB, .ZLOCB
last-processed line, in chronological order
For backward compatibility, .ZFIND = .ZFINDA, and .ZLOC = .ZLOCA
---
There is a possibility to be considered if/when the keyword combination ALL FIRST or ALL LAST is used. Right now, I believe that the only command that uses this is SPLIT, but all other find-like commands accept this syntax and ignore the FIRST or LAST part, and they behave like ALL FIRST. If the day ever came where you allowed processing ALL LAST in end-to-beginning order on find/change-like commands, you might want to be able to identify which is the lowest-numbered line number processed, and the highest-numbered line processed. If that became an issue, I would recommend adding these special line labels:
.ZFINDLO, .ZLOCLO
lowest-numbered line processed
.ZFINDHI, .ZLOCHI
highest-numbered line processed
I don't know if you CAN (or want to) do things like FIND ALL LAST (find in reverse order), but the idea might (?) be useful.
Just a thought.
R
===> Just realized, the LO and HI line references can be determined in a macro by testing Get_Lnum() of the labels in question, so .ZFINDLO, .ZLOCLO, .ZFINDHI, .ZLOCHI aren't strictly needed.
SPFLite defines certain "special" line labels, among them .ZFIND and .ZLOC. HELP defines these under "Line Labels" as follows:
.ZFIND - to indicate the last (most recent) line found by a FIND command
.ZLOC - to indicate the last (most recent) line found by a LOCATE command
For .ZFIND and .ZLOC, you must have issued at least one prior FIND, CHANGE or LOCATE command for the current file.
This definition implies that the last-processed line, in chronological order, is the line pointed to by .ZFIND or .ZLOC. Up until now, the actual line pointed to is instead the first-processed line, in chronological order. This can be considered to be a "bug" in the sense of non-compliance with the HELP.
Macro users, especially, could make use of having both the first and last lines, chronologically, when ALL is specified on the primary command. It is also desirable not to introduce a new meaning for the current labels, to avoid breaking any existing macros.
For that reason, the following new special labels are proposed:
.ZFINDA, .ZLOCA
first-processed line, in chronological order
.ZFINDB, .ZLOCB
last-processed line, in chronological order
For backward compatibility, .ZFIND = .ZFINDA, and .ZLOC = .ZLOCA
---
There is a possibility to be considered if/when the keyword combination ALL FIRST or ALL LAST is used. Right now, I believe that the only command that uses this is SPLIT, but all other find-like commands accept this syntax and ignore the FIRST or LAST part, and they behave like ALL FIRST. If the day ever came where you allowed processing ALL LAST in end-to-beginning order on find/change-like commands, you might want to be able to identify which is the lowest-numbered line number processed, and the highest-numbered line processed. If that became an issue, I would recommend adding these special line labels:
.ZFINDLO, .ZLOCLO
lowest-numbered line processed
.ZFINDHI, .ZLOCHI
highest-numbered line processed
I don't know if you CAN (or want to) do things like FIND ALL LAST (find in reverse order), but the idea might (?) be useful.
Just a thought.
R
===> Just realized, the LO and HI line references can be determined in a macro by testing Get_Lnum() of the labels in question, so .ZFINDLO, .ZLOCLO, .ZFINDHI, .ZLOCHI aren't strictly needed.