|
Post by Robert on Jul 2, 2024 14:38:13 GMT -5
I basically agree with you. Making new Z names isn't the hard part, it's getting their definitions set correctly at the right time in the right place. All told it won't take many lines. I'd just say, be very careful what names you pick.
But, I gotta say, the idea of being able to assign one label to another just seems like such a cool thought. Even if you didn't want two different syntaxes for SET which I understand, you could still do this:
ASSIGN .A = .ZFIND
cause right now there is no such command as ASSIGN. I have a feeling that this command could come in real handy one day.
Why not mull it over for a while. No pressure.
R
===> Maybe LABEL is better than ASSIGN
|
|
|
Post by Robert on Jul 2, 2024 18:02:58 GMT -5
A LABEL.MACRO could be made to do the above. Of course, you couldn't call it FROM a macro, but it would just take a couple calls to LPTR functions (I think).
Let me see what I can come up with ...
OK, I believe this is what LABEL.MACRO would need:
1. Syntax:
LABEL .dest-label = .source-label
2. I personally would create aliases to shorten the name:
SET LAB = LABEL SET LBL = LABEL
3. The .dest-label would be an ordinary label containing a dot followed by 1 to 7 letters, the first of which cannot be Z.
4. The .source-label would be a dot followed by letters or numbers. If it doesn't follow this format, an error is reported and .source-label is treated as undefined.
5. If the .source-label were NULL or NONE or .0 then the .dest-label would be unassigned. .dest-label also gets unassigned in case the .source-label were undefined.
6. The .dest-label would get assigned using a call to SPF_CMD("LINE " & "`" dest_label_str & "` , " & source_label_str)
I think that would do it. This is the idea, which needs to be tested; the syntax for the SPF_CMD is tricky and needs a close look.
I will work on trying to make this tomorrow.
R
|
|
|
Post by George on Jul 3, 2024 13:16:14 GMT -5
Robert: OK, I've 'corrected' the .Zxxx stuff.
.ZFIND and .ZLOC now reference the last one found, as documented.
.ZFINDA / ZFINDB / .ZLOCA / .ZLOCB were created to specifically point at the first(A) and Last(B) of their respective searches.
This will be in the 24185 + Beta.
George
|
|
|
Post by Robert on Jul 3, 2024 14:36:59 GMT -5
I am very pleased to see this. It avoids pulling the rug out from users who expected the Help to be followed, and it adds support when first vs. last is important.
Now we just have to make sure the stuff Mueh was complaining about is working correctly.
R
|
|
|
Post by mueh on Jul 4, 2024 1:33:23 GMT -5
Hi George ! Thanks for 24185 which solves .ZFIND is invalid . There is a small concern when no find cmd was done . SHOW .ZFIND .10 or LOC .ZFIND results correctly in ".ZFIND is undefined" when x all;show .zfind .10 is done you get now different result with 24185 . ![](//storage.proboards.com/3714814/thumbnailer/uCqIDTbsEkADwdBjSlQp.png) Instance V is 24069 lvl and works the same as Instance U 24152 lvl . X all seems to define .ZFIND and with 24185 lvl it is set to last data line -1 while previously it was line 1 . It doesn't bother me much since i do valid find after X all and before SHOW . Maybe X all should not define and set .ZFIND to line 1 or with 24185 to last data line -1 . This seems to be an old error that 'X all' looses previous .ZFIND and doesn't agree with DOC . find ddd x all;show .zfind .10 Thanks did another test loc .10;x all;loc .ZLOC and result is Line 9 in all versions . if you exclude several single lines instead of 'x all' the results is expected .ZLOC minus nr of x line's . seems it saves LPtr instead of LNum . P.S. RENUM cmd can be deleted from Doc too . I would also find the LABEL cmd very usefull .
|
|
|
Post by George on Jul 4, 2024 8:29:49 GMT -5
MUEH: The problem here, is once again the common search routine. EXCLUDE uses it and it's in there that the .ZFIND setting is done.
Basically .ZFIND is set by any command that does any kind of search. And yes, X ALL is treated as a search.
Thanks for the RENUM reminder. I had already removed it. Thanks anyway.
George
|
|
|
Post by George on Jul 4, 2024 11:25:00 GMT -5
Well, I said it was simple, so the LABEL command has been added to the latest Beta (24186). Comments and suggestions are welcomed, this was a quick implementation, so it may not be quite what everyone expects or wants.
The syntax is what I originally proposed.
LABEL .label -- To be assigned to the found line | LAB search-string | LBL [ start-column [ end-column ] ] [ FIRST | LAST | NEXT | PREV ] [ PREFIX | SUFFIX | WORD | CHAR ] [ C ] [ Q ] [ T ] [ LEFT | RIGHT ] [ line-control-range ] -- Minus any other .label references [ color-selection-criteria ] [ X | NX ] [ U | NU ]
|
|
|
Post by Robert on Jul 4, 2024 12:18:55 GMT -5
George,
I issued the following:
FIND ABC FIRST LABEL .A .ZFIND
I was expecting LABEL to assign .A with the location of .ZLAST Instead I got message:
Operand .ZFIND, exceeds the maximum allowed Line References
I checked that .ZFIND is a valid label by doing a LOC .ZFIND and it works fine.
I suspect you cloned the FIND command too closely. "search-string" shouldn't be mandatory here.
R
|
|
|
Post by George on Jul 4, 2024 13:35:08 GMT -5
Robert: Why wasn't the command simply LABEL .A ABC FIRST? That was the intention, to do it in one command.
LABEL doesn't allow other labels as range commands (it gets way too messy).
George
|
|
|
Post by Robert on Jul 4, 2024 16:38:19 GMT -5
Why didn't I do it that way? Well, because MY first intention was to do this:
FIND ABC FIRST SET .A = .ZFIND etc.
AND, I never envisioned you making a LABEL command and putting the full FIND syntax into the thing; I was trying to save you some work by not asking too much. And besides, I was trying to create a general-purpose label-assignment command. That what my LABEL.MACRO was going to do.
When my LABEL macro saw LABEL .A = .ZFIND it was just going to take the LNUM of the right hand side and set a label called .A at the LNUM where the .ZFIND (or any other) label was. For purposes of the macro, the right-hand side was merely a label reference, NOT a general-purpose line reference.
One other reason to not bundle the FIND logic with LABEL is you might want to find lines using LOCATE, and then set some label to .ZLOC instead of .ZFIND. Right now, your LABEL command can't really do that, because might want to LOCATE NEXT TAG or something, a thing that FIND or your LABEL command can't really do.
Since you have made LABEL from a variant of the FIND command, I don't know if you could even make a simple, general purpose label-assignment out of it; I understand the thought about "messy" syntax. You'd have to hack the code to even try.
Maybe I will keep writing my LABEL.MACRO after all, with some other name.
R
|
|
|
Post by George on Jul 5, 2024 11:42:36 GMT -5
Robert: You mean you want to say LABEL .AAA .BBB (i.e. set .AAA into line currently marked .BBB (thus destroying .BBB ?)
Mark me confused, I've no idea what you're trying to accomplish here. Or or you still focussed on some kind of SET enhancement? Also what does "general purpose label assignment" mean.
George
|
|
|
Post by Robert on Jul 5, 2024 13:33:48 GMT -5
Yes, that's what I meant, and that is basically what a general purpose label assignment is. The exact command name is not critical, whether it was called SET or LABEL.
When you manually set a line label on a line, it defines the label, and removes any prior label that was there. So, LABEL .AAA .BBB would be the same as tying .AAA wherever .BBB happened to be.
I will try to explain the rationale. Suppose you had a range of lines with .A as the first line and .B as the second line. Now, suppose you want to move that range forward, requiring you to redefine .A and .B Say you did this:
LOC .B FIND or LOCATE some line LABEL .A .B --- "TOP" OF RANGE IS SET TO OLD RANGE'S LAST LINE LABEL .B .ZFIND --or-- LABEL .B .ZLOC
That was the basic idea. Again, I realize you are limited in what your syntax can handle, so I think I still have a case for me writing that macro. I don't really expect you to support this.
P.S. I can see a need to support some simple "label arithmetic". Suppose in the example above, I wanted .A to be the line AFTER where .B was before. I wish I could do something like this:
LABEL .A .B+1
The "arithmetic" would be +|- a constant.
R
|
|
|
Post by George on Jul 5, 2024 15:13:37 GMT -5
Robert: You do love to expand an idea, don't you.
No, I think LABEL stays as it is. Maybe your macro could look after label re-assignment (with +/- adjustments)
Maybe ASSIGN .label .label[+|-nnn) (It would have to adjust over non-data lines)
George
|
|
|
Post by Robert on Jul 5, 2024 18:52:07 GMT -5
I am good with what you are doing with LABEL. I am relieved that this didn't end up as an argument.
I was thinking about how labels are similar to "relocatable addresses" in assembler. So, if A and B were assembler labels, and A precedes B, you can normally define a constant length like this:
A DC 'ABCD' DC '-XYZ' A_LEN EQU *-A
BUFFER DS CL(A_LEN) MVC BUFFER,A
So if such a thing were possible in SPFLite, you could figure out the number of lines between .A and .B by doing a calculation like (.B-.A). The trick would be how to grab that value and use it in a command.
Yeah, I'm the idea guy. What can I say?
R
|
|
|
Post by George on Jul 6, 2024 9:05:21 GMT -5
Robert: Was thinking about the LABEL command. It could be extended like this. Basically 3 formats in one based on the presence of a :tag, a string-literal or a 2nd .label.
+-- string-literal -- normal FIND type options ---------------------+ <=== the current Beta version | | | | LABEL -- .target-label >-+-- .Current-label -------------------------------------------------+--> [ +|-nnn | | | | +-- :tag -- [ NEXT | PREV | FIRST | LAST ] -- line-range-operands --+ ----
Operands can be in any order BUT the 1st encountered .label becomes the .target-label. Other labels could be present in the string-literal and :Tag versions to specify a line range.
So a command could be:
LABEL .AA FIRST 'FRED' To do a simple assignment LABEL .AA FIRST 'FRED' +3 Same but assigns it 3 lines later LABEL .AA .BB Assign .AA on the .BB line, replacing .BB LABEL .AA .BB -5 Assign .AA 5 lines before .BB LABEL .AA :XX FIRST Assign .AA to the 1st :XX tagged line LABEL .AA :XX LAST +1 Assign .AA one line past the LAST :XX tag. LABEL .AA :XX FIRST .C .D Assign .AA to the FIRST :XX in lines from .C to .D
Comments?
|
|