The built in RENUM command is pretty flexible. Maybe someone out there is working on a BASIC program to manipulate other BASIC programs? Anyone? Anyone?
I think you should be able to do it if you save the BASIC program as an ASCII file (with the SAVE "FILENAME",A Option). Then you should be able OPEN "FILENAME" FOR INPUT AS 1. Then set up a LOOP to LINE INPUT #1 into a string ARRAY (A$(1)-A$(x)). As long as each line ends with a CR it should work. Use ON ERROR GOTO xx to escape the loop when the End of FIle (eof error) is reached.
Once the ARRAY is set up, you can scan through the strings and find (and optionally strip out) the line numbers. You can create a similar array of the line numbers found (A(1)-A(x)) which you can manipulate until it works. Then you can re-create the new line numbers as strings and con-catenate them back onto the line strings STR$(A(1)+A$(1). Once completed and verified, you can write them all back into a new file. It should work. It will take a while to code.
I seem to remember some good old books at Radio Shack that did a lot of creative coding to come up with solutions to problems like this. I think I saw some of them on "Archive.org" Good Luck!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am looking for Basic program which makes renumbering of a basic program like Renum command.
The built in RENUM command is pretty flexible. Maybe someone out there is working on a BASIC program to manipulate other BASIC programs? Anyone? Anyone?
I think you should be able to do it if you save the BASIC program as an ASCII file (with the SAVE "FILENAME",A Option). Then you should be able OPEN "FILENAME" FOR INPUT AS 1. Then set up a LOOP to LINE INPUT #1 into a string ARRAY (A$(1)-A$(x)). As long as each line ends with a CR it should work. Use ON ERROR GOTO xx to escape the loop when the End of FIle (eof error) is reached.
Once the ARRAY is set up, you can scan through the strings and find (and optionally strip out) the line numbers. You can create a similar array of the line numbers found (A(1)-A(x)) which you can manipulate until it works. Then you can re-create the new line numbers as strings and con-catenate them back onto the line strings STR$(A(1)+A$(1). Once completed and verified, you can write them all back into a new file. It should work. It will take a while to code.
I seem to remember some good old books at Radio Shack that did a lot of creative coding to come up with solutions to problems like this. I think I saw some of them on "Archive.org" Good Luck!