Text::CPP

Text::CPP is a full C Preprocessor in XS.
Download

Text::CPP Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Shevek
  • Publisher web site:
  • http://www.anarres.org/projects/jperf/

Text::CPP Tags


Text::CPP Description

Text::CPP is a full C Preprocessor in XS. 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.USAGEThe 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:LanguageDefines 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 - AssemblerOptionsA hashref of options for the preprocessor. Valid entries are given with alternative forms (from GNU cpp) in brackets.Define (-D): array of strings or hashStrings 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): booleanIgnore errors in system header files.WarnTraditional (-Wtraditional): boolean WarnTrigraphs (-Wtrigraphs): boolean WarnUnusedMacros (-Wunused-macros): boolean Pedantic (-pedantic): boolean PedanticErrors (-pedantic-errors): booleanImplies, and overrides, Pedantic.Remap (-remap): booleanDeal 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 stringsInclude the specified files before reading the main file to be processed.IncludeMacros (-imacros): array of stringsInclude 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 stringsThis include path is searched first.SystemIncludePath (-isystem): array of stringsSpecify the standard system include path, searched second.AfterIncludePath (-idirafter): array of stringsThis include path is searched after the system include path.BuiltinsA 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->tokenReturn 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->tokensPreprocess 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->dataReturns 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->errorsIn 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.Requirements:· Perl Requirements: · Perl


Text::CPP Related Software