× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On Thu, Oct 12, 2017 at 2:07 PM, Buck Calabro <kc2hiz@xxxxxxxxx> wrote:
[Re: Option 1 - Transform GOTOs into LEAVEs in a DO loop]

This pattern is nice because when I go to add a new condition, the LEAVE
is automatic in my head due to the DO. So when I'm maintaining this a
year from now I'm unlikely to break it by adding new code. The downside
is that the DO triggers an expectation of a loop.

[Re: Option 2 - Transform GOTOs into EXSRs]

Although I've done this, I don't care for it. EXSR is hard-wired in my
head that the code will go there _and come back_ -- but it never does in
this case. The name @END_PROGRAM is a good hint about that though :-)

Charles wrote, in response to Kevin:
GOTO converted to LEAVSR only works if the GOTO is in a SR and
the going to the end of the SR.

Not the case here.

Ah, but it could be!

I can't say what Kevin's tooling does, but if you can wrap a chunk of
code in an artificial DO loop (so that you can use LEAVE), then you
could also (in principle) wrap that same chunk of code in a
subroutine, so that you can use LEAVESR.

Then leave setting the indicator and RETURN in the (syntactic) mainline.

So, something along the lines of

//syntactic mainline
exsr @MAIN;
parm12 = *in12;
return;
...
begsr @MAIN;
//semantic mainline part1
if something LEAVESR
//semantic mainline part2
if somethingelse LEAVESR
//semantic mainline part 3
endsr;

I realize it feels kind of radical to "move" so much code to "the
bottom". But it would be one way to get rid of the GOTOs without
introducing a loop.

John Y.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.