csl - C Header file transformation
version 0.48
Jean-Damien Durand <jeandamiendurand@free.fr>
This software is copyright (c) 2013 by Jean-Damien Durand.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
csl [options] [file] Startup Options: --help Brief help message. --module <argument> Module name. --cpprun <argument> Preprocessor run command. --cppflags <argument> Preprocessor flags. --filter <argument> File to look at after preprocessing. --prefix <argument> Prefix added to target language declarations. --anon <argument> String prepended to anonymous structures or unions. --target <language> Target language. --targetopt <options> Target language specific options. --out <argument> Redirect any output to this filename. --err <argument> Redirect any error to this filename. --loglevel <level> A level that has to be meaningful for Log::Log4perl, typically DEBUG, INFO, WARN, ERROR, FATAL or TRACE. --logstderr Logs to stderr or not. --enumType Type for enumerators. --xsltdir Comma separated list of XSLT search directories Aliased options: --debug Alias to --loglevel DEBUG --info Alias to --loglevel INFO --warn Alias to --loglevel WARN --error Alias to --loglevel ERROR --fatal Alias to --loglevel FATAL --trace Alias to --loglevel TRACE Advanced options: --print Print out result of intermediate steps. --lazy Instruct the parser to try all alternatives on typedef/enum/identifier --typedef <typedef> Comma separated list of known typedefs --enum <enums> Comma separated list of known enums
This help
Module name. Default is the input's basename without extension if input is not "-".
cpp run command. Default is the value when perl was compiled, i.e.:
$CPPRUN (if you read this message, do not worry: this is replaced by correct value at run-time)
This option can be repeated.
cpp flags. Default is the value when perl was compiled, i.e.:
$CPPFLAGS (if you read this message, do not worry: this is replaced by correct value at run-time)
File to look at after proprocessing. Defaults to basename of file argument.
csl is using the preprocessor. Every #include statement in your original source code is telling the preprocessor to look at another file, this is marked down by a line like:
#line ... "information on the file processed"
in the generated output. The --filter argument is used to select which processed files is/are of interest. If $filter is starting with a slash "/" it is assumed to be a full regular expression (including modifier flags). The regexp can be used to handle the case of multiple input files.
In case the file you parse already contains preprocessing information, for example a generated C source code from a source file xxx.w, then you migh want to say: --filter xxx.w, or --filter '/xxx\\.w$/'
Prefix added to any declaration added by csl. Default is "csl_".
String prepended to anonymous structures or unions. Default is "__ANON__".
Target language. Can be repeated.
Target language specific options. Can be repeated. The following options are required:
where XXX is a package name. Typically the basename of a header file, without the extension.
Redirect any output to this filename.
Redirect any error to this filename.
A level that has to be meaningful for Log::Log4perl, typically DEBUG, INFO, WARN, ERROR, FATAL or TRACE. Default is WARN.
Note that tracing Marpa library itself is possible, but only using environment variable MARPA_TRACE /and/ saying --loglevel TRACE.
In case of trouble, typical debugging phases are: --loglevel INFO then: --loglevel DEBUG then: --loglevel TRACE
Shortcut for --loglevel DEBUG
Shortcut for --loglevel INFO
Shortcut for --loglevel WARN
Shortcut for --loglevel ERROR
Shortcut for --loglevel FATAL
Shortcut for --loglevel TRACE
Log to stderr or not. Default is a false value.
Type for enumerators. Default is 'int'.
Comma separated list of XSLT search path. Can be repeated. Default is an empty list.
Instruct the parser to try all alternatives on typedef/enum/identifier. Default is a false value.
Print out result of intermediate steps. Can be repeated. Supported values are:
Raw AST, in XML format, of the input.
Transformed AST of the input, in XML format, that will be sent to the template engine.
Comma separated list of known typedefs. Can be repeated. Default is an empty list.
Comma separated list of known enums. Can be repeated. Default is an empty list.
csl /tmp/file.c --target lua csl --cppflags "-I/tmp/dir1 -DMYDEFINE" /tmp/file.c --target marpa csl --cppflags -I/tmp/dir1 --cppflags -DMYDEFINE /tmp/file.c --target perl5 --print ast --print dom csl --cppflags -I/tmp/dir1 --cppflags -DMYDEFINE --filter '/\.H$/i' /tmp/file.c --target java
Any unknown option on the command line is passed through to --cppflags. I.e.:
csl --cppflags -I/tmp/dir1 --cppflags -DMYDEFINE /tmp/file.c
and
csl -I/tmp/dir1 -DMYDEFINE /tmp/file.c
are equivalent. A restriction is that the filename must be the last argument.
If last argument is absent or equal to '-' and if there is no '--in' option value, then STDIN is assumed.
MarpaX::Languages::C::Scan
XML::LibXSLT
To install MarpaX::Languages::C::AST, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MarpaX::Languages::C::AST
CPAN shell
perl -MCPAN -e shell install MarpaX::Languages::C::AST
For more information on module installation, please visit the detailed CPAN module installation guide.