Content-type: text/html
Manpage of FILEPP
FILEPP
Section: User Commands (1)
Updated: Dec 12 2000
Index
Return to Main Contents
NAME
filepp - A generic file preprocessor
SYNOPSIS
filepp
[options]
filename(s)
DESCRIPTION
filepp is a generic file preprocessor designed to allow the
functionality provided by the C preprocessor cpp(1) to be used
with any file type.
OPTIONS
filepp accepts the following command line options:
- -o name
-
Write output to name instead of STDOUT. If there is only one
input file and it has the same name as the output file, the original
input file will be backed-up as name~.
- -c
-
Read input from STDIN instead of a file.
- -h
-
Show summary of options.
- -v
-
Show version of program.
- -d
-
Output debugging information.
- -Idir
-
Append directory dir to the list of directories searched for include files.
- -Dmacro
-
Define macro macro with the string `1' as its
definition.
- -Dmacro=defn
-
Define macro macro as defn.
- -k
-
Turn off parsing of all keywords. This is useful if you just want to
use the macro expansion facilities of filepp. With this option
all keywords found will be ignored, filepp will just replace any
macros specified with the -Dmacro=defn option.
KEYWORDS
filepp supports the following keywords:
- #include <FILE>
-
Include a file in the file being processed. This variant is used for
"system" include files. It searches for a file named FILE in a
list of directories specified by you. You specify directories to
search for include files with the command option `-I'. filepp
does not predefine any system directories in which to search for
files.
- #include FILE
-
Include a file in the file being processed. This variant is used for
include files of your own project. It searches for a file named
FILE first in the current directory, then in the list of
directories specified with the command option `-I'. The current
directory is the directory filepp is running in.
- #define macro
-
Define the macro macro to have a value of `1'. macro can
then be used with the keywords #ifdef and #ifndef.
- #define macro defn
-
Define the macro macro to have the value defn.
macro can then be used with the keywords #ifdef and
#ifndef. Also, all instances of macro following the
#define statement will be replaced with the string defn.
The string defn is taken to be all the charcters on the line
following macro.
- #define macro(arg1, arg2, ...) defn
-
Define the macro macro to have the value defn with
arguments (arg1, arg2, ...). macro can be used as
follows:
#define macro(foo) defn with foo in
Now when replacing occurs:
macro(bar)
will become:
defn with bar in
Macros can have any number of comma separated arguments.
- #if expr
-
A conditional statement, expr will be evaluated to true (1) or
false (0). If expr evaluates to true, the text between the
#if and the next #else or #endif will be included.
If expr evaluates to false, the text between the #if and
the next #else or #endif will be ignored. expr can
use all the usual cpp style comparisons (==, !=, <, >, etc.).
Multiple comaprisons can be combined with and (&&) and or (||). The
defined keyword can also be used to check if macros are defined.
For example:
#if defined macro && macro == defn
(Note to filepp experts: #if works by first parsing expr
for the defined keyword and checking if the macro it refers to
is defined, replacing it with 1 if it is and 0 if it isn't. It then
checks the expr for any other macros and replaces them with
their definition. Finially it passes expr through Perl's
eval function, which returns true or false.)
- #elif expr
-
#elif stands for "else if". Like #else, it goes in the
middle of a #if[n][def]-#endif pair and
subdivides it; it does not require a matching #endif of its own.
Like #if, the #elif directive includes an expression to be
tested.
- #ifdef macro
-
A conditional statement, if macro has been defined the text
between the #ifdef and the next #else or #endif will
be included. If macro has not been defined the text between the
#ifdef and the next #else or #endif will be ignored.
- #ifndef macro
-
The reverse case of the #ifdef conditional.
- #else
-
The #else directive can be added to a conditional to provide
alternative text to be used if the condition is false.
- #endif
-
Used to terminate a conditional statement. Normal processing resumes
following the #endif.
- #undef macro
-
Undefine a previously defined macro.
- #error mesg
-
Causes filepp to exit with the error message mesg.
- #warning mesg
-
Causes filepp to issue the warning message mesg.
- #comment mesg
-
As filepp is supposed to be a generic file preprocessor, it
cannot support any known comment styles, therefore it defines its own
with this keyword. All lines starting with #comment are treated
as comments and removed by filepp.
PREDEFINED MACROS
filepp supports a set of predefined macros. All the predefined
macros are of the form __MACRO__, where MACRO is:
- FILE
-
This macro expands to the name of the current input file.
- LINE
-
This macro expands to the current input line number.
- DATE
-
This macro expands to a string that describes the date on which the
preprocessor is being run. The string contains eleven characters and
looks like "Dec 12 2000".
- ISO_DATE
-
This macro expands to a string that describes the date on which the
preprocessor is being run. The string is in format specified by ISO
8601 (YYYY-MM-DD) and looks like "2000-12-12".
- TIME
-
This macro expands to a string that describes the time at which the
preprocessor is being run. The string contains eight characters and
looks like "22:45:31".
- BASE_FILE
-
This macro expands to the name of the main input file.
- INCLUDE_LEVEL
-
This macro expands to a decimal integer constant that represents the
depth of nesting in include files. The value of this macro is
incremented on every #include directive and decremented at every
end of file.
- NULL
-
This macro expands to nothing. It is useful if you want to define
something to be nothing.
- VERSION
-
This macro expands to a string constant which describes the version
number of filepp. The string is a sequence of decimal numbers
separated by periods and looks like "1.1.1".
- FILEPP_INPUT
-
This macro expands to a string constant which says the file was
generated automatically from the current BASE_FILE and looks
like "Generated automatically from filepp.1.in by filepp".
BUGS
filepp has no known bugs, only "features". If you find any
"features", please report them to the author.
COPYING
Copyright (C) 2000 Darren Miller
filepp is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
SEE ALSO
cpp(1),
perl(1)
AUTHOR
Darren Miller <darren@cabaret.demon.co.uk>.
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- OPTIONS
-
- KEYWORDS
-
- PREDEFINED MACROS
-
- BUGS
-
- COPYING
-
- SEE ALSO
-
- AUTHOR
-
This document was created by
man2html,
using the manual pages.
Time: 22:45:40 GMT, December 12, 2000