X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=doc.html;h=e5b768252c831db0fa5cf7f96c3d7cb8d679decd;hb=bcfc9390ac7e98b26cdc6980682264b834844af2;hp=597a0ded5a7fdddd78b427364f97dfd261d82c62;hpb=ac9003ba1d30b0557ab9a0035bd6557e583b2bc7;p=xonotic%2Fgmqcc.git diff --git a/doc.html b/doc.html index 597a0de..e5b7682 100644 --- a/doc.html +++ b/doc.html @@ -3,7 +3,7 @@ - GMQCC by graphitemaster + GMQCC @@ -19,25 +19,30 @@

GMQCC

An Improved Quake C Compiler

-
-

Defaults Flag

+ +

Compiler Documentation

+

Defaults Flag

The -show-defaults 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.

$ gmqcc -show-defaults
- -

Compiling for an alternitive standard

+

Compiling for an alternitive standard

To compile with a different dialect of the QuakeC programming language the -std flag can be instructed to select one of the following options: @@ -54,19 +59,16 @@
vanila QuakeC standard
-

Common compiler options

- - @@ -74,37 +76,31 @@ - + - - + - - -
Options What it does
-l<path> Adds <path> to the directories searched by the preprocessor for include file resolution.
-o <file> Generates the named executable (progs.src) file (when not specified default is progs.src).
-O<level>Specified the optimize level: highest being 3, lowest being 0 (not optimization).Specfies the optimization level: highest being 3, lowest being 0 (no optimization).
-EInstructs the compiler to only preprocess the input, writing the preprocessed source to stdoutInstructs the compiler to only preprocess the input, writing the preprocessed output to stdout
-Wall Enables all compiled warnings for the selcted standard
-Werror Instruct the compiler to treat all warnings as errors
-std=<standard> Selects the standard dialect
- -

Predefined Macros

+

Predefined Macros

- @@ -117,20 +113,29 @@ + + + + + + + + + + + +
Macro What it represents
__STD_GMQCC__ Specifies the current selected standard is gmqcc.__STD_QCC__ Specifies the current selected standard is qcc.
GMQCCDefined always regardless of the selected standard
__STD_VERSION_MINOR__Specifies the current selected stanadards minor version number.
__STD_VERSION_MAJOR__Specifies the current selected stanadards major version number.
- -

Unsupported compatability options

+

Unsupported compatability options

GMQCC strives hard for compatability with standard dialects, but not all features of those standards might be implemented. The unsupported features are presented below: - - @@ -141,169 +146,502 @@
Feature Standard
Inline Assembly FTEQCC

- -

Less common compiler options

-

Code generation options

+

Less common compiler options

+

Code generation options

- - - - - - - + + + + + + + + + + + + + + + +
Option What it does
-foverlap-locals Reduces codesize by overlapping locals where possible
-fdarkplaces-string-table-bug Works around a bug in older Darkplaces engine builds where the stringtable size is computed wrong
-fadjust-vector-fields corrects assignment of vector field pointers (STORE_V instead of STORE_FLD)
-fftepp Enables FTEQ preprocessor
-frelaxted-switch Relaxes switch statement semantics
-fshort-logic Enables short circut evaluation/logic
-fperl-logic Enables perl evalutaion/logic
-ftranslatable-stringsEnables translatable strings via .po file
-finitialized-nonconstantsPrevents initializations from becoming constant unless 'const' is specified as a qualifer
-fassign-function-typesAllows function types to be assignable even if their signature is invariant
-flnoEnables generation of progs.lno for engine VM backtraces
-

Warning options

+

Warning options

- - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +
Option What it does
-Wunused-uninitialized Enables warnings about unused or uninitialized variables
-Wunknwon-control-sequence Enables warnings about unknown control sequences
-Wextension Enables warnings about the use of (an) extension(s)
-Wfield-redeclared Enables warnings about redeclared fields
-Wmissing-return-values Enables warnings about missing return values
-Wtoo-few-paramaters Enables warnings about missing paramaters for function calls
-Wlocal-shadows Enables warnings about locals shadowing paramaters or other locals
-Wlocal-constants Enables warnings about constants specified as locals
-Wvoid-variables Enables warnings about variables declared as type void
-Wimplicit-function-pointer Enables warnings about implicitly declared function pointers
-Wvariadic-function Enables warnings for use of varadics for non-builtin functions
-Wframe-macros Enables warnings about duplicated frame macros
-Weffectless-statement Enables warnings about effectiveless statements
-Wend-sys-field Enables warnings of end_sys_fields being declared a field
-Wassign-function-types Enables warnings for incompatible function pointer signatures used in assignment
-Wpreprocessor Enables warnings about redefined macros
-Wmultifile-if Enables warnings about multifile if statements
-Wdouble-declarationEnables warnings about double declarations
-Wconst-varEnables warnings about 'const var' and 'var const'
-Wmultibyte-characterEnables warnings about use of multibyte characters
-Wternary-precedenceEnables warnings about ternary expressions whos precedence may be not what expected
+ + + + + +
OptionsWhat it does
-Otail-recursionEnables tail recursion optimization

