REM Line Remover!!! - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: Qbasic "like" compilers/interpreters (http://qbasicnews.com/newforum/forum-5.html) +--- Forum: FB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-15.html) +---- Forum: FB Projects (http://qbasicnews.com/newforum/forum-16.html) +---- Thread: REM Line Remover!!! (/thread-6800.html) Pages:
1
2
|
REM Line Remover!!! - Rattrapmax6 - 04-07-2005 Realesing this as source, very compact.. What it does: Removes un-used lines in a proggram. REMs and whitespaces Reduces size of program (if there is anything to remove) Leaves ('$INCLUDE's alone and unharmed.. Keeps a backup, or you can make it overwrite a file (Not Recomended, anything can happen).. :wink: What it doesn't PRINT "Hello" 'Remove a REM on the side of a line Example: Took Rlesoft's Julia Rings From : 224 Lines of code.. To: 175 Lines of code.. And it still worked!! Minus the "SLEEP 100" it should run in QB also.. Or for faster speeds, just for looks.. speed is good either way.. :wink: Here it is... Code: PRINT "REM Line Remover 1000!" Enjoy!!!! REM Line Remover!!! - steven_basic - 04-07-2005 Why would you want to do this? It will not effect the final compiled program and removing any programmer comments and white space (lines) would make the source harder to read. REM Line Remover!!! - na_th_an - 04-07-2005 All hail the code obfuscator! I'd rather have a program which did just the contrary. REM Line Remover!!! - Antoni Gual - 04-07-2005 Good idea! A program adding random rem lines would be a good obfuscator too.... REM Line Remover!!! - fsw - 04-07-2005 Or one that adds comments :o REM Line Remover!!! - Rattrapmax6 - 04-08-2005 :lol: Finialy I manage the comments I expected!!!! *Runs and jumps for joy* Just something simple I wanted to play with, and, If I ever get the time, I was planning to make one that added remlines (comments on funtions used).. :wink: And, just in case of the event that your proggy passes 2gigs (thats FB's limit right?) You can crunch it with this, he he, most unlikly tho it can happen.. :lol: :rotfl: Edit: it should also double for QB where space is needed most, and alows you to comment and order your proggy w/o the worry of removing 'em yorself in the end.. :wink: .. But I did this in FB, the FBIDE is more colorful, and I can focus better.. REM Line Remover!!! - Kylemc - 04-08-2005 How would you write a program that added any meaningful comments, as the program wouldn't know what the different variables mean, etc. The most you could do to this line: LET A=2 would be 'make A equal 2 IMO you could not make a program that would tell the person reading the source any more than he already knew, not without a lot of work anyway. REM Line Remover!!! - Rattrapmax6 - 04-08-2005 Eh, what in the case a learning programmer (noob) wanted a lil more info on the proggy he/she was looking at.. e.i. it be for standard statement like: Code: LINE (0,0)-(300,200) I'd make it scan an input something like this: Code: 'This is the LINE statement. It draws a line on the screen to givin vectors.. Probaly in a little more detialed,. Just a example.. I'd mostly not bother with LETing varibles,.. unless I made a debbuger on their values.. :wink: REM Line Remover!!! - fsw - 04-08-2005 Quote:fsw Wrote:Or one that adds comments :oHow would you write a program that added any meaningful comments, as the program wouldn't know what the different variables mean, etc. The most you could do to this line: It was a joke... Sorry, should have placed this :rotfl: instead of this :o REM Line Remover!!! - diakin - 04-14-2005 One more example [syntax="qbasic"] '-- ******************************************' sub DelComments (STxt$ as string) 'delete comments in SrcTxt$ 'function tally - see http://forum.qbasicnews.com/viewtopic.php?t=8787 ' qt as string =chr$(34) NQT=tally(STxt$, qt) PQT1=0 PQT2=0 PRem=0 for i=0 to NQT+1 PQT1=instr(PQT2+1,STxt$, qt) if PQT1=0 and PQT2>0 then ' no quotes yet i=NQT+1 else PQT2=instr(PQT1+1,STxt$, qt) end if 'PQT2=instr(PQT1+1,STxt$, qt) PRem=instr(PRem+1,STxt$, "'") if (PRem < PQT1 and PRem >0) or (PQT1=0 and PRem >0) then STxt$=left$(STxt$,PRem-1) 'print"2STxt$=";STxt$ exit for else PRem=PQT2 end if next end sub ' '-- *****************************************' [/syntax] |