Going Native

BlitzMax Forums/Brucey's Modules/Going Native

Brucey(Posted 2016) [#1]
Playing around with the parser this evening, and came up with this...
SuperStrict

Framework brl.standardio

!' int c = 42;
!' printf("c = %d\n", c);fflush(stdout);



Which results in
c = 42


!' - because it needs to be in a comment, otherwise MaxIDE thinks "int" should be "Int"... etc.

Don't know if it has much potential as it stands, other than allowing me to do this:
	!' rmt_BeginCPUSample(delay, 0);
	
	For Local i:Int = 0 Until Rand(1000000)
		j :+ Sin(i)
	Next
	
!' rmt_EndCPUSample();

... where rmt_BeginCPUSample() and rmt_EndCPUSample() are macros rather than real functions, and are not necessarily compiled into the binary...

Just a toy :-p


GW(Posted 2016) [#2]
Sounds neat!
Is there any way you could make the token start with the '
so that vanilla bmax will still compile?


Derron(Posted 2016) [#3]
I had something "similar" in mind (regarding conditionals):
https://github.com/bmx-ng/bcc/issues/83


Instead of
!' bla
you'd better
'! bla
but as Brucey wrote "needs to be in a comment", I think he just had a typo.

This addition is like "'bmk bla" which is already supported by BMK ng (and then doing some extra things).


bye
Ron


GW(Posted 2016) [#4]
"'bmk bla" ??


Derron(Posted 2016) [#5]
' creates version.txt and puts date in it
' @bmk include source/version_script.bmk
' @bmk doVersion source/version.txt



bye
Ron


GW(Posted 2016) [#6]
I don't even know what that means. Is that documented somewhere?


Derron(Posted 2016) [#7]
Dunno...there is also a pre.bmk and post.bmk executed/ handled if they exist in the project folder and you compile something. Good to eg run hooks or create archives.


Bye
Ron