Class CompilerEnvironment()->CPP
- Description
The state for an instance of the preprocessor.
The default set of supported directives and macros, etc is documented in the cpp:: scope.
Custom directives may be added by inheriting this class and adding non-private functions
string directive_XXX(CppFlags flags, string rest_of_line)
, or by adding the same to the directives mapping.- See also
- Variable
handler
Variable compat_handler
CompilationHandler
CompilerEnvironment.CPP.handler
CompilationHandler
CompilerEnvironment.CPP.compat_handler
- Variable
directives
mapping
(string
:function
(int(16bit)
,string
:string
|zero
))|zero
CompilerEnvironment.CPP.directives- Description
Mapping containing the set of active dynamic custom preprocessor directives.
- Note
This mapping is only consulted if a corresponding
directive_XXX
symbol is not present (or is private) inthis
.
- Method
create
CompilerEnvironment.CPP CompilerEnvironment.CPP(
string
|void
current_file
,int
|string
|void
charset
,object
|void
handler
,void
|int
compat_major
,void
|int
compat_minor
,void
|int
picky_cpp
)
CompilerEnvironment.CPP CompilerEnvironment.CPP(
mapping
(string
:mixed
)options
)- Description
Initialize the preprocessor.
- Parameter
options
If the first argument is a mapping, no other arguments may follow. Instead, they have to be given as members of the mapping (if wanted). The following members are then recognized:
"current_file"
:string
Name of the current file. It is used for generating #line directives and for locating include files.
"charset"
:int
|string
Charset to use when processing
data
."handler"
:object
Compilation handler.
"compat_major"
:int
Sets the major pike version used for compat handling.
"compat_minor"
:int
Sets the minor pike version used for compat handling.
"picky_cpp"
:int
Generate more warnings.
"keep_comments"
:int
This option keeps cpp() from removing comments. Useful in combination with the prefix feature below.
"prefix"
:string
If a prefix is given, only prefixed directives will be processed. For example, if the prefix is
"foo"
, then#foo_ifdef COND
andfoo___LINE__
would be processed,#ifdef COND
and__LINE__
would not."predefines"
:mapping
(string
:mixed
)Mapping of predefined macros in addition to those returned by CPP()->get_predefines().
- Parameter
current_file
If the current_file argument has not been specified, it will default to
"-"
.- Parameter
charset
Turn on automatic character set detection if
1
, otherwise specifies the character set used by the input. Defaults to"ISO-10646"
.- See also