The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

cpppp - Command line tool to process cpppp templates

USAGE

  cpppp [OPTIONS] [TEMPLATE_FILES] > file.c
  cpppp [OPTIONS] [TEMPLATE_FILES] --list-sections
  cpppp --version
  
  Common Options:  (see --help for more)
    -p --param NAME=VALUE
       --features ENABLE1,ENABLE2,DISABLE=0
    -o --out FILE[@MARK]
       --section-out SEC_LIST=FILE[@MARK]

Transform perl+C source into C. See --help for a list of options.

Warning: this evaluates arbitrary perl from the template files.

OPTIONS

-p
--param NAME=VALUE

Specify a parameter to the template. If NAME includes the Perl sigil, the value will be evaluated as a perl expression. If NAME lacks a sigil, the VALUE will be parsed with a more convenient syntax:

  cpppp -p '$type="int"'
  cpppp -p type=int
  cpppp -p '@types=qw( int float char )'
  cpppp -p types=int,float,char
  cpppp -p '%typemap={int => "int32",float => "double"}'
  cpppp -p typemap=int=int32,float=double
--features LIST

This is a shorthand to specify lots of --param options for parameters whose names start with "feature_". The bare name is equivalent to "=1", which would generally enable some feature.

  # (there are no standard features; these would need declared in the template)
  cpppp -p feature_debug=1 -p feature_assert=1 -p feature_comments=0
  cpppp --features 'debug,assert,comments=0'
-o
--out FILENAME

Write output to FILENAME instead of stdout (unless FILENAME is "-" then do still write stdout ) A backup of FILENAME will be created if it exists.

FILENAME may contain a '@marker' suffix. In this case, the content will be written within the existing content of file file between lines that match BEGIN marker and END marker. If those lines are not found, the operations aborts.

--section-out SECTION=FILENAME

This option diverts the contents of the named output section to a different FILENAME than the -o option. (the FILENAME may also contain an '@' marker)

The SECTION is either the name of one section, or a comma-delimited list of section names, or a range A..B of section names. All sections diverted to this FILENAME will be omitted from the regular output.

--list-sections

List the sections of output (in order they would be written) and exit without writing any files. The output is TSV. More columns may be added in the future.

--convert-linecomment-to-c89

Convert all '//' comments to '/*' comments.

--dump-pl

Output the generated perl sourcecode for the top-level perl script and don't execute it.

eventually it will support many that cpp has, for defining things and parsing headers to discover existing types.

AUTHOR

Michael Conrad <mike@nrdvana.net>

VERSION

version 0.003

COPYRIGHT AND LICENSE

This software is copyright (c) 2023 by Michael Conrad.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.