Okay, so I'm about as done with my ClassBuilder as I'm going to get. Here's the feature list.
* Public, read-only, write-only and private fields with autogenerated accessor functions. You can specify the size, whether it's signed or unsigned, and give a comment to appear in the class documents that are generated for each field.
* Autogenerated constructor with support for auto-filling fields with the constructor parameters, with the option to embed custom code.
* Autogenerated destructor with the option to embed custom code for cleaning up internal DMA-based fields, with the destructor code automatically passed down the inheritance hierarchy.
* Single inheritance with polymorphism - subclasses can be treated as their base class.
* Polymorphism - inheritable functions will autodetect the object type and call their base class code unless the subclass has overridden the function.
* Limited compile-time type checking - attempts to use fields that don't exist in the specified class will cause an error when the code is being generated.
* Limited run-time type checking - the default set/get functions check the type of the object being used to make sure it is compatible with the class that the set/get function is defined in. If you want type checking in your own functions, you can use the [Class]TypeCompatible(int object) function to determine whether the object is compatible with [Class]. An object is defined as compatible if it is either the same as [Class] or somewhere below [Class] on the inheritance hierarchy.
* Variable-sized class memory - You can specify a number or expression to use for allocating extra memory at the end of an object; I used this to build DMA-based strings and red-black tree nodes.
* class_builder.txt, which has a quick reference of all the commands you can use in your .dma files, as well as a longer description of each that explains how they work and gives examples of input and output.
* and possibly much, much more! ...but probably not -that- much more.
Some limitations:
* An inheritance hierarchy must be fully contained in a single file. I couldn't allow the classes to be split up without also writing a linker for the generator, and I don't love you that much. =D So while you can use multiple files if the classes aren't inheriting from each other, if you use inheritance you have to stick them all in the same file.
* VC syntax errors in your class file are a -little- annoying to track down, since when Verge reports a syntax error on line 53 you have to open the generated .vc file, find line 53, and then change the corresponding line in your class file.
* I've included both the Perl script and an exe version created with perl2exe. If you don't have a Perl interpreter on your machine (and don't want to go to www.activestate.com to get a free one) then you're stuck using the script the way I wrote it. If you do have Perl installed, feel free to rewrite the output functions to fit your style of coding. The default style of autogenerated function names is [Class]Get[Field], [Class]Set[Field], [Class]New and [Class]Free.
Some examples:
* simple.dma is about as simple as you can get, and contains more comments than code. It illustrates setting up a class with two fields and a constructor that will automatically fill the fields in for you.
* codeblock.dma shows you how to add custom functions to your classes.
* simple_inherit.dma shows you how to inherit from another class, and what that means. This example illustrates field inheritance only.
* polymorphic.dma shows how to write polymorphic code.
* system.vc has examples for all of these, and writes a bunch of stuff to v3.log so you can see that it's working.
* string.dma and rbtree.dma are more proofs of concept than examples. string.dma defines a dynamic string that can be translated back and forth between VC strings and DMA strings, and defines string copying and string concatenation operations.
* rbtree.dma is (half) of a red-black tree implementation. Deletion has been left out, because it's been a pain getting it to work without unbalancing the tree, and I don't want to waste any more time on it right now. But insertion and searching both work properly. Red-black trees, for those who aren't familiar with them, are data structures that guarantee search, insert and delete times that grow logarithmically with the number of items you insert.
Installation:
Unzip a fresh copy of the V3 engine into an empty directory and then unzip ClassBuilder on top of it, overwriting any files when it prompts you. Running verge.bat will attempt to recompile the ClassBuilder.pl script (if you have perl2exe installed on your machine), all of the *.dma files will be translated into *.vc files, and then Verge.exe will be run. Check v3.log after it completes, and walk through the example code while reading the log file.
Get it:
Right here