Remove Remarks for Programs - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Utilities (https://qb64phoenix.com/forum/forumdisplay.php?fid=8) +---- Thread: Remove Remarks for Programs (/showthread.php?tid=3169) Pages:
1
2
|
Remove Remarks for Programs - Pete - 10-26-2024 For @Dimster. (Beta Version). Note: Formerly incorrectly titled as a Remline clone. Thanks ahenry for the heads up! This one lets you use the clipboard to add the path and file name, but if you prefer to just open a dialog box and select the file, I combined my remover with Steve's open dialog in post #14, here: https://qb64phoenix.com/forum/showthread.php?tid=3169&pid=29513#pid29513 Code: (Select All)
Utility to remove remarks and make a new file using your old file name + "_nc" added for "no comments." It will not overwrite your original file and warns if you are going to overwrite a "_nc" file. (Like if you run it more than once). 1) Run program. 2) Go to File Explorer and copy the path to the clipboard. It will be included on the screen. You can also just press Enter if you are working out of the QB64 folder, or you can press the spacebar and it will let you type the path, manually. 3) Do the same for the file name. For .bas files you do not ave to add the extension. 4) Press any key to begin. It will make the new 'remarkless' version and open it in QB64. If you don't want that 'feature' just REMARK out the SHELL statement. This is a beta version, so let me know if you find any bugs or a remark situation it can't handle. Oh, it does remove trailing colons, and lines that are fully remarked, and it also skips removal for any ' or Rem keywords inside quotes. What I didn't add is the remote instances where QB64 programs have that trailing _ symbol to line wrap code that is very long. test file: Name as: "junkme.bas" Code: (Select All)
Pete
RE: Remline clone for QB64. - ahenry3068 - 10-26-2024 We wouldn't be programmers if we didn't reinvent the wheel once in a while. However, I had need last year of a REMLINE program and I found that the original REMLINE from the Qbasic in MS-Dos 5.0 compiles just fine and with no necessary changes in QB64PE. I actually did change exactly 1 line of code. CONST MAXLINES=400 I changed to CONST MAXLINES = 40000 . RE: Remline clone for QB64. - ahenry3068 - 10-26-2024 I guess Pete is not using this the same way I thought. His is remove Remarks instead of Remove Lines. Anyway. If anyone does need to remove some Line numbers from BASIC code the original REMLINE works fine for that. RE: Remline clone for QB64. - Pete - 10-26-2024 I'll pony up a + 1 for that info. Damn conflating. It's been so long I got the REM in REMLINE confused with remarks instead of Remove line numbers. 20 some years back, I made one of those in QBasic. So I'm off to change the title so others don't catch my aging issues. Thanks. Pete - Imagine my embarrassed face. (Well, it's the closest thing we have. I mean, hey, it's red!) RE: Remline clone for QB64. - ahenry3068 - 10-26-2024 (10-26-2024, 04:02 AM)Pete Wrote: I'll pony up a + 1 for that info. Damn conflating. It's been so long I got the REM in REMLINE confused with remarks instead of Remove line numbers. 20 some years back, I made one of those in QBasic. So I'm off to change the title so others don't catch my aging issues. Thanks.Pete, I feel your pain. To make matters worse if you were doing work in QBasic only 20 years ago you were already way out of date. MS-Dos 5.0 (and QBasic with it) was released in June of 1991`over 30 years ago. QuickBasic that it was based on was released 6 years prior to that. I'm allowed to poke a little fun. I'm guessing we are probably no further apart in age than about 10 years at very most. The BASIC programming language is 14 month's younger than I am. RE: Remove Remarks for Programs - SMcNeill - 10-26-2024 That seems like an awful lot of code to do something really simple @Pete How's this work for you? Code: (Select All)
RE: Remove Remarks for Programs - PhilOfPerth - 10-26-2024 (10-26-2024, 08:16 AM)SMcNeill Wrote: That seems like an awful lot of code to do something really simple @Pete Well, that worked (surprise, surprise)! at least, on a 1-liner with code plus ' Edit: and on a 400+ line prog with copious rems RE: Remove Remarks for Programs - Dimster - 10-26-2024 So Pete and Steve, I'm having trouble getting your programs to work for me, and by the way, thanks very much for them. The bulk of my programs are on my D drive, So I'm assuming, when your program asks for the identity of the "File" it's looking in the C drive? Also, Pete's program is asking to "Paste" the name of the file, I've tried a number of ways to this but it keeps displaying the C drive, user,user, qb64pe etc and never gets to any actual file names I do have on the C drive. Is there a limit to the path characters? I have tried to follow your code but not sure how to alter it to recognize my D drive. RE: Remove Remarks for Programs - Dimster - 10-26-2024 Update - Steve's worked perfectly this time and I have no idea what I did to cause it to fail the first time I ran it. File this next comment under "There is no pleasing some folks". The new "no rem" file however has gapping spaces where the old remarks use to be which has me highlighting the gaps to delete them. So kind of back to the same task that "The Lazy Programmer" was trying to avoid. On the other hand it's a really clean look and with all those remarks gone I see new potential in better labels or better placed labels for code sections which cuts the search for these sections (ie the search doesn't hit on every odd match) It's crazy I know but I think I may re-add some Remarks. Thanks again RE: Remove Remarks for Programs - SMcNeill - 10-26-2024 Change line 26 to: If _TRME$(o$) <> "" _OrElse temp$ = "" Then Print #1, o$ That should get rid of those blank lines for you, while preserving blank lines which existed originally in your code between SUBS or whatever. |