IPP(1) | EN Tools | IPP(1) |
ipp - Include Pre-Processor
ipp [-D name=value] [-S includedir] [-I includedir] [-s includefile] [-i includefile] [-M options] [-P path] [-m mapfile] [-N nosynclines] [-o outputfile] [-v] inputfile ...
The ipp program reads all inputfiles and recursively expands all
#include 'file' #include "file" #include <file>
directives by substituting the directive with the contents of the file. The output is send to stdout or to outputfile. The files are searched according to the following scheme:
And it provides eight additional features:
These characters have a special meaning in filenames:
If you want to include all your templates, you may write
#include "*.tmpl"
With the following parameters you can control the order and the number of included files using the #include 'pattern' directive:
If you want to include the 5 newest include files of the news directory with file names like "20000131.inc", you may write:
#include 'news/*.inc' IPP_REVERSE IPP_MAX=5
In the files included with the "#include 'pattern'" directive, the following variables are set and can be read using "$(name)":
Keep in mind that a directive without wildcards does not set these variables.
In analogon to Perl's "use" statement, ipp provides a special variant of "#include":
#use type::category::file
This internally is equivalent to the directive
#include <category/file.type>
plus the special semantic that the include file is included (=used) only once, i.e. multiple inclusion is automatically avoided. In other words
#include 'file' #include 'file' #use 'file' #use 'file'
results in three inclusions of 'file'. Two from the "#include"'s and only once from the "#use" directives.
You can easily write fragments of Makefiles with the -M flag (see below) to keep tracks of which files the output file depends on, When "ipp" is invoked as a piece of "WML", the final output file may depend on other files. You can tell "ipp" about these hidden dependencies by using the "#depends" variant , e.g.
#depends 'foo.dat' #depends "*/*.dat" #depends <file>
The contents of the file is not inserted, only information about dependencies are updated.
All include commands insert some special stuff to help "WML" keeping track of input line numbers. This feature may be disabled by appending the string "IPP_NOSYNCLINES" to the "#include" (or its variants) command. See also the "-N" flag.
You can add
name[=value]
pairs at the end of "#include" (and "#use") directives to let "$(name)" interpolate to "value" (or 1 if "=value" is missing) in this include file and all its recursively included files.
There are the following forms of the "$(name)" syntax, similar to the functionality any Bourne Shell provides:
if (exists(name)) expandto(valueof(name)) else expandto("")
name := string
if (exists(name)) expandto(valueof(name)) else expandto(string)
if (exists(name)) expandto(valueof(name)) else expandto(string) name := string
if (exists(name)) expandto(string) else expandto("")
if (exists(name)) expandto("") else expandto(string)
if (exists(name)) expandto(valueof(name)) else Error(string)
Previous constructs may be nested when variable expansion contains no parenthesis. You may for instance need these forms:
`Set a variable if unset'.
$(var=$(var:-string))
`Redefine a variable if it is already set.'
$(var=$(var:+string))
Notice that nested expressions are not handled as shells do. In shells expressions are treated from left to right, whereas "ipp" treat inner expressions first. With this example below
$(foo=bar) $(foo:-$(foo=quux))
Bourne shells will show "bar" whereas "ipp" will print "quux".
It is also possible to undefine a variable. To do so, assign an empty value to this variable, e.g.
$(foo=)
Notice the possibility to do simple If-Then-Else constructs:
$(foo:+string_when_set)$(foo:*string_when_not_set)
This is equivalent to the following pseudo-code:
if (exists(foo)) expandto(string_when_set) else expandto(string_when_not_set)
The strings "__FILE__" and "__LINE__" are always substituted by the currently processed include file and the current line number.
IPP provides support for up-to-end-of-line comments. This type of comment is like the one found in Bourne-Shell or Perl, i.e. any line which starts with a sharp symbol (`"#"') is entirely (i.e. including the newline at the end) removed from the input. Additionally these lines can have whitespaces in front of the sharp symbol. When you really need a sharp symbol at the start of a line you can use "\#", i.e. prefix it with an escaping backslash.
It stops processing the current include file when a line containing just
__END__
occurs. Use this to append POD documents to include files for documentation purposes as in Perl. You can use "__END__" in constructs like "$(SHORTENING:+__END__)", so that the processing is only stopped when the variable SHORTENING is set.
It removes all occurrences of the pattern
\<whitespace>*<newline><whitespace>*
Use this to let one or more lines to be concatenated.
#include <includefile>
in front of inputfile. Use this to automatically load default system include files. You can also use the syntax "type::category::file" which leads to a virtually added
#include <category/file.type>
#include "includefile"
in front of inputfile. Use this to automatically load default user include files. You can also use the syntax "type::category::file" which leads to a virtually added
#include "category/file.type"
The D flag option writes the rule to a dependency file. The name of this file is obtained by replacing the suffix of the output file by ".d".
The M flag option deletes the system files from the list of dependencies.
# comment line <blank line> <oldname>[,<oldname>] <newname> \[S|W|E: <text>\]
Example:
<std/headfoot.wml>,wml::std::headfoot wml::OBSOLETE::std::headfoot [S]
Ralf S. Engelschall rse@engelschall.com www.engelschall.com Denis Barbier barbier@engelschall.com
2020-11-29 | EN Tools |