CodeGen-Cpppp

 view release on metacpan or  search on metacpan

bin/cpppp  view on Meta::CPAN

=head1 OPTIONS

=over

=item -p

=item --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

=item --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'

=item --convert-linecomment-to-c89

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

=item --dump-pl

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

=back

The following "action" options are processed sequentially, like a script,
acting on the first template filename to the left of the action on the command
line, or the first filename overall if an action option appears first.

=over

=item --eval 'PERL CODE'

After loading the template, evaluate a string of perl code.  The template
object is named C<$tpl> and the Cpppp object is C<$cpppp>.

=item --call 'METHOD(...)'

Shortcut for C<--eval> to call a method of C<$tpl>.

=item -o

=item --out [SECTION=]FILENAME[@MARKER]

Write output to FILENAME instead of C<stdout> (unless FILENAME is "-" then do
still write C<stdout> )  If FILENAME already exists, a backup will be created,
unless you specified a @MARKER.

If a @MARKER is specified, the content will be written within the existing
content of the file (without a backup) between lines that match
C<< BEGIN marker >> and C<< END marker >>.  If those lines are not found, the
operations aborts.

An equal sign indicates that only specific sections should be sent to this file.
The SECTION is either the name of one section, or a comma-delimited list of
section names, or a range C<A..B> of section names.  All content diverted to
this FILENAME will be omitted from further output.

=item --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.

=back

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

=head1 AUTHOR

Michael Conrad <mike@nrdvana.net>

=head1 VERSION

version 0.005

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2024 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.

=cut



( run in 2.067 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )