2012-11-23 21:41:45 +00:00
|
|
|
<!doctype html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
2012-11-24 02:32:42 +00:00
|
|
|
<title>GMQCC</title>
|
2012-11-23 21:41:45 +00:00
|
|
|
|
|
|
|
<link rel="stylesheet" href="stylesheets/styles.css">
|
|
|
|
<link rel="stylesheet" href="stylesheets/pygment_trac.css">
|
|
|
|
<script src="javascripts/scale.fix.js"></script>
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
|
|
|
<!--[if lt IE 9]>
|
|
|
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
|
|
<![endif]-->
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a href="https://github.com/graphitemaster/gmqcc"><div class="fork"></div></a>
|
|
|
|
<div class="wrapper">
|
|
|
|
<header>
|
|
|
|
<h1 class="header">GMQCC</h1>
|
|
|
|
<p class="header">An Improved Quake C Compiler</p>
|
|
|
|
<ul>
|
2012-11-24 02:30:57 +00:00
|
|
|
<li class="buttons"><a href=index.html>Index</a></li>
|
2012-11-24 21:08:08 +00:00
|
|
|
<li class="download"><a href="https://github.com/graphitemaster/gmqcc/archive/0.1.zip">Download v0.1</a></li>
|
2012-11-23 21:41:45 +00:00
|
|
|
<li class="buttons"><a href="https://github.com/graphitemaster/gmqcc/issues">Issues</a></li>
|
|
|
|
<li class="buttons"><a href="doc.html">Documentation</a></li>
|
|
|
|
<li class="buttons"><a href="https://github.com/graphitemaster/gmqcc">View On GitHub</a></li>
|
|
|
|
</ul>
|
|
|
|
</header>
|
|
|
|
<section>
|
2012-11-24 01:46:48 +00:00
|
|
|
<ul class="wiki">
|
|
|
|
<li class="wiki"><a class="wiki" href="#cdoc">Compiler Documentation</a></li>
|
|
|
|
<li class="wiki"><a class="wiki" href="#bdoc">Building Documentation</a></li>
|
|
|
|
<li class="wiki"><a class="wiki" href="#tdoc">Testsuite Documentation</a></li>
|
2012-11-24 21:03:13 +00:00
|
|
|
<li class="wiki"><a class="wiki" href="#vdoc">Virtual Machine Documentation</a></li>
|
2012-11-24 01:46:48 +00:00
|
|
|
</ul>
|
|
|
|
<h1><a name="cdoc">Compiler Documentation</a></h1>
|
|
|
|
<h3>Defaults Flag</h3>
|
2012-11-23 21:41:45 +00:00
|
|
|
<p>
|
|
|
|
The <i>-show-defaults</i> flag instructs the compiler to print out the defaults used related to
|
|
|
|
the standard, optimization, and code generation. When this flag is specified, the compiler
|
|
|
|
will just print the defaults and quit. No compilation is performed.
|
|
|
|
</p>
|
2012-11-23 21:46:39 +00:00
|
|
|
<pre>$ gmqcc -show-defaults</pre>
|
2012-11-24 01:46:48 +00:00
|
|
|
<h3>Compiling for an alternitive standard</h3>
|
2012-11-23 21:41:45 +00:00
|
|
|
To compile with a different dialect of the QuakeC programming language the <i>-std</i>
|
|
|
|
flag can be instructed to select one of the following options:
|
|
|
|
<table border="0">
|
|
|
|
<tr>
|
|
|
|
<td>gmqcc</td>
|
|
|
|
<td>default standard</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>fteqcc</td>
|
|
|
|
<td>fteqcc standard</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>qcc</td>
|
|
|
|
<td>vanila QuakeC standard</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<h2>Common compiler options</h2>
|
|
|
|
<table border="0">
|
|
|
|
<tr>
|
|
|
|
<td>Options</td>
|
|
|
|
<td>What it does</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-l<path></td>
|
|
|
|
<td>Adds <path> to the directories searched by the preprocessor for include file resolution.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-o <file></td>
|
|
|
|
<td>Generates the named executable (progs.src) file (when not specified default is progs.src).</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td>-O<level></td>
|
2012-11-23 21:48:02 +00:00
|
|
|
<td>Specfies the optimization level: highest being 3, lowest being 0 (no optimization).</td>
|
2012-11-23 21:41:45 +00:00
|
|
|
</tr>
|
2012-12-02 23:54:28 +00:00
|
|
|
<tr>
|
|
|
|
<td>-g</td>
|
|
|
|
<td>Enables generation of debug info for engine backtraces (turns on -flno)</td>
|
|
|
|
</tr>
|
2012-11-23 21:41:45 +00:00
|
|
|
<tr>
|
|
|
|
<td>-E</td>
|
2012-11-23 21:48:31 +00:00
|
|
|
<td>Instructs the compiler to only preprocess the input, writing the preprocessed output to stdout</td>
|
2012-11-23 21:41:45 +00:00
|
|
|
</tr>
|
2012-12-17 15:56:10 +00:00
|
|
|
<tr>
|
|
|
|
<td>-D</td>
|
|
|
|
<td>
|
|
|
|
"define" a macro. Optionally you may supply
|
|
|
|
a value to the macro with "=". Implicitally turns on -fftepp
|
|
|
|
</td>
|
|
|
|
</tr>
|
2012-11-23 21:41:45 +00:00
|
|
|
<tr>
|
|
|
|
<td>-Wall</td>
|
|
|
|
<td>Enables all compiled warnings for the selcted standard</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-Werror</td>
|
|
|
|
<td>Instruct the compiler to treat all warnings as errors</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-std=<standard></td>
|
|
|
|
<td>Selects the standard dialect</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2012-11-24 01:46:48 +00:00
|
|
|
<h3>Predefined Macros</h3>
|
2012-11-23 21:41:45 +00:00
|
|
|
<table border="0">
|
|
|
|
<tr>
|
|
|
|
<td>Macro</td>
|
|
|
|
<td>What it represents</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2012-12-01 20:39:25 +00:00
|
|
|
<td>__STD_GMQCC__</td>
|
2012-11-23 21:41:45 +00:00
|
|
|
<td>Specifies the current selected standard is gmqcc.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2012-12-01 20:39:25 +00:00
|
|
|
<td>__STD_FTEQCC__</td>
|
2012-11-23 21:41:45 +00:00
|
|
|
<td>Specifies the current selected standard is fteqcc.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2012-12-01 20:39:25 +00:00
|
|
|
<td>__STD_QCC__</td>
|
2012-11-23 21:41:45 +00:00
|
|
|
<td>Specifies the current selected standard is qcc.</td>
|
|
|
|
</tr>
|
2012-12-01 20:39:25 +00:00
|
|
|
<tr>
|
|
|
|
<td>GMQCC</td>
|
|
|
|
<td>Defined always regardless of the selected standard</td>
|
|
|
|
</tr>
|
2012-11-23 21:52:38 +00:00
|
|
|
<tr>
|
|
|
|
<td>__STD_VERSION_MINOR__</td>
|
|
|
|
<td>Specifies the current selected stanadards minor version number.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>__STD_VERSION_MAJOR__</td>
|
|
|
|
<td>Specifies the current selected stanadards major version number.</td>
|
|
|
|
</tr>
|
2012-11-23 21:41:45 +00:00
|
|
|
</table>
|
2012-11-24 01:46:48 +00:00
|
|
|
<h3>Unsupported compatability options</h3>
|
2012-11-23 21:41:45 +00:00
|
|
|
<p>
|
|
|
|
GMQCC strives hard for compatability with standard dialects, but not all
|
|
|
|
features of those standards might be implemented. The unsupported features
|
|
|
|
are presented below:
|
|
|
|
<table border="0">
|
|
|
|
<tr>
|
|
|
|
<td>Feature</td>
|
|
|
|
<td>Standard</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Inline Assembly</td>
|
|
|
|
<td>FTEQCC</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Macro expansion in strings</td>
|
|
|
|
<td>FTEQCC</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</p>
|
2012-11-24 01:46:48 +00:00
|
|
|
<h2>Less common compiler options</h2>
|
|
|
|
<h3>Code generation options</h3>
|
2012-11-23 21:41:45 +00:00
|
|
|
<table border="0">
|
|
|
|
<tr>
|
|
|
|
<td>Option</td>
|
|
|
|
<td>What it does</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-foverlap-locals</td>
|
|
|
|
<td>Reduces codesize by overlapping locals where possible</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-fdarkplaces-string-table-bug</td>
|
|
|
|
<td>Works around a bug in older Darkplaces engine builds where the stringtable size is computed wrong</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-fadjust-vector-fields</td>
|
|
|
|
<td>corrects assignment of vector field pointers (STORE_V instead of STORE_FLD)</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-fftepp</td>
|
|
|
|
<td>Enables FTEQ preprocessor</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-frelaxted-switch</td>
|
|
|
|
<td>Relaxes switch statement semantics</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-fshort-logic</td>
|
|
|
|
<td>Enables short circut evaluation/logic</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-fperl-logic</td>
|
2012-11-23 21:45:42 +00:00
|
|
|
<td>Enables perl evalutaion/logic</td>
|
2012-11-23 21:41:45 +00:00
|
|
|
</tr>
|
2012-12-01 20:12:33 +00:00
|
|
|
<tr>
|
|
|
|
<td>-ftranslatable-strings</td>
|
|
|
|
<td>Enables translatable strings via .po file</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-finitialized-nonconstants</td>
|
|
|
|
<td>Prevents initializations from becoming constant unless 'const' is specified as a qualifer</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-fassign-function-types</td>
|
|
|
|
<td>Allows function types to be assignable even if their signature is invariant</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-flno</td>
|
2012-12-02 23:54:28 +00:00
|
|
|
<td>Enables generation of progs.lno for engine VM backtraces (enabled with -g as well)</td>
|
2012-12-01 20:12:33 +00:00
|
|
|
</tr>
|
2012-11-23 21:41:45 +00:00
|
|
|
</table>
|
2012-11-24 01:46:48 +00:00
|
|
|
<h3>Warning options</h3>
|
2012-11-23 21:41:45 +00:00
|
|
|
<table border="0">
|
|
|
|
<tr>
|
|
|
|
<td>Option</td>
|
|
|
|
<td>What it does</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-Wunused-uninitialized</td>
|
|
|
|
<td>Enables warnings about unused or uninitialized variables</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-Wunknwon-control-sequence</td>
|
2012-11-23 21:45:42 +00:00
|
|
|
<td>Enables warnings about unknown control sequences</td>
|
2012-11-23 21:41:45 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-Wextension</td>
|
|
|
|
<td>Enables warnings about the use of (an) extension(s)</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-Wfield-redeclared</td>
|
|
|
|
<td>Enables warnings about redeclared fields</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-Wmissing-return-values</td>
|
|
|
|
<td>Enables warnings about missing return values</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-Wtoo-few-paramaters</td>
|
|
|
|
<td>Enables warnings about missing paramaters for function calls</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-Wlocal-shadows</td>
|
|
|
|
<td>Enables warnings about locals shadowing paramaters or other locals</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-Wlocal-constants</td>
|
|
|
|
<td>Enables warnings about constants specified as locals</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-Wvoid-variables</td>
|
|
|
|
<td>Enables warnings about variables declared as type void</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-Wimplicit-function-pointer</td>
|
|
|
|
<td>Enables warnings about implicitly declared function pointers</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-Wvariadic-function</td>
|
|
|
|
<td>Enables warnings for use of varadics for non-builtin functions</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-Wframe-macros</td>
|
|
|
|
<td>Enables warnings about duplicated frame macros</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-Weffectless-statement</td>
|
|
|
|
<td>Enables warnings about effectiveless statements</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-Wend-sys-field</td>
|
|
|
|
<td>Enables warnings of end_sys_fields being declared a field</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-Wassign-function-types</td>
|
|
|
|
<td>Enables warnings for incompatible function pointer signatures used in assignment</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-Wpreprocessor</td>
|
|
|
|
<td>Enables warnings about redefined macros</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-Wmultifile-if</td>
|
|
|
|
<td>Enables warnings about multifile if statements</td>
|
|
|
|
</tr>
|
2012-12-01 20:12:33 +00:00
|
|
|
<tr>
|
|
|
|
<td>-Wdouble-declaration</td>
|
|
|
|
<td>Enables warnings about double declarations</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-Wconst-var</td>
|
|
|
|
<td>Enables warnings about 'const var' and 'var const'</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-Wmultibyte-character</td>
|
|
|
|
<td>Enables warnings about use of multibyte characters</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-Wternary-precedence</td>
|
|
|
|
<td>Enables warnings about ternary expressions whos precedence may be not what expected</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<table border="0">
|
|
|
|
<tr><td>Options</td><td>What it does</td></tr>
|
|
|
|
<tr>
|
|
|
|
<td>-Otail-recursion</td>
|
|
|
|
<td>Enables tail recursion optimization</td>
|
|
|
|
</tr>
|
2012-11-23 21:41:45 +00:00
|
|
|
</table>
|
|
|
|
<p>
|
2012-11-24 21:10:30 +00:00
|
|
|
Individual warnings may be disabled with -Wno-<warning>
|
2012-11-23 21:41:45 +00:00
|
|
|
<pre>$ gmqcc -Wno-frame-macros # disables frame duplication warning</pre>
|
|
|
|
</p>
|
2012-11-24 01:46:48 +00:00
|
|
|
<h3>Miscellaneous options</h3>
|
2012-11-23 21:41:45 +00:00
|
|
|
<table border="0">
|
|
|
|
<tr>
|
|
|
|
<td>Option</td>
|
|
|
|
<td>What it does</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-force-crc=<num></td>
|
|
|
|
<td>Forces a specific checsum into the header</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-debug</td>
|
|
|
|
<td>Turns on compiler debug messages</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-memchk</td>
|
|
|
|
<td>Turns on compiler memory leak checker</td>
|
|
|
|
</tr>
|
2012-11-23 22:04:30 +00:00
|
|
|
<tr>
|
|
|
|
<td>-Whelp or -W?</td>
|
|
|
|
<td>Lists all warning options</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-fhelp or -f?</td>
|
2012-11-23 22:04:54 +00:00
|
|
|
<td>Lists all code generation options</td>
|
2012-11-23 22:04:30 +00:00
|
|
|
</tr>
|
2012-11-24 21:11:54 +00:00
|
|
|
<tr>
|
|
|
|
<td>-redirout=<file></td>
|
|
|
|
<td>Redirect stdout to any file.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-redirerr=<file></td>
|
|
|
|
<td>Redirect stderr to any file.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-nocolor</td>
|
|
|
|
<td>Turn off colored stdout/stderr.</td>
|
|
|
|
</tr>
|
2012-12-18 05:25:48 +00:00
|
|
|
<tr>
|
|
|
|
<td>-config=<file></td>
|
|
|
|
<td>
|
|
|
|
Supply a configuration file to set options.
|
|
|
|
Note: If a file named <b>gmqcc.ini</b> or
|
|
|
|
<b>gmqcc.cfg</b> is found it will be loaded
|
|
|
|
implicitally.
|
|
|
|
</td>
|
|
|
|
</tr>
|
2012-11-23 21:41:45 +00:00
|
|
|
</table>
|
2012-11-24 01:46:48 +00:00
|
|
|
|
|
|
|
<h1><a name="bdoc">Building Documentation</a></h1>
|
|
|
|
<h2>Building on BSD/NIX</h2>
|
|
|
|
<p>
|
|
|
|
To compile GMQCC on BSD/NIX the following things are
|
|
|
|
required:
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li>GIT</li>
|
|
|
|
<li>Make</li>
|
|
|
|
<li>Any C90+ C compiler</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
Once obtained you may checkout the development repository
|
|
|
|
with the following shell commands
|
|
|
|
|
|
|
|
<pre>$ git clone git://github.com/graphitemaster/gmqcc.git
|
|
|
|
$ cd gmqcc
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
The Makefile contains a few rules, depending on what you
|
|
|
|
want to compile, the following rules are:
|
|
|
|
|
|
|
|
<table border="0">
|
|
|
|
<tr>
|
|
|
|
<td>Rule</td>
|
|
|
|
<td>What it does</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>gmqcc</td>
|
|
|
|
<td>Builds the gmqcc compiler</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>qcvm</td>
|
|
|
|
<td>Builds a standable QuakeC VM</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>testsuite</td>
|
|
|
|
<td>Builds the testsuite for GMQCC</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>all</td>
|
|
|
|
<td>Builds gmqcc, qcvm, and testsuite</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>install</td>
|
|
|
|
<td>Installs gmqcc to /usr/local/</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>check</td>
|
|
|
|
<td>Runs the testsuite to verify correctness</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</p>
|
|
|
|
<h2>Building on Windows</h2>
|
|
|
|
<p>
|
|
|
|
To compile GMQCC on windows the following things are
|
|
|
|
required:
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li><a href="http://msysgit.googlecode.com/files/Git-1.8.0-preview20121022.exe">msysGit</a></li>
|
|
|
|
<li><a href="http://www.microsoft.com/visualstudio/eng/downloads">Visual Studio</a></li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
Once obtained you may checkout the development repository
|
|
|
|
with the following msysGit commands from a msysGit shell.
|
|
|
|
<pre>$ git clone git://github.com/graphitemaster/gmqcc.git</pre>
|
|
|
|
Included is a VS project file.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<h1><a name="tdoc">Testsuite Documentation</a></h1>
|
2012-11-24 02:20:04 +00:00
|
|
|
<h2>Running The Testsuite</h2>
|
2012-11-24 01:46:48 +00:00
|
|
|
<p>
|
2012-11-24 02:20:04 +00:00
|
|
|
To run the testsuite you can either use
|
|
|
|
<pre>$ make check</pre>
|
|
|
|
Or if you're on windows or have already compiled the
|
|
|
|
testsuite from source:
|
|
|
|
<pre>$ ./testsuite </pre>
|
|
|
|
|
|
|
|
Optionally you may provide the testsuite with additional
|
|
|
|
arguments:
|
|
|
|
|
|
|
|
<table border="0">
|
|
|
|
<tr>
|
|
|
|
<td>Argument</td>
|
|
|
|
<td>What it does</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-redirout=<file></td>
|
|
|
|
<td>Redirect stdout to any file.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-redirerr=<file></td>
|
|
|
|
<td>Redirect stderr to any file.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-debug</td>
|
|
|
|
<td>Turn on testsuite debug messages.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-memchk</td>
|
|
|
|
<td>Turn on testsuite memleak checker.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-nocolor</td>
|
|
|
|
<td>Turn off colored stdout/stderr.</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2012-11-24 01:46:48 +00:00
|
|
|
</p>
|
2012-11-24 02:20:04 +00:00
|
|
|
<h2>Writing Tests</h2>
|
|
|
|
<p>
|
|
|
|
GMQCC comes with a complete testsuite for verifying semantics
|
|
|
|
and syntatics. The testsuite executes files from the test/
|
|
|
|
directory, by reading task template files.
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
templates are rules for a specific test, used to create a "task" that
|
|
|
|
is executed with those set of rules (arguments, and what not). Tests
|
|
|
|
that don't have a template with them cannot become tasks, since without
|
|
|
|
the information for that test there is no way to properly "test" them.
|
|
|
|
Rules for these templates are described in a template file, using a
|
|
|
|
task template language.
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
The languge is composed entierly of "tags" which describe a string of
|
|
|
|
text for a task. Think of it much like a configuration file. Except
|
|
|
|
it's been designed to allow flexibility and future support for prodecual
|
|
|
|
semantics.
|
|
|
|
<p>
|
|
|
|
<p>
|
|
|
|
The following "tags" are suported by the language:
|
|
|
|
</p>
|
|
|
|
<table border="0">
|
|
|
|
<tr>
|
|
|
|
<td>Tag</td>
|
|
|
|
<td>Description of what the tag does</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>D:</td>
|
|
|
|
<td>Used to set a description of the current test, this must be
|
|
|
|
provided, this tag is NOT optional.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>F:</td>
|
|
|
|
<td>Used to set a failure message, this message will be displayed
|
|
|
|
if the test fails, this tag is optional.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>S:</td>
|
|
|
|
<td>Used to set a success message, this message will be displayed
|
|
|
|
if the test succeeds, this tag is optional.
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>T:</td>
|
|
|
|
<td>Used to set the procedure for the given task, there are two
|
|
|
|
options for this:
|
|
|
|
<ul>
|
|
|
|
<li>-compile
|
|
|
|
This simply performs compilation only</li>
|
|
|
|
<li>-execute
|
|
|
|
This will perform compilation and execution</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
This tag must be provided, this tag is NOT optional.
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>C:</td>
|
|
|
|
<td>Used to set the compilation flags for the given task, this
|
|
|
|
must be provided, this tag is NOT optional.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>E:</td>
|
|
|
|
<td>Used to set the execution flags for the given task. This tag
|
|
|
|
must be provided if T == -execute, otherwise it's erroneous
|
|
|
|
as compilation only takes place.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>M:</td>
|
|
|
|
<td>Used to describe a string of text that should be matched from
|
|
|
|
the output of executing the task. If this doesn't match the
|
|
|
|
task fails. This tag must be provided at least once if
|
|
|
|
T == -execute, otherwise it's erroneous as compilation only
|
|
|
|
takes place. Multiple M tags are required for multi-line comparision
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>I:</td>
|
|
|
|
<td>Used to specify the INPUT source file to operate on, this must be
|
|
|
|
provided, this tag is NOT optional</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<h3>Notes</h3>
|
|
|
|
<p>
|
|
|
|
These tags (with exception to M) have one-time use, using them more
|
|
|
|
than once will result in template compilation errors,
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
Lines beginning with # or // in the template file are comments and
|
|
|
|
are ignored by the template parser.
|
|
|
|
Whitespace is optional, with exception to the colon ':' between the
|
|
|
|
tag and it's assignment value.
|
|
|
|
</p>
|
|
|
|
The template compiler will detect erronrous tags (optional tags
|
|
|
|
that need not be set), as well as missing tags, and error accordingly
|
|
|
|
which will result in that task failing.
|
|
|
|
</p>
|
2012-11-24 21:03:13 +00:00
|
|
|
<h1><a name="vdoc">Quake C Virtual Machine Documentation</a></h1>
|
|
|
|
<p>
|
|
|
|
Included with GMQCC is a minimal implementation of the QCVM used in many game
|
|
|
|
engines. It's primarly used for the testsuite, but you may also use it as a
|
|
|
|
standalone runtime, or even embed it with existing appliciations.
|
|
|
|
</p>
|
|
|
|
<h2>Running The Standalone VM</h2>
|
|
|
|
<p>
|
|
|
|
To run the standalone application you need to have a compiled progs.dat, with an
|
|
|
|
entry function named main The main function can have any amount of arguments
|
|
|
|
as the standalone executor allows main to be invoked with your choice of arguments.
|
|
|
|
An example of invoking the VM:
|
|
|
|
<pre>$ ./qcvm progs.dat -float 200 #execute passing in 200 as a float to main</pre>
|
|
|
|
If main doesn't require arguments:
|
|
|
|
<pre>$ ./qcvm progs.dat #call main with no arguments</pre>
|
|
|
|
|
|
|
|
The standalone executor supports the following arguments for passing arguments to main 
|
|
|
|
|
|
|
|
<table border="0">
|
|
|
|
<tr>
|
|
|
|
<td>Argument</td>
|
|
|
|
<td>What it does</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-string</td>
|
|
|
|
<td>Passes in a string to main</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-float</td>
|
|
|
|
<td>Passes in a float to main</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-vector</td>
|
|
|
|
<td>Passes in a vector to main</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
The order in which the arguments are expected for main, must be preserved, for
|
|
|
|
example if main 's signature is the following:
|
|
|
|
<pre>void main(float a, vector b)</pre>
|
|
|
|
|
|
|
|
Then to pass the arguments you'd use the same order:
|
|
|
|
<pre>$ ./qcvm -float 200 -vector '1 2 3'</pre>
|
|
|
|
|
|
|
|
<h3>Additional Arguments</h3>
|
|
|
|
The standalone virtual machine has the following optional command line arguments:
|
|
|
|
<table border="0">
|
|
|
|
<tr>
|
|
|
|
<td>Argument</td>
|
|
|
|
<td>What it does</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-trace</td>
|
|
|
|
<td>Trace the execution call hierarchy.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-profile</td>
|
|
|
|
<td>Profile the bytecode to find hotspots.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-info</td>
|
|
|
|
<td>Get info of the running bytecode.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-disasm</td>
|
|
|
|
<td>Dissasemble the bytecode into assembly.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-printdefs</td>
|
|
|
|
<td>Prints all definitions for the bytecode running.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>-printfields</td>
|
|
|
|
<td>Prints all fields for the bytecode running.</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<h3>Builtins</h3>
|
|
|
|
The standalone virtual machine includes the following builtins.
|
|
|
|
<table border="0">
|
|
|
|
<tr>
|
|
|
|
<td>Builtin</td>
|
|
|
|
<td>Number</td>
|
|
|
|
</tr>
|
|
|
|
<tr><td>print</td><td>1</td></tr>
|
|
|
|
<tr><td>ftos</td><td>2</td></tr>
|
|
|
|
<tr><td>spawn</td><td>3</td></tr>
|
|
|
|
<tr><td>kill</td><td>4</td></tr>
|
|
|
|
<tr><td>vtos</td><td>5</td></tr>
|
|
|
|
<tr><td>error</td><td>6</td></tr>
|
|
|
|
<tr><td>vlen</td><td>7</td></tr>
|
|
|
|
<tr><td>etos</td><td>8</td></tr>
|
2012-12-01 20:47:31 +00:00
|
|
|
<tr><td>stof</td><td>9</td></tr>
|
2012-11-24 21:03:13 +00:00
|
|
|
</table>
|
|
|
|
</p>
|
2012-11-23 21:41:45 +00:00
|
|
|
<h3>Support or Contact</h3>
|
|
|
|
<p>Having trouble with GMQCC? Join our IRC channel at #kf-engine on irc.freenode.net or contact <a href="mailto:cube2killfild@gmail.com">Us</a>
|
|
|
|
</section>
|
|
|
|
<footer>
|
|
|
|
<script type="text/javascript" src="http://www.ohloh.net/p/602517/widgets/project_partner_badge.js"></script>
|
|
|
|
</footer>
|
|
|
|
</div>
|
|
|
|
<!--[if !IE]><script>fixScale(document);</script><![endif]-->
|
|
|
|
</body>
|
|
|
|
</html>
|