- Individual warnings may be disabled with  -Wno<warning> + Individual warnings may be disabled with  -Wno-<warning>

$ gmqcc -Wno-frame-macros # disables frame duplication warning

-

Miscellaneous options

+

Miscellaneous options

- - - + + + + + + + + + + + + + + + + + + + +
Option What it does
-force-crc=<num> Forces a specific checsum into the header
-debug Turns on compiler debug messages
-memchk Turns on compiler memory leak checker
-Whelp or -W?Lists all warning options
-fhelp or -f?Lists all code generation options
-redirout=<file>Redirect stdout to any file.
-redirerr=<file>Redirect stderr to any file.
-nocolorTurn off colored stdout/stderr.
+

Building Documentation

+

Building on BSD/NIX

+

+ To compile GMQCC on BSD/NIX the following things are + required: + +

+ + Once obtained you may checkout the development repository + with the following shell commands + +
$ git clone git://github.com/graphitemaster/gmqcc.git
+$ cd gmqcc
+
+ + The Makefile contains a few rules, depending on what you + want to compile, the following rules are: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
RuleWhat it does
gmqccBuilds the gmqcc compiler
qcvmBuilds a standable QuakeC VM
testsuiteBuilds the testsuite for GMQCC
allBuilds gmqcc, qcvm, and testsuite
installInstalls gmqcc to /usr/local/
checkRuns the testsuite to verify correctness
+

+

Building on Windows

+

+ To compile GMQCC on windows the following things are + required: + +

+ + Once obtained you may checkout the development repository + with the following msysGit commands from a msysGit shell. +
$ git clone git://github.com/graphitemaster/gmqcc.git
+ Included is a VS project file. +

+ +

Testsuite Documentation

+

Running The Testsuite

+

+ To run the testsuite you can either use +

$ make check
+ Or if you're on windows or have already compiled the + testsuite from source: +
$ ./testsuite 
+ + Optionally you may provide the testsuite with additional + arguments: + + + + + + + + + + + + + + + + + + + + + + + + + + +
ArgumentWhat it does
-redirout=<file>Redirect stdout to any file.
-redirerr=<file>Redirect stderr to any file.
-debugTurn on testsuite debug messages.
-memchkTurn on testsuite memleak checker.
-nocolorTurn off colored stdout/stderr.
+

+

Writing Tests

+

+ GMQCC comes with a complete testsuite for verifying semantics + and syntatics. The testsuite executes files from the test/ + directory, by reading task template files. +

+

+ 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. +

+

+ 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. +

+

+ The following "tags" are suported by the language: +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TagDescription of what the tag does
D:Used to set a description of the current test, this must be + provided, this tag is NOT optional.
F:Used to set a failure message, this message will be displayed + if the test fails, this tag is optional.
S:Used to set a success message, this message will be displayed + if the test succeeds, this tag is optional. +
T:Used to set the procedure for the given task, there are two + options for this: +
    +
  • -compile  + This simply performs compilation only
  • +
  • -execute  + This will perform compilation and execution
  • +
+ + This tag must be provided, this tag is NOT optional. +
C:Used to set the compilation flags for the given task, this + must be provided, this tag is NOT optional.
E: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.
M: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 +
I:Used to specify the INPUT source file to operate on, this must be + provided, this tag is NOT optional
+

Notes

+

+ These tags (with exception to M) have one-time use, using them more + than once will result in template compilation errors, +

+

+ 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. +

+ 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. +

+

Quake C Virtual Machine Documentation

+

+ 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. +

+

Running The Standalone VM

+

+ 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: +

$ ./qcvm progs.dat -float 200 #execute passing in 200 as a float to main
+ If  main  doesn't require arguments: +
$ ./qcvm progs.dat #call main with no arguments
+ + The standalone executor supports the following arguments for passing arguments to  main  + + + + + + + + + + + + + + + + + + +
ArgumentWhat it does
-stringPasses in a string to main
-floatPasses in a float to main
-vectorPasses in a vector to main
+ + The order in which the arguments are expected for main, must be preserved, for + example if  main 's signature is the following: +
void main(float a, vector b)
+ + Then to pass the arguments you'd use the same order: +
$ ./qcvm -float 200 -vector '1 2 3'
+ +

Additional Arguments

+ The standalone virtual machine has the following optional command line arguments: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ArgumentWhat it does
-traceTrace the execution call hierarchy.
-profileProfile the bytecode to find hotspots.
-infoGet info of the running bytecode.
-disasmDissasemble the bytecode into assembly.
-printdefsPrints all definitions for the bytecode running.
-printfieldsPrints all fields for the bytecode running.
+ +

Builtins

+ The standalone virtual machine includes the following builtins. + + + + + + + + + + + + + + +
BuiltinNumber
print1
ftos2
spawn3
kill4
vtos5
error6
vlen7
etos8
stof9
+

Support or Contact

Having trouble with GMQCC? Join our IRC channel at #kf-engine on irc.freenode.net or contact Us