In X all functions and objects are in separate files. A build consists of determining library dependencies, optionally preprocessing, and optionally compressing them into one file. Additional files can be inserted into this process at any step.
In the following I describe the tools I use in this build process.
XAG and XPP are both command-line programs written in C. Currently I am compiling them with MinGW using the CodeBlocks IDE. They will compile on both Windows and GNU/Linux. XAG, XPP and the Ant build files are distributed under the terms of the GNU LGPL.
Ant Build Files
The Ant build files automate the use of the following three tools, XAG, XPP and YUICompressor. To run a build you must have Java installed.
See this forum topic on the Ant Build Files for X.
XAG is an X Library file aggregator. It scans your application files and creates a custom X library file which contains only those X variables, functions and objects used in your application.
See the XAG Reference.
XPP is a general purpose text preprocessor. It supports conditional output and simple text replacement. This conditional compilation does not occur at run-time, only at build-time.
See the XPP Reference.
XAG 1.0, XPP 1.0 (11Feb10)
- Improvements and bug fixes.
- I have split the XC project into two separate projects: XAG and XPP. More info coming soon. The previous documentation for XC is still available.
- This version of XC is in the X 4.18 distribution file.
- Thanks to ChrisNelson for ideas on the new hdr option. See this topic.
- Thanks to clowncoder (from the X forums) XC will now compile on Linux as well as Windows! See this topic for details. Thanks also to ChrisNelson.
XC 1.06 (23Jun07)
- This version of XC will be released in the X 4.16 distribution file.
- I found a problem with my previous update to the REL (regular expression literal) detection logic. Now I assume that the only characters that could be to the left of a REL are '=', '(' or ','. A '/' found with one of those characters to its left could not be a division operator. Am I missing anything? Please let me know if you think this is not complete.
- Now if the
app option is true then the application code will be appended to the library code. Previously it was prepended. This makes X functions available to the application code as it is loaded. Typically at this point you want access to xAddEventListener.
XC 1.05 (1Jun07)
- This version of XC will be released in the X 4.15 distribution file.
- XC has a great new feature - Standalone Mode! You can now use XC's compression feature without needing the X Library files.
- Previously, if you chose the "-cmp" option then XC would not fully compress but would still remove blank lines and single-line comments that started at the beginning of a line. Now when you choose "-cmp" XC will remove nothing at all.
- Big changes! I've been doing some rigorous testing on XC and discovered a few problems: (1) The compressor was too agressive in removing sequential spaces - that is now fixed. (2) The compressor did not recognize RegExp literals and removed spaces from them - that is now fixed (but needs more testing). It also properly recognizes escaped foreslashes in RegExp literals. (3) The compressor would sometimes append the first char of one line onto the last char of the previous line, even tho sometimes a space should have been inserted - that is now fixed. This problem was showing itself in the way JScript conditional compilation sections were compressed - but XC now handles them properly.
XC 1.04 (21May07)
- get_symbol_dependents no longer excludes symbols found in "//" comments. In certain situations it was doing it incorrectly. Thanks very much to Cyrillus for the bug report.
- Rewrote processing of start and end of strings. This fixed a problem with detecting escaped backslashes.
- Fixed a problem with ignoring single-line comments inside multi-line comments.
XC 1.03 (26Apr07)
- I caused problems by trying to have xAnimation methods as separate symbols. Now those methods will have symbols like this: "xAnimation.methodName". I modified get_symbol_index and wrote str_tok. This is not a solution, but just a quick bandaid because to get, for example, "xAnimation.css" included in the output library XC must find the symbol "xAnimation.css" somewhere in the source. It can be put in a comment for this purpose. After this I saw that methods could possibly be ouput before their object. I used qsort and wrote compare_fn. Symbols are sorted by type and then by id. The type precedence is: V, O, P, M, F.
XC 1.02 (20Jan07)
- When removing comments, JScript conditional compilation comments are not removed.
XC 1.01 (31Oct06)
- New option: obj - objectify function names. will prefix all X functions with an object name you specify. The xSplitter demo is now using this feature.
- Now +cmp is not required for +obf.
- Wrote stricmp and uitoa to remove some non-ansi functions. Current non-ansi usage (all from io.h): struct _finddata_t, _findfirst, _findnext, _findclose. It should be relatively easy to port to some *nix now.
- Fixed a bug that was in XC 1.0 which prevented a symbol file from being included if there was an app file with the same name and option +app was set.
XC 1.0 (24Oct06)
XC 0.34b (5Oct06)
- Replaces tabs with spaces.
- Now gets version from xLibrary object in xlibrary.js.
- During compression it now checks if a comment directive is in a string.
- Now compression also skips multi-line comments.
- Removed support for these options: lws, nln, and bln.
- For *.htm* app files, only the script elements are parsed for X symbols.
- Now compression also skips sequential spaces, when not in a string.
- Cmp now removes spaces that have a delimiter on one side of it.
- New option: obf - obfuscate function names.
- New option: app - compresses and adds app js files to output.
- Support for the glb option is disabled.
- Now X symbols are not required to have an 'x' prefix.
XC 0.29b (21Sep06)
- Allow .xcp extension on command line arg. Thanks to gagenellina for code.
XC 0.28b (8Aug05)
- Now parses x symbols in quotes. Thanks for bug report from Miguel Angel Alvarez.
XC 0.24b (25May05)
- Removed all txt doc support for now.