Properties for BlitzMax

BlitzMax Forums/BlitzMax Programming/Properties for BlitzMax

Otus(Posted 2008) [#1]
I'm working on a preprocessor, so I could add extensions to BlitzMax. The first I tried was Properties (like in .NET languages).

I have an alpha version you could try. It is very unfinished (a proof or concept) and will probably throw all sorts of errors at you, if it does not understand your syntax. That said, it should understand most simple syntax, including arbitrarily complicated expressions. Output will not be pretty, though.

Download: MaxPre Alpha (50KB zip)

If you fix the path in bmxpath.zip you will be able to preprocess source files by dragging them on the executable. Try the test file to see how it works.

Basically, using a property in an expression is transformed into a call to GetProperty and assignments to SetProperty. The default implementations for Get and Set methods just pass values from/to a hidden field and can be overridden by declaring a Method of that name.

The question:

Does someone have enough familiarity with BMK to create a hack for running a preprocessor on the source before the compiler? Or better yet, does someone have such a hack already?


Blueapples(Posted 2008) [#2]
Pretty sure you want to look at Function MakeSrc:TFile( src_path$,buildit ) in bmk_make.bmk

I've never put any extensions in myself, but when I was reading the source that looks like the point where files are actually parsed from source so it seems like a good point to put preprocessing code (before the call to ParseSourceFile).


Otus(Posted 2008) [#3]
Thanks, I'll look into it.


Czar Flavius(Posted 2008) [#4]
I remember earlier in the forum someone said they knew how to modify the text of the source code before it was then passed to the compiler.