| 06-16-2006, 04:33 PM | #1 |
I made this more for myself than anything else, but I've been relentlessly poked, prodded and generally molested into releasing it. Inlines constant functions (including ones with arguements), but not return bug ones (ie ones with double returns) and not ones with if/then/else's (<3 tim). No GUI or anything at the moment, type the path and filename in directly *duck*. Made in Python (I'll post the source in my shitty coding if anyone wants). (To install unrar all files from ConstantInlinerFiles.rar to the same directory (you only need to do this the first time, these files stay the same between releases), unrar the .exe from ConstantInlinerExe.rar into the same folder and double click to run) Update: v1 to fix a bug when constant functions called other constant functions. |
| 06-17-2006, 07:14 PM | #2 | |
Quote:
Very handy, I'm glad we finally got you to post this. |
| 06-17-2006, 07:33 PM | #3 |
Nice, but it has bugs =P. Before:constant function DoSomethingWithString takes string s, real a, integer b returns string if a == b then return s+s endif return s endfunction constant function Plus500 takes real a returns real return 500.+a endfunction constant function HMM takes real a, real b returns real return Plus500(a)/Plus500(b) endfunction constant function ab takes integer a, integer b, boolean c returns boolean return (a == b) == c endfunction function test takes nothing returns nothing if ab(400, 300, false) then call BJDebugMsg(DoSomethingWithString("Hello World", 47.3, 45)+SubString(R2S(HMM(324.45, 56.4)), 0, 3)) endif endfunction After:constant function DoSomethingWithString takes string s, real a, integer b returns string if a == b then return s+s endif return s endfunction function test takes nothing returns nothing if ((400) == ( 300)) == ( false) then call BJDebugMsg(DoSomethingWithString("Hello World", 47.3, 45)+SubString(R2S(Plus500((324.45))/Plus500(( 56.4))), 0, 3)) endif endfunction It still uses the Plus500 function in the second example, even though it should have been removed. |
| 06-17-2006, 08:47 PM | #4 |
Constant functions can't call other functions. K thx bai :) Edit: Or so I recall being told. Just checked and it seems you can. Seems semi pointless, but I'll fix it anyway :P. Edit2: Fixed. |
