This directory contains a modified version of the "kas2c" utility, included
with the original Homeworld source in the "tools/win32/KAS" directory.
Originally, kas2c was modified to allow compiling under Unix and to support
GCC's preprocessor output.  Later revisions were made to deal with issues that
prevented portability of saved games (since this was never done in the
original version of Homeworld, only Homeworld SDL features this).

In short, KAS files are scripts used to define missions within Homeworld.
kas2c allows you to convert preprocessed KAS scripts to C code that can be
used with Homeworld.  This is used for all the single player missions and the
training mission.

To convert a KAS script to C code, you first need to run it through a C
preprocessor.  This version of kas2c was modified to work around the output
generated by GCC's preprocessor (the version in the original Homeworld source
was based around Visual C++'s preprocessor output).  As such, instructions are
are geared around GCC and may or may not work with your compiler.

To preprocess the script, use the following command:

  gcc -E -x c level.kas > level.kp

Where "level.kas" is the KAS script you want to convert, and "level.kp" is the
destination where the preprocessed output should go.  The "-E" option tells
GCC to just run the preprocessor, while the "-x c" option tells the
preprocessor to interpret the input file as C code (otherwise, GCC will think
the input file is a pre-compiled object file and not send it to the
preprocessor).  You can also use "cpp" in place of "gcc -E" if you wish (the
"-x c" flag is not needed if you do so, since the preprocessor itself
inteprets unknown extensions as C input).

Once the .kp file is generated, it needs to be run through kas2c, which will
generate a C header file and two source files: one for the KAS C code and
another for keeping track of function pointers for use in save games.  Parse
it using the following command:

  ./kas2c level.kp level.c level.h level.functions.c

Where "level.kp" is the preprocessed KAS script generated by the previous
step, "level.c" is the destination C source file for the KAS code, "level.h"
is the destination header file, and "level.functions.c" is the destination source
file for the level function list.  Order is important, as kas2c does not check
the extensions.

Note that the last parameter is optional.  If it is not used, a source file
containing the level function list will not be created.  The header file will
also not contain a reference to the function pointer list.

Now, you should have a C source and header file containing the C code
equivalent of your KAS file.  Whee!
