-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
basic-find-jumps doesn't find all target lines for renumbering #29
Comments
How is ERL used? Is it always used like this? 10 IF ERL = 200 GOTO 9999 Or does it makes sense to write 10 IF ERL <> 200 GOTO 9999 Or even 10 IF ERL = 200 OR ERL = 300 GOTO 9999 |
I don't know what you'll find in the wild, but it makes sense to me to use ERL to check if an error occurred in a particular section of the program. 10 IF ERL >= 200 AND ERL < 300 GOTO 9999 The IBM BASIC 3.0 manual I have (May 1984) specifies that RENUM only works if ERL is used in a constrained way. Specifically,
The use of the term "relational operator" implies to me that 10 IF ERL >= 200 AND ERL < 300 GOTO 9999 ' This gets renumbered correctly
20 IF 200 <= ERL AND ERL < 300 GOTO 9999 ' This fails: "200" is not changed Note: Running Also, when the documentation says the number must be on the right-hand side, it means a literal integer. If someone tries to RENUM a test like |
I will add support for the other relational operators as well. Checking if all referenced line numbers (jump-locations as they are called in the code) and stop with an error if any of them does not exist should probably be a feature request as you write. I think it would be better to check and stop than to create new line numbers. |
Thanks.
Agreed. I think stopping is completely fine since that was good enough when these languages were in common use. By the way, by "virtual" line numbers, I meant that basic-renumber would act like the jump target line exists just during the renumbering so that no other line gets assigned to its position; it wouldn't actually create new line numbers. |
Earlier I said,
I just noticed that one of my official manuals for IBM BASIC actually shows this as the example of RENUM usage: 10 RENUM 1000, 10 I still don't think that was ever valid but thought you'd get a chuckle out of it. |
It would be an interesting way to write a self-modifying program. :) |
Issue #26 lists multiple ways in which line numbers can be referred to in a BASIC program. It appears
basic-renumber
does not yet take some of those into account. In particular, it is missing:For completeness, it may make sense to handle
Note that one reason to not bother being complete is that ranges do not necessarily refer to existing lines. For example, Microsoft's BASIC for the TRS-80 Model 100 allows
10 EDIT 10 - 99
which loads up all the lines between 10 and 99, inclusive, in a text editor.I don't think any version of BASIC allows RENUM in a program, but theoretically it is possible.
The text was updated successfully, but these errors were encountered: