NAME
csl - C Header file transformation
VERSION
version 0.48
AUTHOR
Jean-Damien Durand <jeandamiendurand@free.fr>
COPYRIGHT AND LICENSE
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.
NAME
csl - C Header file transformation
SYNOPSIS
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
OPTIONS
- --help
-
This help
- --module <argument>
-
Module name. Default is the input's basename without extension if input is not "-".
- --cpprun <argument>
-
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.
- --cppflags <argument>
-
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)
- --filter <argument>
-
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 <argument>
-
Prefix added to any declaration added by csl. Default is "csl_".
- --anon <argument>
-
String prepended to anonymous structures or unions. Default is "__ANON__".
- --target <targetLanguage>
-
Target language. Can be repeated.
- --targetopt <opt>
-
Target language specific options. Can be repeated. The following options are required:
- --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. 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
- --debug
-
Shortcut for --loglevel DEBUG
- --info
-
Shortcut for --loglevel INFO
- --warn
-
Shortcut for --loglevel WARN
- --error
-
Shortcut for --loglevel ERROR
- --fatal
-
Shortcut for --loglevel FATAL
- --trace
-
Shortcut for --loglevel TRACE
- --logstderr
-
Log to stderr or not. Default is a false value.
- --enumType
-
Type for enumerators. Default is 'int'.
- --xsltdir directories
-
Comma separated list of XSLT search path. Can be repeated. Default is an empty list.
- --lazy
-
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:
- ast
-
Raw AST, in XML format, of the input.
- dom
-
Transformed AST of the input, in XML format, that will be sent to the template engine.
- --typedef typedefs
-
Comma separated list of known typedefs. Can be repeated. Default is an empty list.
- --enum enums
-
Comma separated list of known enums. Can be repeated. Default is an empty list.
EXAMPLES
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
NOTES
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.
NOTES
If last argument is absent or equal to '-' and if there is no '--in' option value, then STDIN is assumed.