C Preprocessor for ActionScript
The C Preprocessor for ActionScript project is hosted on sourceforge.net. To get it, you’ll have to browse the SVN tree and grab the zip file(s) out of the project root.
It provides a few makefile based methods to invoke various flavors of C preprocessor on ActionScript 3 code destined to be eaten by MXMLC. Tested under jEdit, Visual C/C++ 6, Visual Studio.Net and in CMD under Windows and BASH under Linux. Can be integrated into any IDE or programmer’s editor that can be set up to invoke a makefile script.
Also provides obfuscation in release builds to rename functions & variables to less helpful things, like ‘_213’ to make decompiling your work less fruitful.
It could easily be made to work with the other command-line compilers (such as MTASC).
You could also just grab the bits and pieces you like and do your own thing. It’s ‘public domain’, so take what you want. It’s just make scripts, sed and a tiny C filter tool (with source code, built by make using the GNU or MSVC compiler that the C preprocessor is borrowed from) that ‘fixes’ preprocessor output so it lines up with the original input files.
Now supports building through Flash 8 or Flash CS3/CS4. The Makefile edits a .jsfl script to build the project for you. Supports big projects with multiple FLA to SWF files, so when you modify one .h file or .FLA file or .as file, all of the affected sub-projects also get published. Performs incremental builds and prevents annoying runs of unsuccessful builds. The Makefile integrates into external IDEs (like jEdit) nicely. Also supports running Flash 8 under WINE+Linux.
The .jsfl script can be edited and used alone or with other tools to get the error output and flash builds under control from an external IDE using the make as an example, to collect errors and do further build/publish steps, such as ftp/ssh to a web site. Basically the end step of the jsfl script is to create an error log, so if you wait for that file to exist, then wait an additional moment, then test to see if it’s zero length, you can tell if the build was successful (nothing in error log) or failed (text exists in error log).
So anyway, for those who for whatever reason don’t like Flex 2 or 3, or who are not permitted to use it because of a retarded company policy to ONLY use some version of Flash, there’s yet another way to build.
Also check the newer ‘complete’ project, which builds any combination of multiple Flash and Flex targets. Works in Windoze or Linux (BASH w/GNU tools).
Also recently added, an Apache ANT build for ANT 1.6 or higher. This build does not actually use the C preprocessor. It uses the replaceregex task as a preprocessor. Simpler than some other ant builds for Flex, as if you have the Flex SDK in your path, it will build. Defining macros is a bit bizarre for non-sed-heads, but the basics are there.
flex2cpp.txt · Last modified: 2009/03/24 15:09 by pingnak