/Develop/Projects/Vcc/

k1.spdns.de / Develop / Projects / Vcc /

Kio's Virtual Instruction Compiler.

intro | invocation | preprocessor | types | functions | operators | instructions  

compiler | memory  

Preprocessor

Predefined Macros:

The preprocessor defines some macros which describe the current target and options:

    __optimize         1            --> command line option -o
__FILE__ 0 --> current source file
__LINE__ 0 --> current line
__DATE__ "2011-01-21" --> current date (text string)
__TIME__ "16:17:54" --> current time (text string)
_cpu "i386x64" --> target cpu name (text string)
_byteorder "LoHi" --> target cpu's byte order: "LoHi" or "HiLo"
_bits_per_byte 8 --> target cpu's byte size
_bits_per_char 8 --> character size used by the compiler
_bits_per_short 16 --> size of 'short' data type
_bits_per_int 32 --> ...
_bits_per_long 64
_bits_per_float 64
_bits_per_pointer 64
_bytes_per_char 1
_bytes_per_short 2
_bytes_per_int 4
_bytes_per_long 8 --> ...
_bytes_per_float 8 --> size of 'float' data type (default float)
_bytes_per_pointer 8 --> target cpu's pointer size

Preprocessor Instructions:

Lines which start with a hash '#' are handled by the preprocessor.

#!/usr/bin/vcc -options         (line 1 only)
#error "text" Set error with text. source not compiled.
#include "filename" Include file filename.
Files are only included once,
except if included multiple times from the same file.
#require "filename.c" Also compile file filename.c.
#define  <name>                 Define macro without value
#define <name> <words> Define macro as one or more words
#define <name>(<arg>) <words> Define macro name with replacement argument arg
#undef <name> Undefine macro name
#if <expression>        Subsequent source is only compiled if expression is true.
The expression is made up of macros and operators (with
operator precedence and pruning) and the special preprocessor
function defined(macroname)
Conditional compilation may be nested.
#elif <expression> Subsequent source is compiled if expression is true and
no preceding if or elif was true.
#else Subsequent source is compiled if no preceding if or elif was true.
#endif end of conditional code sequence.
#ifdef   <name>         Same as if defined(name)
#ifndef <name> Same as if !defined(name)

Preprocessor Functions:

The preprocessor knows the following functions:

defined( <name> )       returns whether a macro name is defined.
__FILE__ expands to the current file's name.
__LINE__ expands to the current line in the current file.
both refer to the position where the macro is finally instantiated.

Expression evaluation:

The preprocessor can evaluate expressions with standard operators and operator precedence.
For the operator precedence see also the page about vcc source operators.

Archive

Name Letzte Änderung Länge 
lib-Z80-Rop/ 2020-11-30 15:50 21 
lib-Z80-Vss/ 2017-11-12 09:55 452 
lib/ 2019-10-30 17:02
Libraries/ 2019-10-30 17:11
OSX-Qt40/ 2019-10-30 17:02
OSX/ 2020-09-05 12:54
Source/ 2019-10-30 17:02 11 
Tests/ 2019-10-30 17:02
LICENSE 2019-10-30 17:25 1323 
README.md 2019-10-30 17:25 288 
TODO.txt 2020-10-18 12:42 340 
macspin.gif

powered by vipsi - your friendly VIP Script Interpreter

Valid HTML Valid CSS