NAME

vpp - versatile text pre-processor

SYNOPSIS

vpp -var toto=1 file_in > file_out
 
#same result
vpp -var toto=1 -output file_out file_in

DESCRIPTION

vpp enables you to pre-process a file.

Note that vpp is not designed to replace the well known cpp.

INPUT FILE SYNTAX

Comments

All lines beginning with '#' are skipped. (May be changed with -comment option)

in-line perl eval

Lines beginning with '@EVAL' (@ being pompously named the 'action char') are evaluated as small perl script. If a line contains (multiple) @@ Perl-Expression @@ constructs these are replaced by the value of that Perl-Expression.

When -comment is used with '#' as a parameter, Vpp doesn't skip lines beginning with '#'. In this case, there's no comment possible.

Multi-line input

Line ending with \ are concatenated with the following line.

Variables substitution

You can specify in your text varaibles beginning with $ (like in perl, but may be changed with the -prefix option. These variables can be set either by the -var option or by the "eval" capability of Vpp (See below).

Setting variables

Lines beginning by @ are "evaled" using variables defined by -var. You can use only scalar variables. This way, you can also define variables in your text which can be used later.

Conditional statements

vpp understands @IF, @ELSIF, @ENDIF,and so on. @INCLUDE and @IF can be nested.

@IF and @ELSIF are followed by a string which will be evaled using the variable you defined (either with setVar() or in the text).

Loop statements

vpp understands

@FOREACH $MyLoopVar ( Perl-List-Expression ) ... (any) lines which may depend on $MyLoopVar @ENDFOR

These may be nested.

Inclusion

vpp understands @INCLUDE 'Filename' or Perl-String-Expression

command options

-var var_name=value

Specify variables that are used in the input file. The argument of the option must be written like var_name=var_value

-action 'char'

Enables the user to use different char as action char. (default @)

Example: -action '#' will enable vpp to understand #include, #ifdef ..

-comment 'char'

Enables the user to use different char as comment char. (default #)

-nocomment

no comments are possible.

-prefix 'char'

Enables the user to use different char as prefix char. (default $) Note, this applies to 'variables' in the text only, all Perl variables in actions (@@,@EVAL,@IF,@FOREACH) still use $ as prefix character.

-ignorebs

By default, line ending with '\' are glued to the following line (like in ksh). Once this method is called '\' will be left as is.

-output

Specify the output file name, defaults to STDOUT
You may prefix the filename with >> to get the output
appended to an existing file.

AUTHOR

Dominique Dumont Dominique_Dumont@grenoble.hp.com

Copyright (c) 1996 Dominique Dumont. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

perl(1), Text::Vpp(3)