]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - doc.html
Document -redirout/-redirerr + -nocolor for compiler options
[xonotic/gmqcc.git] / doc.html
index d3074f11d053214c2287504acbb81395cc8e55a4..b5ee86860f9b7726585894d75171a01475a74aa2 100644 (file)
--- a/doc.html
+++ b/doc.html
@@ -3,7 +3,7 @@
     <head>
         <meta charset="utf-8">
         <meta http-equiv="X-UA-Compatible" content="chrome=1">
-        <title>GMQCC by graphitemaster</title>
+        <title>GMQCC</title>
 
         <link rel="stylesheet" href="stylesheets/styles.css">
         <link rel="stylesheet" href="stylesheets/pygment_trac.css">
@@ -20,8 +20,8 @@
                 <h1 class="header">GMQCC</h1>
                 <p class="header">An Improved Quake C Compiler</p>
                 <ul>
-                    <li class="download"><a href="https://github.com/graphitemaster/gmqcc/zipball/master">Download ZIP</a></li>
-                    <li class="download"><a href="https://github.com/graphitemaster/gmqcc/tarball/master">Download TAR</a></li>
+                    <li class="buttons"><a href=index.html>Index</a></li>
+                    <li class="download"><a href="https://github.com/graphitemaster/gmqcc/archive/0.1.zip">Download v0.1</a></li>
                     <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>
@@ -32,6 +32,7 @@
                     <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>
+                    <li class="wiki"><a class="wiki" href="#vdoc">Virtual Machine Documentation</a></li>
                 </ul>
                 <h1><a name="cdoc">Compiler Documentation</a></h1>
                 <h3>Defaults Flag</h3>
                     </tr>
                 </table>
                 <p>
-                    Individual warnings may be disabled with &nbsp;-Wno&lt;warning&gt;
+                    Individual warnings may be disabled with &nbsp;-Wno-&lt;warning&gt;
                     <pre>$ gmqcc -Wno-frame-macros # disables frame duplication warning</pre>
                 </p>
                 <h3>Miscellaneous options</h3>
                         <td>-fhelp or -f?</td>
                         <td>Lists all code generation options</td>
                     </tr>
+                    <tr>
+                        <td>-redirout=&lt;file&gt;</td>
+                        <td>Redirect stdout to any file.</td>
+                    </tr>
+                    <tr>
+                        <td>-redirerr=&lt;file&gt;</td>
+                        <td>Redirect stderr to any file.</td>
+                    </tr>
+                    <tr>
+                        <td>-nocolor</td>
+                        <td>Turn off colored stdout/stderr.</td>
+                    </tr>
                 </table>
                 
                 <h1><a name="bdoc">Building Documentation</a></h1>
@@ -357,12 +370,237 @@ $ cd gmqcc
                 </p>
                 
                 <h1><a name="tdoc">Testsuite Documentation</a></h1>
+                <h2>Running The Testsuite</h2>
                 <p>
-                    GMQCC comes with a complete testsuite system for verifying semantics
-                    and syntatics, TODO explain more and how to use it, write your own
-                    tests etc....
+                    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=&lt;file&gt;</td>
+                            <td>Redirect stdout to any file.</td>
+                        </tr>
+                        <tr>
+                            <td>-redirerr=&lt;file&gt;</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>
+                </p>
+                <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&nbsp;
+                                   This simply performs compilation only</li>
+                               <li>-execute&nbsp;
+                                   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>
+                <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 &nbsp;main&nbsp;  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 &nbsp;main&nbsp; 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 &nbsp;main&nbsp
+                    
+                    <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 &nbsp;main&nbsp;'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>
+                    </table>
                 </p>
-                
                 <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>