Text::CPP 0.12
Sponsored Links
Text::CPP 0.12 Ranking & Summary
File size:
0.17 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
883
Date added:
2007-05-29
Publisher:
Shevek
Text::CPP 0.12 description
Text::CPP is a full C Preprocessor in XS.
SYNOPSIS
use Text::CPP;
my $reader = new Text::CPP(
Language => CLK_GNUC99,
Options => {
...
},
Builtins => {
foo => this,
bar => that,
},
);
$reader->read("file.c");
while (my $token = $reader->token) {
print "Token: $tokenn";
}
$reader->data->{MyKey} = $MyData;
A fast C preprocessor in XS. This does not require an external C preprocessor, and will not fork() or exec() any external process.
USAGE
The following methods have been implemented, allowing the use of this module as a pure C preprocessor, or as a lexer for a C, C++ or Assembler-like language.
new Text::CPP(...)
Takes a hash or hashref with the following possible keys:
Language
Defines the source language to preprocess and/or tokenise. It may be any of:
CLK_GNUC89 - GNU C89
CLK_GNUC99 - GNU C99
CLK_STDC89 - Standard C89
CLK_STDC94 - Standard C94
CLK_STDC99 - Standard C99
CLK_GNUCXX - GNU C++
CLK_CXX98 - Standard C++ 98
CLK_ASM - Assembler
Options
A hashref of options for the preprocessor. Valid entries are given with alternative forms (from GNU cpp) in brackets.
Define (-D): array of strings or hash
Strings should be of the form NAME=VALUE.
Undef (-U): array of strings
DiscardComments (-C): boolean
DiscardCommentsInMacroExp (-CC): boolean
PrintIncludeNames (-H): boolean
NoLineCommands (-P): boolean
WarnComments (-Wcomment -Wcomments): boolean
WarnDeprecated (-Wdeprecated): boolean
WarningsAreErrors (-Werror): boolean
WarnImport (-Wimport): boolean
WarnMultichar (-Wmultichar): boolean
WarnSystemHeaders (-Wsystem-headers): boolean
Ignore errors in system header files.
WarnTraditional (-Wtraditional): boolean
WarnTrigraphs (-Wtrigraphs): boolean
WarnUnusedMacros (-Wunused-macros): boolean
Pedantic (-pedantic): boolean
PedanticErrors (-pedantic-errors): boolean
Implies, and overrides, Pedantic.
Remap (-remap): boolean
Deal with some brokennesses of MSDOS. Untested.
Trigraphs (-trigraphs): boolean
Traditional (-traditional): boolean
NoWarnings (-w): boolean
IncludePrefix (-iprefix): string
SystemRoot (-isysroot): string
Include (-include): array of strings
Include the specified files before reading the main file to be processed.
IncludeMacros (-imacros): array of strings
Include the specified files before reading the main file to be processed. Output from preprocessing these files is discarded. Files specified by IncludeMacros are processed before files specified by Include.
IncludePath (-I): array of strings
This include path is searched first.
SystemIncludePath (-isystem): array of strings
Specify the standard system include path, searched second.
AfterIncludePath (-idirafter): array of strings
This include path is searched after the system include path.
Builtins
A hashref of predefined macros. The values must be strings or integers. Macros in this hash will be defined before preprocessing starts. These correspond to true "builtin" macros. You should probably prefer to use the Define option.
$text = $reader->token
($text, $type, $flags) = $reader->token
Return the next available preprocessed token. Some tokens are not stringifiable. These include tokens of type CPP_MACRO_ARG, CPP_PADDING and CPP_EOF. Text::CPP returns a dummy string in the text field for these tokens. Tokens of type CPP_EOF should never actually be returned.
@tokens = $reader->tokens
Preprocess and return a list of tokens. This is approximately equivalent to:
push(@tokens, $_) while ($_ = $reader->token);
$reader->type($type)
Return a human readable name for a token type, as returned by $reader->token.
$reader->data
Returns a hashref in which user data may be stored by subclasses. This hashref is created with a new Text::CPP object, and is ignored for all functional purposes. The user may do with it as he wishes.
$reader->errors
In scalar context, returns the fatal error count. In list context, returns a list of warnings and errors encountered by the preprocessor. Thus scalar(@errors) >= $errors, since @errors will also contain the warnings.
SYNOPSIS
use Text::CPP;
my $reader = new Text::CPP(
Language => CLK_GNUC99,
Options => {
...
},
Builtins => {
foo => this,
bar => that,
},
);
$reader->read("file.c");
while (my $token = $reader->token) {
print "Token: $tokenn";
}
$reader->data->{MyKey} = $MyData;
A fast C preprocessor in XS. This does not require an external C preprocessor, and will not fork() or exec() any external process.
USAGE
The following methods have been implemented, allowing the use of this module as a pure C preprocessor, or as a lexer for a C, C++ or Assembler-like language.
new Text::CPP(...)
Takes a hash or hashref with the following possible keys:
Language
Defines the source language to preprocess and/or tokenise. It may be any of:
CLK_GNUC89 - GNU C89
CLK_GNUC99 - GNU C99
CLK_STDC89 - Standard C89
CLK_STDC94 - Standard C94
CLK_STDC99 - Standard C99
CLK_GNUCXX - GNU C++
CLK_CXX98 - Standard C++ 98
CLK_ASM - Assembler
Options
A hashref of options for the preprocessor. Valid entries are given with alternative forms (from GNU cpp) in brackets.
Define (-D): array of strings or hash
Strings should be of the form NAME=VALUE.
Undef (-U): array of strings
DiscardComments (-C): boolean
DiscardCommentsInMacroExp (-CC): boolean
PrintIncludeNames (-H): boolean
NoLineCommands (-P): boolean
WarnComments (-Wcomment -Wcomments): boolean
WarnDeprecated (-Wdeprecated): boolean
WarningsAreErrors (-Werror): boolean
WarnImport (-Wimport): boolean
WarnMultichar (-Wmultichar): boolean
WarnSystemHeaders (-Wsystem-headers): boolean
Ignore errors in system header files.
WarnTraditional (-Wtraditional): boolean
WarnTrigraphs (-Wtrigraphs): boolean
WarnUnusedMacros (-Wunused-macros): boolean
Pedantic (-pedantic): boolean
PedanticErrors (-pedantic-errors): boolean
Implies, and overrides, Pedantic.
Remap (-remap): boolean
Deal with some brokennesses of MSDOS. Untested.
Trigraphs (-trigraphs): boolean
Traditional (-traditional): boolean
NoWarnings (-w): boolean
IncludePrefix (-iprefix): string
SystemRoot (-isysroot): string
Include (-include): array of strings
Include the specified files before reading the main file to be processed.
IncludeMacros (-imacros): array of strings
Include the specified files before reading the main file to be processed. Output from preprocessing these files is discarded. Files specified by IncludeMacros are processed before files specified by Include.
IncludePath (-I): array of strings
This include path is searched first.
SystemIncludePath (-isystem): array of strings
Specify the standard system include path, searched second.
AfterIncludePath (-idirafter): array of strings
This include path is searched after the system include path.
Builtins
A hashref of predefined macros. The values must be strings or integers. Macros in this hash will be defined before preprocessing starts. These correspond to true "builtin" macros. You should probably prefer to use the Define option.
$text = $reader->token
($text, $type, $flags) = $reader->token
Return the next available preprocessed token. Some tokens are not stringifiable. These include tokens of type CPP_MACRO_ARG, CPP_PADDING and CPP_EOF. Text::CPP returns a dummy string in the text field for these tokens. Tokens of type CPP_EOF should never actually be returned.
@tokens = $reader->tokens
Preprocess and return a list of tokens. This is approximately equivalent to:
push(@tokens, $_) while ($_ = $reader->token);
$reader->type($type)
Return a human readable name for a token type, as returned by $reader->token.
$reader->data
Returns a hashref in which user data may be stored by subclasses. This hashref is created with a new Text::CPP object, and is ignored for all functional purposes. The user may do with it as he wishes.
$reader->errors
In scalar context, returns the fatal error count. In list context, returns a list of warnings and errors encountered by the preprocessor. Thus scalar(@errors) >= $errors, since @errors will also contain the warnings.
Text::CPP 0.12 Screenshot
Text::CPP 0.12 Keywords
CPP
CLK
XS
GNU
C Preprocessor
CPP 0.12
array of strings
in xs
boolean
strings
preprocessor
include
token
c
Text::CPP
TextCPP
Bookmark Text::CPP 0.12
Text::CPP 0.12 Copyright
WareSeeker periodically updates pricing and software information of Text::CPP 0.12 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Text::CPP 0.12 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
strings cafe
boolean math
token games
includes free domain
guitar strings
java boolean
include this code
strings italian restaurant
token ring network
boolean terms
includes product information
token ring
includegraphics
boolean logic
preprocessor directives
stringstream
includes related article
strings denver
Related Software
jcpp is a Java C preprocessor. Free Download
EP3 Perl module is the Extensible Perl PreProcessor. Free Download
Ctpp project is the C99-compatible C preprocessor of the ctalk language, which provides object oriented extensions for C. Free Download
idl2cpp is a IDL compiler to language C++ mapping. Free Download
Text::Macro Perl module is a template facility whos focus is on generating code such as c, java or sql. Free Download
Inline::CPP is a Perl module that can write Perl subroutines and classes in C++. Free Download
Pod::PP is a POD pre-processor. Free Download
JSCPP is an ANSI C preprocessor and language parser that can analyze and instrument C code. Free Download
Latest Software
Popular Software
Favourite Software