./filepp-1.8.0/0000755000573500001440000000000010571107114012332 5ustar darrenusers./filepp-1.8.0/filepp.10000644000573500001440000016522610571107110013703 0ustar darrenusers.\" Hey Emacs! This file is -*- nroff -*- source. .\" Generated automatically from ./filepp.1.in by filepp version 1.8.0 .\" 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. .\" .TH FILEPP 1 "Feb 27 2007" "Version: 1.8.0" .\" Please update the above date whenever this man page is modified. .SH NAME filepp \- A generic file preprocessor .SH SYNOPSIS .B filepp .RI [ options ] .I filename(s) .SH DESCRIPTION \fBfilepp\fP is a generic file preprocessor designed to allow the functionality provided by the C preprocessor \fBcpp\fP(1) to be used with any file type. \fBfilepp\fP is designed to be easily customised and extended. .SH OPTIONS \fBfilepp\fP accepts the following command line options: .TP .BI \-b Suppress blank lines originating from include files (this has no effect on the top-level file). .TP .BI \-c Read input from STDIN instead of a file. Note: if both \fB-c\fP and input files are specified, both are used as inputs in the order given. .TP .BI \-D macro Predefine \fImacro\fP to have a definition of `\|\fB1\fP\|'. .TP .BI \-D macro = defn Predefine \fImacro\fP to have a definition of \fIdefn\fP. .TP .BI \-d Output debugging information. .TP .BI \-dd Output verbose debugging information. This option shows all normal debugging information, plus the full list of defined macros every time the list changes. .TP .BI \-dl Output light debugging information. This option shows minimal debugging information. .TP .BI \-dpre char Prefix all debugging information with \fIchar\fP (can be character or string), can be used to make debugging easier to read. .TP .BI \-dpost char Postfix all debugging information with \fIchar\fP (can be character or string), this defaults to a newline. If \fIchar\fP does not contain a newline, then no newline will be printed after debugging messages. (Newlines can be put in \fIchar\fP using the \_\_NEWLINE\_\_ macro.) .TP .BI \-ds Print debugging info on stdout rather than stderr. .TP .BI \-e Define all environment variables as macros with prefix \fBenvchar\fP. .TP .BI \-ec " char" Set \fBenvchar\fP (prefix of environment variables defined as macros) to \fIchar\fP, defaults to \fB$\fP. (Note: this option only takes effect at the time the environment variables are converted to macros). .TP .BI -ecn Set \fBenvchar\fP (prefix of environment variables defined as macros) to nothing (no prefix). .TP .BI \-h Show summary of options. .TP .BI \-I dir Append directory \fIdir\fP to the list of directories searched for include files. .TP .BI \-imacros " file" Reads in macros from \fIfile\fP, but discards everything else in the file. .TP .BI \-k Turn off parsing of all keywords. This is useful if you just want to use the macro expansion facilities of \fBfilepp\fP. With this option all keywords found will be ignored, \fBfilepp\fP will just replace any macros specified with the \fB-D\fP\fImacro\fP=\fIdefn\fP option. .TP .BI \-kc " char" Set keyword prefix character to \fIchar\fP (can also be a string). All \fBfilepp\fP keywords are prefixed with the character \fB#\fP by default. This option allows the prefix to be changed to something else. .TP .BI \-lc " char" Set line continuation character to \fIchar\fP (can also be a string). When the line continuation character is found with a newline following it, it and the newline are replaced by the line continuation replacement character. Default is \fB\\\fP (\fBcpp\fP(1) style). .TP .BI \-lec " char" Set optional keyword line end character to \fIchar\fP (can also be a string). This allows extra characters to be placed at the end of a line containing a keyword. The extra characters will be ignored. This is useful if keywords are to be embedded in HTML or C style comments. For example, to embed keywords in an HTML comment the keyword prefix character could be set to \fB<--!#\fP and the optional keyword line end character set to \fB-->\fP. An example keyword would then be: \fB\fP In the case the optional keyword line end characters \fB-->\fP would be ignored. .TP .BI \-lr " char" Set line continuation replacement character to \fIchar\fP (can also be a string). Default is a null string (\fBcpp\fP(1) style). .TP .BI \-lrn Set line continuation replacement character to be a newline. .TP .BI \-m " module.pm" Load module \fImodule.pm\fP. \fImodule.pm\fP is a \fBperl\fP(1) module which can be used to extend or modify the behaviour of \fBfilepp\fP. See section \fBFILEPP MODULES\fP for details of modules included with filepp and \fBFILEPP MODULE API\fP for details on how to write your own modules. .TP .BI \-M dir Append directory \fIdir\fP to the list of directories searched for filepp modules. This list defaults to the directory the filepp modules are installed (if any) plus the default Perl module paths. (Note: this adds the directory to the Perl @INC list.) .TP .BI \-mp " char" Prefix all macros with \fIchar\fP. Macros are defined in the normal way, but will only be replaced when found prefixed with \fIchar\fP. For example, filepp macros will behave similar to Bourne shell (\fBsh\fP(1)) variables if \fIchar\fP is set to \fB$\fP. .TP .BI \-mpnk Turns off macro prefixes within keywords. When using a macro prefix character this option allows macros to be used without the prefix in keyword processing. For example, if the macro prefix is \fB$\fP then and \fB#if\fP would be written as: \fB#if $MACRO == 1\fP Using the \fBmpnk\fP option allows the \fB#if\fP to be written as: \fB#if MACRO == 1\fP .TP .BI \-o " \fIname\fP" Write output to \fIname\fP 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 \fIname~\fP. .TP .BI \-ov Overwrite mode, causes the output file to overwrite the input file. Useful when modifying a large number of files at once, eg: \fBfilepp\fP -ov -DTHIS=THAT * The original input file(s) will be backed-up as \fIname~\fP. .TP .BI \-ovc " \fBIN\fP=\fBOUT\fP" Similar to overwrite mode, the difference is the output filename is input filename with \fBIN\fP part converted to \fBOUT\fP. For example, to process a set of files all ending with .in and have the output files all ending in .out do: \fBfilepp\fP -ovc .in=.out *.in In this case a file called \fItest.in\fP will be processed and the output file will be \fItest.out\fP. Note: if the input file does not contain \fBIN\fP then the output file will have the same name as the input file and the original input file(s) will be backed-up as \fIname~\fP! .TP .BI \-pb Preserve blank lines. Using this option attempts to keep as many lines in the output file as are in the input file, so all blank lines which normally would not get printed are printed. Useful when comparing intput file with output. .TP .BI \-re Treat keyword and macro prefix characters and line continuation character as Perl regular expressions instead of normal strings. .TP .BI \-s Run \fBfilepp\fP in safe mode. This turns off the \fBpragma\fP keyword. .TP .BI \-U macro Undefine previously defined \fImacro\fP. .TP .BI \-u Undefine all currently defined macros, including predefined ones. .TP .BI \-v Show version of program. .TP .BI \-w Turn on word boundaries when replacing macros. When word boundaries are on, macros will only be replaced if the macro appears in the text as a word. For example, by default \fImacro\fP would be replaced in both cases of the following text: \fImacro as word, macroNOTaword\fP but only the first occurrence would be replaced with the \fB-w\fP option. With this option enabled \fBfilepp\fP will only replace macros which contain alphanumeric characters. International (non-ASCII) character sets can be supported using Perl's locale handling. .SH KEYWORDS \fBfilepp\fP supports the following keywords: .TP .BR #include " <\fIFILE\fP>" Include a file in the file being processed. This variant is used for "system" include files. It searches for a file named \fIFILE\fP in a list of directories specified by you. Directories are specified with the command option `-I'. \fBfilepp\fP does not predefine any system directories in which to search for files. .TP .BR #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 \fIFILE\fP first in the current directory, then in the list of directories specified with the command option `-I'. The current directory is the directory the base input file is in. .TP .BR #define " \fImacro\fP" Define the macro \fImacro\fP to have a definition of `1'. \fImacro\fP can then be used with the keywords \fB#ifdef\fP and \fB#ifndef\fP. .TP .BR #define " \fImacro\fP \fIdefn\fP" Define the macro \fImacro\fP to have the value \fIdefn\fP. \fImacro\fP can then be used with the keywords \fB#ifdef\fP and \fP#ifndef\fP. Also, all instances of \fImacro\fP following the \fB#define\fP statement will be replaced with the string \fIdefn\fP. The string \fIdefn\fP is taken to be all the characters on the line following \fImacro\fP. .TP .BR #define " \fImacro(arg1, arg2, ...)\fP \fIdefn\fP" Define the macro \fImacro\fP to have the value \fIdefn\fP with arguments \fI(arg1, arg2, ...)\fP. \fImacro\fP can be used as follows: \fB#define\fP \fImacro(foo)\fP defn with foo in Now when replacing occurs: \fImacro(bar)\fP will become: defn with bar in Macros can have any number of comma separated arguments. Macros can also have variable numbers of arguments if the final macro ends in ..., for example: \fB#define\fP \fIerror(string, args...)\fP fprintf(stderr, string, args); Here the first argument given becomes \fIstring\fP and all other arguments will become \fIargs\fP. If called as: \fIerror("%d,%s", i, string)\fP it will give fprintf(stderr, "%d,%s", i, string); Also, if a macro with a variable number of arguments is passed no arguments for the variable argument, then commas can be optionally removed from the definition by preceding the definition with "##". For example: \fB#define\fP \fIerror(string, args...)\fP fprintf(stderr, string, ##args); If this is called as: \fIerror("empty")\fP then result will be: fprintf(stderr, "empty"); The comma immediately before \fI##args\fP has been removed. .TP .BR #if " \fIexpr\fP" A conditional statement, \fIexpr\fP will be evaluated to true (1) or false (0). If \fIexpr\fP evaluates to true, the text between the \fB#if\fP and the next \fB#else\fP or \fB#endif\fP will be included. If \fIexpr\fP evaluates to false, the text between the \fB#if\fP and the next \fB#else\fP or \fB#endif\fP will be ignored. \fIexpr\fP can use all the usual cpp style comparisons (==, !=, <, >, etc.). Multiple comparisons can be combined with and (&&) and or (||). The \fBdefined\fP keyword can also be used to check if macros are defined. For example: \fI#if defined macro && macro == defn\fP Note: filepp's \fB#if\fP does not work in exactly the same way as \fBcpp\fP(1)'s \fB#if\fP. \fBcpp\fP(1)'s \fB#if\fP only does numerical style comparisons. Filepp's \fB#if\fP statement can also compare strings and regular expressions using \fBperl\fP(1)'s full range of comaprison operations. For example, to test if two strings are exactly equal use: \fI#if "MACRO" eq "string"\fP To test if strings are not equal use \fIne\fP instead of \fIeq\fP. Regular expressions can also be tested, for example to test if a macro has any whitespace in it use: \fI#if "MACRO" =~ /\\s/\fP To test if a macro does not have any whitespace in it \fI=~\fP can be replaced with \fI!~\fP. Perl experts: \fB#if\fP works by first parsing \fIexpr\fP for the \fBdefined\fP 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 \fIexpr\fP for any other macros and replaces them with their definition. Finally it passes \fIexpr\fP through Perl's \fBeval\fP function, which returns true or false. .TP .BR #elif " \fIexpr\fP" \fB#elif\fP stands for "else if". Like \fB#else\fP, it goes in the middle of a \fB#if\fP[\fBn\fP][\fBdef\fP]-\fB#endif\fP pair and subdivides it; it does not require a matching \fB#endif\fP of its own. Like \fB#if\fP, the \fB#elif\fP directive includes an expression to be tested. .TP .BR #ifdef " \fImacro\fP" A conditional statement, if \fImacro\fP has been defined the text between the \fB#ifdef\fP and the next \fB#else\fP or \fB#endif\fP will be included. If \fImacro\fP has not been defined the text between the \fB#ifdef\fP and the next \fB#else\fP or \fB#endif\fP will be ignored. .TP .BR #ifndef " \fImacro\fP" The reverse case of the \fB#ifdef\fP conditional. .TP .BR #else The \fB#else\fP directive can be added to a conditional to provide alternative text to be used if the condition is false. .TP .BR #endif Used to terminate a conditional statement. Normal processing resumes following the \fB#endif\fP. .TP .BR #undef " \fImacro\fP" Undefine a previously defined macro. .TP .BR #error " \fImesg\fP" Causes \fBfilepp\fP to exit with the error message \fImesg\fP. .TP .BR #warning " \fImesg\fP" Causes \fBfilepp\fP to issue the warning message \fImesg\fP. .TP .BR #comment " \fImesg\fP" As \fBfilepp\fP 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 \fB#comment\fP are treated as comments and removed by \fBfilepp\fP. .TP .BR #pragma " \fBfilepp\fP \fIfunction arg1, arg2, ...\fP" The \fB#pragma\fP keyword immediately followed by the word \fBfilepp\fP allows the user to execute a Perl function during parsing. The word immediately following \fBfilepp\fP is taken as the name of the function and the remainder of the line is taken to be a comma separated list of arguments to the function. Any of the \fBfilepp\fP internal functions (see section \fBFILEPP MODULE API\fP) can be called with the \fB#pragma\fP keyword. \fIWarning:\fP There are obvious security risks with allowing arbitrary functions to be run, so the -s (safe mode) command line option has been added which turns the \fB#pragma\fP keyword off. .SH PREDEFINED MACROS \fBfilepp\fP supports a set of predefined macros. All the predefined macros are of the form \fB__MACRO__\fP, where \fBMACRO\fP is: .TP .BR FILE This macro expands to the name of the current input file. .TP .BR LINE This macro expands to the current input line number. .TP .BR 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 "Feb 27 2007". .TP .BR ISO_DATE This macro expands to a string that describes the date on which the preprocessor is being run. The string is in the format specified by ISO 8601 (YYYY-MM-DD) and looks like "2007-02-27". .TP .BR 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 "20:02:16". .TP .BR BASE_FILE This macro expands to the name of the main input file. .TP .BR 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 \fB#include\fP directive and decremented at every end of file. .TP .BR NEWLINE This macro expands to a newline. .TP .BR TAB This macro expands to a tab. .TP .BR NULL This macro expands to nothing. It is useful if you want to define something to be nothing. .TP .BR VERSION This macro expands to a string constant which describes the version number of \fBfilepp\fP. The string is a sequence of decimal numbers separated by periods and looks like "1.8.0". .TP .BR FILEPP_INPUT This macro expands to a string constant which says the file was generated automatically from the current \fBBASE_FILE\fP and looks like "Generated automatically from ./filepp.1.in by filepp". .SH FILEPP MODULES The following modules are included with the main filepp distribution: .PP .\" Hey Emacs! This file is -*- nroff -*- source. .\" Generated automatically from ./filepp.1.in by filepp version 1.8.0 .\" 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. .\" .SH FOR MODULE - for.pm The for module implements a simple for loop. Its file name is \fBfor.pm\fP. .PP The for loop is similar in functionality to that of other programming languages such as Perl or or C. It has a single variable (a filepp macro) which is assigned a numerical value. This numerical value changes by a set increment on each iteration through the loop. The loop termiates when the value no longer passes a comparison test. .PP The for module implements the following keywords: .TP .BR #for " \fImacro\fP \fIstart\fP \fIcompare\fP \fIend\fP \fIincrement\fP" The \fB#for\fP keyword is functionally equivalent to the following Perl or C style loop: for(\fImacro\fP=\fIstart\fP; \fImacro\fP \fIcompare\fP \fIend\fP; \fImacro\fP+=\fIincrement\fP) The \fB#for\fP keyword requires the following space separated parameters: \fImacro\fP : The name of the macro to which the for loop should assign its numerical value. \fIstart\fP : The value \fImacro\fP should be assigned at the start of the loop. \fIstart\fP should be a numerical value. \fIcompare\fP : The comparison to make between the current value of \fImacro\fP and the value \fIend\fP to determine when the loop should terminate. Valid values for \fIcompare\fP are <, >, >=, <=. \fIend\fP : the for loop will terminate when the test \fI macro compare end \fP fails. \fIend\fP should be a numerical value. \fIincrement\fP : The value to increment \fImacro\fP on each iteration of the loop. At the end of each iteration the value of \fIincrement\fP is added to the current value of \fImacro\fP. \fIincrement\fP should be a numerical value. .TP .BR #endfor The \fB#endfor\fP keyword is used to signify the end of the loop. Everything within the opening \fB#for\fP and the closing \fB#endfor\fP will be processed on each iteration of the loop. .PP Example usage: \fB#for\fP COUNTER 10 > 1 -2.5 COUNTER \fB#endfor\fP In the above example COUNTER will be defined to have values 10, 7.5, 5 and 2.5 for each successive iteration through the loop. Nested loops are also possible, as is changing the value of the macro within the loop. \fIstart\fP, \fIend\fP and \fIincrement\fP should all be numerical values, however it is possible to use macros instead provided the macros are defined to have numerical values. .PP .\" Hey Emacs! This file is -*- nroff -*- source. .\" Generated automatically from ./filepp.1.in by filepp version 1.8.0 .\" 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. .\" .SH FOREACH MODULE - foreach.pm The foreach module implements a simple foreach loop. Its file name is \fBforeach.pm\fP. .PP The foreach loop is similar in functionality to that of other programming languages such as Perl. It takes a list of values separated by a user definable delimiter (',' by default). It then iterates through all values in the list, defining a macro to be each individual value for each iteration of the loop. The loop terminates when all values have been used. .PP The foreach module implements the following keywords: .TP .BR #foreach " \fImacro\fP \fIlist\fP" The \fB#foreach\fP keyword is functionally equivalent to the following Perl style loop: foreach \fImacro\fP (split(/\fIdelim\fP/, \fIlist\fP)) The \fB#foreach\fP keyword requires the following space separated parameters: \fImacro\fP : The name of the macro to which the foreach loop should assign the current list value. \fIlist\fP : The list of values, separated by \fIdelim\fP (see \fB#foreachdelim\fP keyword for how to set \fIdelim\fP). \fIlist\fP can also be a macro or contain macros. The loop will run from the \fB#foreach\fP keyword to the next \fB#endforeach\fP keyword. .TP .BR #endforeach The \fB#endforeach\fP keyword is used to signify the end of the loop. Everything within the opening \fB#foreach\fP and the closing \fB#endforeach\fP will be processed on each iteration of the loop. .PP Example usage: \fB#foreach\fP VALUE one, two, three, four VALUE \fB#endforeach\fP In the above example VALUE will be defined to have values one, two, three and four for each successive iteration through the loop. Nested loops are also possible. .PP .TP .BR #foreachdelim " /\fIdelim\fP/" The \fB#foreachdelim\fP keyword is used to set the delimiter used in each list. The delimiter can be any character, string or regular expression. The delimiter should be enclosed in forward slashes, in the same style as Perl regular expressions. The default value for \fIdelim\fP is ','. To set the delimiter to be a single space do: \fB#foreachdelim\fP / / To set \fIdelim\fP to be any amount of white space do: \fB#foreachdelim\fP /\\s\+/ See the Perl documentation on regular expressions for more advanced uses. .PP .\" Hey Emacs! This file is -*- nroff -*- source. .\" Generated automatically from ./filepp.1.in by filepp version 1.8.0 .\" 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. .\" .SH LITERAL MODULE - literal.pm The literal module prevents macros appearing in literal strings from being replaced. A literal string is defined as having the form: \fI"literal string with\fP \fBmacro\fP \fIin"\fP In the above example, \fBmacro\fP will not be replaced. The behaviour of the literal module can be reveresed by defining the macro \fBLITERAL_REVERSE\fP before loading the module, for example: filepp -D\fBLITERAL_REVERSE\fP -m literal.pm \fI\fP This has the effect of only replacing macros which appear in strings. .PP .\" Hey Emacs! This file is -*- nroff -*- source. .\" Generated automatically from ./filepp.1.in by filepp version 1.8.0 .\" 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. .\" .SH TOUPPER MODULE - toupper.pm The toupper module converts all lowercase letters to uppercase. .SH TOLOWER MODULE - tolower.pm The tolower module converts all uppercase letters to lowercase. .PP .\" Hey Emacs! This file is -*- nroff -*- source. .\" Generated automatically from ./filepp.1.in by filepp version 1.8.0 .\" 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. .\" .SH C/C++ COMMENT MODULE - c-comment.pm The c-comment module removes all C style: \fI/* comment */\fP and C++ style: \fI// comment\fP comments from a file. C and C++ comments are removed after keywords have been processed. If you wish to remove C and C++ comments before keywords are processed, define the macro \fBREMOVE_C_COMMENTS_FIRST\fP before loading the module, eg: \fBfilepp -DREMOVE_C_COMMENTS_FIRST -m c-comment.pm\fP .SH HASH COMMENT MODULE - hash-comment.pm The hash-comment module removes all comments of the style: \fI# comment\fP from a file. This is the commenting style used by Perl, Bourne Shell, C Shell and many other programs and configuration files. Hash comments are removed after keywords have been processed. If you wish to remove hash comments before keywords are processed, define the macro \fBREMOVE_HASH_COMMENTS_FIRST\fP before loading the module (Note: if you do this and also use # as the keyword character then the keywords will be removed BEFORE they are processed). .PP .\" Hey Emacs! This file is -*- nroff -*- source. .\" Generated automatically from ./filepp.1.in by filepp version 1.8.0 .\" 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. .\" .SH FUNCTION MODULE - function.pm The function module allows the user write macros which call Perl functions. Its file name is \fBfunction.pm\fP. .PP The function module allows macros of the form: \fImacro(arg1, arg2, arg3, ...)\fP to be added to a file. When the macro is found, it will run a function from a Perl module, with arguments \fIarg1\fP, \fIarg2\fP, \fIarg3\fP, \fI...\fP passed to the function. The function must return a string. The returned string will replace the call to the function in the output. The function can have any number of arguments. If the function has no arguments it should be called with an empty argument list: \fImacro()\fP If the word \fImacro\fP is found in the input file without being followed by a \fI(\fP it will be ignored. .PP To use the function module, the user must provide a Perl function which optionally takes in arguments and returns a string. The function can either be one of filepp's internal functions or one of the user's own provided in a Perl module. The function can be added in two ways. The first way is through the \fBfunction\fP keyword: .TP .BR #function " \fImacro\fP \fIfunction\fP" \fImacro\fP is the name of the macro which is used to signify a call to the function in the input file and \fIfunction\fP is the name of the function to be called. .PP The second method of adding a function is to call the Perl function: .TP .BR Function::AddFunction(\fI$macro\fP, \fI$function\fP) which has the same inputs as the \fBfunction\fP keyword. .PP Functions can be removed either through the keyword: .TP .BR #rmfunction " \fImacro\fP" or through the Perl function .TP .BR Function::RemoveFunction(\fI$macro\fP) .PP .\" Hey Emacs! This file is -*- nroff -*- source. .\" Generated automatically from ./filepp.1.in by filepp version 1.8.0 .\" 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. .\" .SH MATHS MODULE - maths.pm The module provides a set of macros which perform mathematical operations. When the macros are encoutered in an input file, they are evaluated and the result is returned in the output. .PP The maths module includes the following macros: .TP .BR "add(a, b, c, ...)" Takes in any number of arguments and returns their sum: (a + b + c + ...) .TP .BR "sub(a, b)" Returns a minus b: (a - b) .TP .BR "mul(a, b, c, ...)" Takes in any number of arguments and returns their product: (a * b * c * ...) .TP .BR "div(a, b)" Returns a over b: (a / b) .TP .BR "abs(a)" Returns the absoulte value of a. .TP .BR "atan2(a, b)" Returns the arctangent of a/b in the range -pi to pi. .TP .BR "cos(a)" Returns the cosine of a in radians. .TP .BR "exp(a)" Returns the e to the power of a. .TP .BR "int(a)" Returns the integer portion of a. .TP .BR "log(a)" Returns the natural logarithm (base e) of a. .TP .BR "rand(a)" Returns a random fractional number between the range 0 and a. If a is omitted, returns a value between 0 and 1. .TP .BR "sin(a)" Returns the sine of a in radians. .TP .BR "sqrt(a)" Returns the square root of a. .TP .BR "srand(a)" Sets the random number seed for rand(). .PP The maths module also defines pi as M_PI as e as M_E. .PP The maths macros are implemented using the \fBfunction.pm\fP module. Nested macros are allowed, as is passing other macros with numerical defintions as arguments. .PP .\" Hey Emacs! This file is -*- nroff -*- source. .\" Generated automatically from ./filepp.1.in by filepp version 1.8.0 .\" 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. .\" .SH FORMAT MODULE - format.pm This module provides a set of macros for formating strings and numbers. .PP The format module provides the following macros: .TP .BR "printf(format, arg1, arg2, ...)" The \fBprintf\fP macro behaves in the same way as the Perl/C function printf. It takes in a format string followed by a list of arguments to print. See the \fBprintf\fP(3) man page or Perl documentation for full details of the \fBprintf\fP function. .TP .BR "toupper(string)" Converts input string to upper case. .TP .BR "toupperfirst(string)" Converts first character of input string to upper case. .TP .BR "tolower(string)" Converts input string to lower case. .TP .BR "tolowerfirst(string)" Converts first character of input string to lower case. .TP .BR "substr(string, offset, length)" Extracts a substring from input \fIstring\fP. \fBsubstr\fP behaves in the same way as the Perl substr function. \fIoffset\fP is used to specifiy the first character of the string to output (negative for offset from end of string), \fIlength\fP is the length of the string to output. If length is omitted everything from the offset is returned. For further information on \fBsubstr\fP see the Perl documentation. .PP The format macros are implemented using the \fBfunction.pm\fP module. .PP .\" Hey Emacs! This file is -*- nroff -*- source. .\" Generated automatically from ./filepp.1.in by filepp version 1.8.0 .\" 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. .\" .SH BIGDEF MODULE - bigdef.pm The bigdef module allows easy definition of multi-line macros. Its file name is \fBbigdef.pm\fP. .PP A multi-line macro is a macro which has a definition which spans more than one line. The normal way to define these is to place a line continuation character at the end of each line in the definition. However, this can be annoying and unreadable for large multi-line macros. The bigdef module tries to improve on this by providing two keywords: .TP .BR #bigdef " \fImacro\fP \fIdefinition...\fP" The \fB#bigdef\fP keyword has the same syntax as \fB#define\fP, the only difference being the macro definition is everything following the macro name including all following lines up to the next \fB#endbigdef\fP keyword. .TP .BR #endbigdef Ends a bigdef. Everything between this keyword and the last preceding \fB#bigdef\fP is included in the macro. .PP Any keywords found in the definition will be evaluated as normal AT THE TIME THE MACRO IS DEFINED and any output from these will be included in the definition. Note: The difference between bigfunc and bigdef is the time keywords in the definition are evaluated. Bigdef evaluates them as the macro is DEFINED, bigfunc evaluates them whenever the macro is REPLACED. .PP .\" Hey Emacs! This file is -*- nroff -*- source. .\" Generated automatically from ./filepp.1.in by filepp version 1.8.0 .\" 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. .\" .SH BIGFUNC MODULE - bigfunc.pm The bigfunc module allows easy definition of multi-line macros. Its file name is \fBbigfunc.pm\fP. .PP A multi-line macro is a macro which has a definition which spans more than one line. The normal way to define these is to place a line continuation character at the end of each line in the definition. However, this can be annoying and unreadable for large multi-line macros. The bigfunc module tries to improve on this by providing two keywords: .TP .BR #bigfunc " \fImacro\fP \fIdefinition...\fP" The \fB#bigfunc\fP keyword has the same syntax as \fB#define\fP, the only difference being the macro definition is everything following the macro name including all following lines up to the next \fB#endbigfunc\fP keyword. .TP .BR #endbigfunc Ends a bigfunc. Everything between this keyword and the last preceding \fB#bigfunc\fP is included in the macro. .PP Any keywords found in the definition will be evaluated as normal AT THE TIME THE MACRO IS REPLACED and any output from these will be included in the definition. Note: The difference between bigfunc and bigdef is the time keywords in the definition are evaluated. Bigdef evaluates them as the macro is DEFINED, bigfunc evaluates them whenever the macro is REPLACED. .PP .\" Hey Emacs! This file is -*- nroff -*- source. .\" Generated automatically from ./filepp.1.in by filepp version 1.8.0 .\" 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. .\" .SH DEFPLUS MODULE - defplus.pm The defplus module allows extra information to be appended to an existing macro. Its file name is \fBdefplus.pm\fP. .PP The defplus module allows further things to be appended to existing macros. The module implements one keyword: .TP .BR #defplus " \fImacro\fP \fIdefinition...\fP" The \fB#defplus\fP keyword has the same syntax as \fB#define\fP, the only difference being if the macro is already defined then \fIdefinition\fP is appended to the existing definition of the macro. If the macro is undefined then \fB#defplus\fP behaves in exactly the same way as \fB#define\fP. .PP .\" Hey Emacs! This file is -*- nroff -*- source. .\" Generated automatically from ./filepp.1.in by filepp version 1.8.0 .\" 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. .\" .SH REGEXP MODULE - regexp.pm The regexp module allows Perl regular expression replacement to be done with filepp. Its file name is \fBregexp.pm\fP. .PP Perl regular expression replacement allows a regular expression to be searched for and replaced with something else. Regular expressions are defined as follows: .TP .BR #regexp " /\fIregexp\fP/\fIreplacement\fP/" It is very similar to the Perl syntax and the following Perl code will be executed on each line of the input file: .TP .BR $line " =~ s/\fIregexp\fP/\fIreplacement\fP/g" For users who don't understand Perl, this means replace all occurrences of \fIregexp\fP in the current line with \fIreplacement\fP. .PP A full description of regular expressions and possible replacements is beyond the scope of this man page. More information can be found in the Perl documentation using the command: .TP .BR perldoc " \fBperlre\fP" .PP Any number of regular expressions can be defined. Each regular expression is evaluated once for each line of the input file. Regular expressions are evaluated in the order they are defined. .PP Regular expressions can be undefined in the following way: .TP .BR #rmregexp " /\fIregexp\fP/\fIreplacement\fP/" This will remove the specified regular expression. .PP In debugging mode the current list of regular expressions can be viewed using the pragma keyword: .TP .BR #pragma " \fBfilepp\fP \fIShowRegexp\fP" When not in debugging mode, this will produce no output. .PP A single regular expression can also be defined on the command line using the \fIREGEXP\fP macro, for example: .PP filepp -D\fIREGEXP\fP=/\fIregexp\fP/\fIreplacement\fP/ -m regexp.pm inputfile .PP Note: the \fIREGEXP\fP macro must be defined BEFORE the regexp module is loaded, putting -D\fIREGEXP\fP... after -m regexp.pm will not work. When using the command line approach, if the \fIREGEXP\fP macro is successfully parsed as a regular expression it will be undefined from the normal filepp macro list before processing starts. Care should obviously be taken when escaping special characters in the shell with command line regexps. .PP .\" Hey Emacs! This file is -*- nroff -*- source. .\" Generated automatically from ./filepp.1.in by filepp version 1.8.0 .\" 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. .\" .SH BLC MODULE - blc.pm The Bracket Line Continuation module causes lines to be continued if they have more open brackets: "(" than close brackets: ")" on a line. The line will be continued until an equal number of open and close brackets are found. Brackets can be prevented from being counted for line continuation by escaping them with a backslash: "\(" and "\)". Any brackets found with a preceding backslash will be ignored when deciding if line continuation should be done and then have the backslash removed once the full line has been found. .PP .\" Hey Emacs! This file is -*- nroff -*- source. .\" Generated automatically from ./filepp.1.in by filepp version 1.8.0 .\" 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. .\" .SH C MACROS MODULE - cmacros.pm The cmacros module causes the definition of the following predefined macros to be quoted: \fBDATE, TIME, VERSION, BASE_FILE, FILE,\fP (note: predefined macros are written as __MACRO__). This makes the macros more "C" like, as the C preprocessor also puts quotes around these macros. .PP .\" Hey Emacs! This file is -*- nroff -*- source. .\" Generated automatically from ./filepp.1.in by filepp version 1.8.0 .\" 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. .\" .SH C MACROS MODULE - cpp.pm The cpp makes filepp behave in a similar manner to a C preprocessor \fBcpp\fP(1). DISCLAIMER: filepp is not meant to be a drop in replacement for a C preprocessor even with this module. I would not recommend using filepp as a C preprocessor unless you fully understand how it differs from a real C preprocessor. The output from filepp with the cpp module will not be the same as a real C preprocessor. .PP .\" Hey Emacs! This file is -*- nroff -*- source. .\" Generated automatically from ./filepp.1.in by filepp version 1.8.0 .\" 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. .\" .SH GRAB MODULE - grab.pm The grab module is used to grab input before processing. Its file name is \fBgrab.pm\fP. .PP The grab module is mainly for use in other modules, such as for.pm and bigfunc.pm. It grabs all input from a file before any processing is done on it. This allows other modules to do processing on the original input data before the main processing is done. For example, the for module will store the original input inside a loop and re-use it each time the loop is processed. .TP .BR #grab " \fImacro\fP \fIdefinition...\fP" The grab module will start grabbing of all input from the grab keyword, onwards. .TP .BR #endgrab Ends a grab. Everything between this keyword and the last preceding \fB#grab\fP will be grabbed and stored for use in other modules. .PP Grabs can be nested if required. .PP When calling grab from another module, use the following functions: .TP .BR Grab::StartGrab(\fI$startkeyword\fP, \fI$endkeyword\fP) \fI$startkeyword\fP is the keyword that StartGrab is called from. \fI$endkeyword\fP is the keyword that grabbing should stop at. .TP .BR \fI@List\fP = Grab::GetInput() Returns a Perl list containing all input grabbed from when grab was last run. .TP .BR \fI$line\fP = Grab::GetInputLine() Returns the line number of the input file where grabbing last started. .PP .SH FILEPP MODULE API The behaviour of \fBfilepp\fP can be modified or extended through the use of modules. \fBfilepp\fP modules are in fact \fBperl\fP(1) modules, and the rest of this section assumes the reader has a knowledge of Perl. \fBfilepp\fP modules are \fBperl\fP(1) modules which extend or modify \fBfilepp\fP's behaviour by either calling or replacing \fBfilepp\fP's internal functions. \fBfilepp\fP has the Perl package name \fBFilepp\fP so its internal functions can be called within modules either as \fBFilepp::function()\fP or just \fBfunction()\fP. Any of \fBfilepp\fP's internal functions can be called or replaced from within a \fBfilepp\fP module, the most useful ones are: .TP .BR Debug(\fI$string\fP, \fI$number\fP) Print \fI$string\fP as debugging information if debugging is enabled. \fI$number\fP is optional and can be used to set the debugging level at which \fI$string\fP should be printed, lower numbers being higher priority. Command line option \fBd\fP prints all debugging info for 2 and below, option \fBdd\fP prints all debugging information for 3 and below and option \fBdl\fP prints all debugging information for 1 and below. If \fI$number\fP is not provided, defaults to 1. .TP .BR AddProcessor(\fI$function\fP, \fI$pos\fP, \fI$type\fP) Allows the module to add a function named \fI$function\fP to \fBfilepp\fP's processing chain. The processing chain is a set of functions which are run on each line of a file as it is processed. The default functions in the processing chain are \fBParseKeywords\fP which does keyword parsing and \fBReplaceDefines\fP which does macro replacement. Further functions can be added to the chain, with each function taking a string (the current line) as input and returning the processed string as output. By default, or if \fI$pos\fP is set to 0, the processor is added to the end of the processing chain. If \fI$pos\fP is set to 1 the processor is added to the start of the processing chain. \fI$type\fP controls what the processor is run on. There are three options for this, 0 (default): the processor runs on everything passed to the processing chain; 1: the processor runs on full lines only; 2: the processor runs on part lines only (a part line is the text following a keyword such as \fBif\fP which needs to be parsed for macros). Both \fI$pos\fP and \fI$type\fP are optional parameters. .TP .BR AddProcessorAfter(\fI$function\fP, \fI$existing\fP, \fI$type\fP) Adds function \fI$function\fP to the processing chain directly after existing processor \fI$existing\fP. If \fI$existing\fP is not found then \fI$function\fP is added to the end of the processing chain. Regular expression matching is used to compare \fI$existing\fP with the names of the functions in the processing chain. \fI$type\fP is optional. .TP .BR AddProcessorBefore(\fI$function\fP, \fI$existing\fP, \fI$type\fP) Adds function \fI$function\fP to the processing chain directly before existing processor \fI$existing\fP. If \fI$existing\fP is not found then \fI$function\fP is added to the start of the processing chain. Regular expression matching is used to compare \fI$existing\fP with the names of the functions in the processing chain. \fI$type\fP is optional. .TP .BR RemoveProcessor(\fI$function\fP) Removes the processor function \fI$function\fP from the processing chain. .TP .BR \fI$string\fP = ReplaceDefines(\fI$string\fP) Replaces all macros in \fI$string\fP with their definitions and returns the processed string. .TP .BR AddKeyword(\fI$string\fP, \fI$function\fP) Add the keyword named \fI$string\fP. When the keyword is found in text processing the function named \fI$function\fP will be run with everything following the keyword passed as a single argument. .TP .BR RemoveKeyword(\fI$string\fP) Removes the keyword named \fI$string\fP. .TP .BR RemoveAllKeywords() Removes all the keywords currently defined for \fBfilepp\fP (used for the -k command line option). .TP .BR AddIfword(\fI$string\fP) Adds keyword named \fI$string\fP to Ifword list. An Ifword takes in the string following the keyword and optionally parses it, returning a 1 if the string parses to true and 0 for false. The default Ifwords are \fBif\fP, \fBifdef\fP and \fBifndef\fP. .TP .BR RemoveIfword(\fI$string\fP) Removes keyword named \fI$string\fP from Ifword list (note: this does NOT remove the keyword, use \fBRemoveKeyword\fP for that). .TP .BR AddElseword(\fI$string\fP) Adds keyword named \fI$string\fP to Elseword list. An Elseword takes in the string following the keyword and optionally parses it, returning a 1 if the string parses to true and 0 for false. The default Elsewords are \fBelse\fP and \fBelif\fP. .TP .BR RemoveElseword(\fI$string\fP) Removes keyword named \fI$string\fP from Elseword list. .TP .BR AddEndifword(\fI$string\fP) Adds keyword named \fI$string\fP to Endifword list. An Endifword should return a 1 to indicate successful termination of the if block. If the Endifword returns 0 the Endifword is ignored and filepp assumes the current if block carries on after the Endifword. The default Endifword is \fBendif\fP. .TP .BR RemoveEndifword(\fI$string\fP) Removes keyword named \fI$string\fP from Endifword list. .TP .BR AddIncludePath(\fI$string\fP) Adds the include path \fI$string\fP to the list of directories to search for include files (used for the -I command line option). .TP .BR AddModulePath(\fI$string\fP) Adds the path \fI$string\fP to the list of directories to search for filepp modules (used for the -M command line option). .TP .BR AddOpenInputFunc(\fI$function\fP) Adds a \fI$function\fP to a list of functions to be run each time a new base input file is opened. .TP .BR AddCloseInputFunc(\fI$function\fP) Adds a \fI$function\fP to a list of functions to be run each time a new base input file is closed. .TP .BR AddOpenOutputFunc(\fI$function\fP) Adds a \fI$function\fP to a list of functions to be run each time an output file is opened. .TP .BR AddCloseOutputFunc(\fI$function\fP) Adds a \fI$function\fP to a list of functions to be run each time an output file is closed. .TP .BR AddInputFile(\fI$string\fP) Adds another input file to the list of files to be processed (used for adding input files at the command line). .TP .BR ChangeOutputFile(\fI$string\fP) Closes the current output file and attempts to open a new one named \fI$string\fP. .TP .BR SetKeywordchar(\fI$string\fP) Set the initial keyword char to \fI$string\fP (used for the -kc command line option). .TP .BR SetContchar(\fI$string\fP) Set the line continuation char to \fI$string\fP (used for the -lc command line option). .TP .BR SetContrepchar(\fI$string\fP) Set the line continuation replacement char to \fI$string\fP (used for the -lr command line option). .TP .BR SetOptLineEndchar(\fI$string\fP) Set the optional keyword line end character to \fI$string\fP (used for the -lec command line option). .TP .BR SetBlankSupp(1/0) Turns blank-line suppression on/off (1 = suppress, 0 = don't suppress). When blank-line suppression is on, blank lines in input files will not be copied to the output. Unlike the corresponding command-line option (-b), this function can also have effect in the top-level file. The setting of blank-line suppression applies to the current file being processed and all files included in the current file. .TP .BR ResetBlankSupp() Resets blank-line suppression to the command-line specified value. This only affects the output of blank lines from the current file being processed and all files included in the current file. In the top-level file, this always turns blank-line suppression off. .TP .BR SetEatTrail(\fI$string\fP) If \fI$string\fP is a macro, whenever the macro is replaced all blank space between the macro's replacement and the next character on the line will be eaten. For example, if macro \fIfoo\fP is defined to \fIbar\fP and \fIfoo\fP has been set to have it's trail eaten, the following: eat my foo trail is replaced with eat my bartrail .TP .BR CheckEatTrail(\fI$string\fP) Returns 1 if macro \fI$string\fP will have it's tail eaten, 0 otherwise. .TP .BR SetEnvchar(\fI$string\fP) Set the prefix of environment variables converted to macros (\fBenvchar\fP) to \fI$string\fP (used for -ec and -ecn command line options). .TP .BR DefineEnv() Define all environment variables as macros with prefix \fBenvchar\fP (used for -e command line option). .TP .BR SetOutput(1/0) Turns writing of parsed input file to output file on/off. This takes either 1 (output on) or 0 (output off) as input. When the output is turned off, the only output produced from \fBfilepp\fP will be that generated by modules. .TP .BR SetWordBoundaries(1/0) Turns on(1) or off(0) word boundary checking when replacing macros (used for the -w command line option). .TP .BR SetCharPerlre(1/0) Turns on(1) or off(0) allowing of keyword prefix char and line continuation char to be Perl regular expressions (used for the -re command line option). .TP .BR UndefAll() Undefines all currently defined macros, including predefined ones (used for the -u command line option). .TP .BR UseModule(\fI$string\fP) Loads a \fBperl\fP(1) module named \fI$string\fP using the Perl command \fBrequire\fP (used for the -m command line option). .TP .BR SetParseLineEnd(\fI$function\fP) Sets the function to determine if line continuation should be done on current line to \fI$function\fP. .TP .BR \fI$string\fP = GetNextLine() Returns the next line (after line continuation has been dealt with) of the input file currently being processed. Returns NULL for end of file. .TP .BR Write(\fI$string\fP) Writes \fI$string\fP to the current output file. .TP .BR Output(\fI$string\fP) Conditionally writes \fI$string\fP to the current output file. If output is turned on then writes \fI$string\fP. Output is toggled off/on using SetOutput function. .PP In addition all the standard \fBfilepp\fP keywords have equivalent functions which optionally take a single argument. The functions have the same name as the keyword, only with a capital first letter (eg: \fB#define\fP \fIstring\fP calls the function \fBDefine(\fP\fIstring\fP\fB)\fP). A full description of the \fBParse\fP function and all the other \fBfilepp\fP internal functions is beyond the scope of this man page. The \fBfilepp\fP script is well commented and hopefully readable by a Perl programmer, so use the source Luke! .SH BUGS \fBfilepp\fP has no known bugs, only "features". If you find any "features", please report them to the author. .SH COPYING Copyright (C) 2000-2007 Darren Miller .PP \fBfilepp\fP 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. .PP 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. .PP 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. .SH "SEE ALSO" .BR \fBcpp\fP(1), .BR \fBperl\fP(1) .SH AUTHOR Darren Miller . ./filepp-1.8.0/filepp.lsm0000644000573500001440000000147310571107114014333 0ustar darrenusersBegin4 Title: filepp Version: 1.8.0 Entered-date: 2007-02-27 Description: filepp is a generic file preprocessor that lets C preprocessor functionality be used with any file type. It supports the full set of C preprocessor keywords (#include, #define, #if, etc.). filepp is also highly customisable and allows users to easily add their own keywords or modify the behaviour of existing keywords, and is more user friendly than cpp. filepp is written in Perl. Keywords: cpp perl filepp preprocessing preprocessor Author: darren@cabaret.demon.co.uk (Darren Miller) Maintained-by: darren@cabaret.demon.co.uk (Darren Miller) Primary-site: http://www.cabaret.demon.co.uk/filepp/ filepp-1.8.0.tar.gz Alternate-site: Original-site: Platforms: All platforms for which Perl is available. Copying-policy: GPL End ./filepp-1.8.0/filepp.html0000644000573500001440000014677610571107114014524 0ustar darrenusersContent-type: text/html Manpage of FILEPP

FILEPP

Section: User Commands (1)
Updated: Feb 27 2007
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. filepp is designed to be easily customised and extended.  

OPTIONS

filepp accepts the following command line options:
-b
Suppress blank lines originating from include files (this has no effect on the top-level file).
-c
Read input from STDIN instead of a file. Note: if both -c and input files are specified, both are used as inputs in the order given.
-Dmacro
Predefine macro to have a definition of `1'.
-Dmacro=defn
Predefine macro to have a definition of defn.
-d
Output debugging information.
-dd
Output verbose debugging information. This option shows all normal debugging information, plus the full list of defined macros every time the list changes.
-dl
Output light debugging information. This option shows minimal debugging information.
-dprechar
Prefix all debugging information with char (can be character or string), can be used to make debugging easier to read.
-dpostchar
Postfix all debugging information with char (can be character or string), this defaults to a newline. If char does not contain a newline, then no newline will be printed after debugging messages. (Newlines can be put in char using the __NEWLINE__ macro.)
-ds
Print debugging info on stdout rather than stderr.
-e
Define all environment variables as macros with prefix envchar.
-ec char
Set envchar (prefix of environment variables defined as macros) to char, defaults to $. (Note: this option only takes effect at the time the environment variables are converted to macros).
-ecn
Set envchar (prefix of environment variables defined as macros) to nothing (no prefix).
-h
Show summary of options.
-Idir
Append directory dir to the list of directories searched for include files.
-imacros file
Reads in macros from file, but discards everything else in the file.
-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.
-kc char
Set keyword prefix character to char (can also be a string). All filepp keywords are prefixed with the character # by default. This option allows the prefix to be changed to something else.
-lc char
Set line continuation character to char (can also be a string). When the line continuation character is found with a newline following it, it and the newline are replaced by the line continuation replacement character. Default is \ (cpp(1) style).
-lec char
Set optional keyword line end character to char (can also be a string). This allows extra characters to be placed at the end of a line containing a keyword. The extra characters will be ignored. This is useful if keywords are to be embedded in HTML or C style comments. For example, to embed keywords in an HTML comment the keyword prefix character could be set to <--!# and the optional keyword line end character set to -->. An example keyword would then be:

<!--#include "header.h" -->

In the case the optional keyword line end characters --> would be ignored.

-lr char
Set line continuation replacement character to char (can also be a string). Default is a null string (cpp(1) style).
-lrn
Set line continuation replacement character to be a newline.
-m module.pm
Load module module.pm. module.pm is a perl(1) module which can be used to extend or modify the behaviour of filepp. See section FILEPP MODULES for details of modules included with filepp and FILEPP MODULE API for details on how to write your own modules.
-Mdir
Append directory dir to the list of directories searched for filepp modules. This list defaults to the directory the filepp modules are installed (if any) plus the default Perl module paths. (Note: this adds the directory to the Perl @INC list.)
-mp char
Prefix all macros with char. Macros are defined in the normal way, but will only be replaced when found prefixed with char. For example, filepp macros will behave similar to Bourne shell (sh(1)) variables if char is set to $.
-mpnk
Turns off macro prefixes within keywords. When using a macro prefix character this option allows macros to be used without the prefix in keyword processing. For example, if the macro prefix is $ then and #if would be written as:

#if $MACRO == 1

Using the mpnk option allows the #if to be written as:

#if MACRO == 1

-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~.
-ov
Overwrite mode, causes the output file to overwrite the input file. Useful when modifying a large number of files at once, eg:

filepp -ov -DTHIS=THAT *

The original input file(s) will be backed-up as name~.

-ovc IN=OUT
Similar to overwrite mode, the difference is the output filename is input filename with IN part converted to OUT. For example, to process a set of files all ending with .in and have the output files all ending in .out do:

filepp -ovc .in=.out *.in

In this case a file called test.in will be processed and the output file will be test.out. Note: if the input file does not contain IN then the output file will have the same name as the input file and the original input file(s) will be backed-up as name~!

-pb
Preserve blank lines. Using this option attempts to keep as many lines in the output file as are in the input file, so all blank lines which normally would not get printed are printed. Useful when comparing intput file with output.
-re
Treat keyword and macro prefix characters and line continuation character as Perl regular expressions instead of normal strings.
-s
Run filepp in safe mode. This turns off the pragma keyword.
-Umacro
Undefine previously defined macro.
-u
Undefine all currently defined macros, including predefined ones.
-v
Show version of program.
-w
Turn on word boundaries when replacing macros. When word boundaries are on, macros will only be replaced if the macro appears in the text as a word. For example, by default macro would be replaced in both cases of the following text:

macro as word, macroNOTaword

but only the first occurrence would be replaced with the -w option.

With this option enabled filepp will only replace macros which contain alphanumeric characters. International (non-ASCII) character sets can be supported using Perl's locale handling.

 

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. Directories are specified 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 the base input file is in.
#define macro
Define the macro macro to have a definition 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 characters 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.

Macros can also have variable numbers of arguments if the final macro ends in ..., for example:

#define error(string, args...) fprintf(stderr, string, args);

Here the first argument given becomes string and all other arguments will become args. If called as: error("%d,%s", i, string) it will give

fprintf(stderr, "%d,%s", i, string);

Also, if a macro with a variable number of arguments is passed no arguments for the variable argument, then commas can be optionally removed from the definition by preceding the definition with "##". For example:

#define error(string, args...) fprintf(stderr, string, ##args);

If this is called as: error("empty") then result will be:

fprintf(stderr, "empty");

The comma immediately before ##args has been removed.

#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 comparisons 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: filepp's #if does not work in exactly the same way as cpp(1)'s #if. cpp(1)'s #if only does numerical style comparisons. Filepp's #if statement can also compare strings and regular expressions using perl(1)'s full range of comaprison operations. For example, to test if two strings are exactly equal use:

#if "MACRO" eq "string"

To test if strings are not equal use ne instead of eq. Regular expressions can also be tested, for example to test if a macro has any whitespace in it use:

#if "MACRO" =~ /\s/

To test if a macro does not have any whitespace in it =~ can be replaced with !~.

Perl 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 expr for any other macros and replaces them with their definition. Finally 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.
#pragma filepp function arg1, arg2, ...
The #pragma keyword immediately followed by the word filepp allows the user to execute a Perl function during parsing. The word immediately following filepp is taken as the name of the function and the remainder of the line is taken to be a comma separated list of arguments to the function. Any of the filepp internal functions (see section FILEPP MODULE API) can be called with the #pragma keyword.

Warning: There are obvious security risks with allowing arbitrary functions to be run, so the -s (safe mode) command line option has been added which turns the #pragma keyword off.

 

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 "Feb 27 2007".
ISO_DATE
This macro expands to a string that describes the date on which the preprocessor is being run. The string is in the format specified by ISO 8601 (YYYY-MM-DD) and looks like "2007-02-27".
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 "20:02:16".
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.
NEWLINE
This macro expands to a newline.
TAB
This macro expands to a tab.
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.8.0".
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".

 

FILEPP MODULES

The following modules are included with the main filepp distribution:

 

FOR MODULE - for.pm

The for module implements a simple for loop. Its file name is for.pm.

The for loop is similar in functionality to that of other programming languages such as Perl or or C. It has a single variable (a filepp macro) which is assigned a numerical value. This numerical value changes by a set increment on each iteration through the loop. The loop termiates when the value no longer passes a comparison test.

The for module implements the following keywords:

#for macro start compare end increment
The #for keyword is functionally equivalent to the following Perl or C style loop:

for(macro=start; macro compare end; macro+=increment)

The #for keyword requires the following space separated parameters:

macro : The name of the macro to which the for loop should assign its numerical value.

start : The value macro should be assigned at the start of the loop. start should be a numerical value.

compare : The comparison to make between the current value of macro and the value end to determine when the loop should terminate. Valid values for compare are <, >, >=, <=.

end : the for loop will terminate when the test


  macro compare end 

fails. end should be a numerical value.

increment : The value to increment macro on each iteration of the loop. At the end of each iteration the value of increment is added to the current value of macro. increment should be a numerical value.

#endfor
The #endfor keyword is used to signify the end of the loop. Everything within the opening #for and the closing #endfor will be processed on each iteration of the loop.

Example usage:

#for COUNTER 10 > 1 -2.5


  COUNTER

#endfor

In the above example COUNTER will be defined to have values 10, 7.5, 5 and 2.5 for each successive iteration through the loop.

Nested loops are also possible, as is changing the value of the macro within the loop. start, end and increment should all be numerical values, however it is possible to use macros instead provided the macros are defined to have numerical values.

 

FOREACH MODULE - foreach.pm

The foreach module implements a simple foreach loop. Its file name is foreach.pm.

The foreach loop is similar in functionality to that of other programming languages such as Perl. It takes a list of values separated by a user definable delimiter (',' by default). It then iterates through all values in the list, defining a macro to be each individual value for each iteration of the loop. The loop terminates when all values have been used.

The foreach module implements the following keywords:

#foreach macro list
The #foreach keyword is functionally equivalent to the following Perl style loop:

foreach macro (split(/delim/, list))

The #foreach keyword requires the following space separated parameters:

macro : The name of the macro to which the foreach loop should assign the current list value.

list : The list of values, separated by delim (see #foreachdelim keyword for how to set delim). list can also be a macro or contain macros.

The loop will run from the #foreach keyword to the next #endforeach keyword.

#endforeach
The #endforeach keyword is used to signify the end of the loop. Everything within the opening #foreach and the closing #endforeach will be processed on each iteration of the loop.

Example usage:

#foreach VALUE one, two, three, four


  VALUE

#endforeach

In the above example VALUE will be defined to have values one, two, three and four for each successive iteration through the loop.

Nested loops are also possible.

#foreachdelim /delim/
The #foreachdelim keyword is used to set the delimiter used in each list. The delimiter can be any character, string or regular expression. The delimiter should be enclosed in forward slashes, in the same style as Perl regular expressions. The default value for delim is ','. To set the delimiter to be a single space do:

#foreachdelim / /

To set delim to be any amount of white space do:

#foreachdelim /\s+/

See the Perl documentation on regular expressions for more advanced uses.

 

LITERAL MODULE - literal.pm

The literal module prevents macros appearing in literal strings from being replaced. A literal string is defined as having the form:

"literal string with macro in"

In the above example, macro will not be replaced.

The behaviour of the literal module can be reveresed by defining the macro LITERAL_REVERSE before loading the module, for example:

filepp -DLITERAL_REVERSE -m literal.pm <files>

This has the effect of only replacing macros which appear in strings.

 

TOUPPER MODULE - toupper.pm

The toupper module converts all lowercase letters to uppercase.  

TOLOWER MODULE - tolower.pm

The tolower module converts all uppercase letters to lowercase.

 

C/C++ COMMENT MODULE - c-comment.pm

The c-comment module removes all C style:

/* comment */

and C++ style:

// comment

comments from a file. C and C++ comments are removed after keywords have been processed. If you wish to remove C and C++ comments before keywords are processed, define the macro REMOVE_C_COMMENTS_FIRST before loading the module, eg:

filepp -DREMOVE_C_COMMENTS_FIRST -m c-comment.pm

 

HASH COMMENT MODULE - hash-comment.pm

The hash-comment module removes all comments of the style:

# comment

from a file. This is the commenting style used by Perl, Bourne Shell, C Shell and many other programs and configuration files. Hash comments are removed after keywords have been processed. If you wish to remove hash comments before keywords are processed, define the macro REMOVE_HASH_COMMENTS_FIRST before loading the module (Note: if you do this and also use # as the keyword character then the keywords will be removed BEFORE they are processed).

 

FUNCTION MODULE - function.pm

The function module allows the user write macros which call Perl functions. Its file name is function.pm.

The function module allows macros of the form:

macro(arg1, arg2, arg3, ...)

to be added to a file. When the macro is found, it will run a function from a Perl module, with arguments arg1, arg2, arg3, ... passed to the function. The function must return a string. The returned string will replace the call to the function in the output. The function can have any number of arguments. If the function has no arguments it should be called with an empty argument list:

macro()

If the word macro is found in the input file without being followed by a ( it will be ignored.

To use the function module, the user must provide a Perl function which optionally takes in arguments and returns a string. The function can either be one of filepp's internal functions or one of the user's own provided in a Perl module. The function can be added in two ways. The first way is through the function keyword:

#function macro function
macro is the name of the macro which is used to signify a call to the function in the input file and function is the name of the function to be called.

The second method of adding a function is to call the Perl function:

Function::AddFunction($macro,$function)
which has the same inputs as the function keyword.

Functions can be removed either through the keyword:

#rmfunction macro
or through the Perl function
Function::RemoveFunction($macro)

 

MATHS MODULE - maths.pm

The module provides a set of macros which perform mathematical operations. When the macros are encoutered in an input file, they are evaluated and the result is returned in the output.

The maths module includes the following macros:

add(a, b, c, ...)
Takes in any number of arguments and returns their sum: (a + b + c + ...)
sub(a, b)
Returns a minus b: (a - b)
mul(a, b, c, ...)
Takes in any number of arguments and returns their product: (a * b * c * ...)
div(a, b)
Returns a over b: (a / b)
abs(a)
Returns the absoulte value of a.
atan2(a, b)
Returns the arctangent of a/b in the range -pi to pi.
cos(a)
Returns the cosine of a in radians.
exp(a)
Returns the e to the power of a.
int(a)
Returns the integer portion of a.
log(a)
Returns the natural logarithm (base e) of a.
rand(a)
Returns a random fractional number between the range 0 and a. If a is omitted, returns a value between 0 and 1.
sin(a)
Returns the sine of a in radians.
sqrt(a)
Returns the square root of a.
srand(a)
Sets the random number seed for rand().

The maths module also defines pi as M_PI as e as M_E.

The maths macros are implemented using the function.pm module. Nested macros are allowed, as is passing other macros with numerical defintions as arguments.

 

FORMAT MODULE - format.pm

This module provides a set of macros for formating strings and numbers.

The format module provides the following macros:

printf(format, arg1, arg2, ...)
The printf macro behaves in the same way as the Perl/C function printf. It takes in a format string followed by a list of arguments to print. See the printf(3) man page or Perl documentation for full details of the printf function.
toupper(string)
Converts input string to upper case.
toupperfirst(string)
Converts first character of input string to upper case.
tolower(string)
Converts input string to lower case.
tolowerfirst(string)
Converts first character of input string to lower case.
substr(string, offset, length)
Extracts a substring from input string. substr behaves in the same way as the Perl substr function. offset is used to specifiy the first character of the string to output (negative for offset from end of string), length is the length of the string to output. If length is omitted everything from the offset is returned. For further information on substr see the Perl documentation.

The format macros are implemented using the function.pm module.

 

BIGDEF MODULE - bigdef.pm

The bigdef module allows easy definition of multi-line macros. Its file name is bigdef.pm.

A multi-line macro is a macro which has a definition which spans more than one line. The normal way to define these is to place a line continuation character at the end of each line in the definition. However, this can be annoying and unreadable for large multi-line macros. The bigdef module tries to improve on this by providing two keywords:

#bigdef macro definition...
The #bigdef keyword has the same syntax as #define, the only difference being the macro definition is everything following the macro name including all following lines up to the next #endbigdef keyword.
#endbigdef
Ends a bigdef. Everything between this keyword and the last preceding #bigdef is included in the macro.

Any keywords found in the definition will be evaluated as normal AT THE TIME THE MACRO IS DEFINED and any output from these will be included in the definition.

Note: The difference between bigfunc and bigdef is the time keywords in the definition are evaluated. Bigdef evaluates them as the macro is DEFINED, bigfunc evaluates them whenever the macro is REPLACED.

 

BIGFUNC MODULE - bigfunc.pm

The bigfunc module allows easy definition of multi-line macros. Its file name is bigfunc.pm.

A multi-line macro is a macro which has a definition which spans more than one line. The normal way to define these is to place a line continuation character at the end of each line in the definition. However, this can be annoying and unreadable for large multi-line macros. The bigfunc module tries to improve on this by providing two keywords:

#bigfunc macro definition...
The #bigfunc keyword has the same syntax as #define, the only difference being the macro definition is everything following the macro name including all following lines up to the next #endbigfunc keyword.
#endbigfunc
Ends a bigfunc. Everything between this keyword and the last preceding #bigfunc is included in the macro.

Any keywords found in the definition will be evaluated as normal AT THE TIME THE MACRO IS REPLACED and any output from these will be included in the definition.

Note: The difference between bigfunc and bigdef is the time keywords in the definition are evaluated. Bigdef evaluates them as the macro is DEFINED, bigfunc evaluates them whenever the macro is REPLACED.

 

DEFPLUS MODULE - defplus.pm

The defplus module allows extra information to be appended to an existing macro. Its file name is defplus.pm.

The defplus module allows further things to be appended to existing macros. The module implements one keyword:

#defplus macro definition...
The #defplus keyword has the same syntax as #define, the only difference being if the macro is already defined then definition is appended to the existing definition of the macro. If the macro is undefined then #defplus behaves in exactly the same way as #define.

 

REGEXP MODULE - regexp.pm

The regexp module allows Perl regular expression replacement to be done with filepp. Its file name is regexp.pm.

Perl regular expression replacement allows a regular expression to be searched for and replaced with something else. Regular expressions are defined as follows:

#regexp /regexp/replacement/
It is very similar to the Perl syntax and the following Perl code will be executed on each line of the input file:
$line =~ s/regexp/replacement/g
For users who don't understand Perl, this means replace all occurrences of regexp in the current line with replacement.

A full description of regular expressions and possible replacements is beyond the scope of this man page. More information can be found in the Perl documentation using the command:

perldoc perlre

Any number of regular expressions can be defined. Each regular expression is evaluated once for each line of the input file. Regular expressions are evaluated in the order they are defined.

Regular expressions can be undefined in the following way:

#rmregexp /regexp/replacement/
This will remove the specified regular expression.

In debugging mode the current list of regular expressions can be viewed using the pragma keyword:

#pragma filepp ShowRegexp
When not in debugging mode, this will produce no output.

A single regular expression can also be defined on the command line using the REGEXP macro, for example:

filepp -DREGEXP=/regexp/replacement/ -m regexp.pm inputfile

Note: the REGEXP macro must be defined BEFORE the regexp module is loaded, putting -DREGEXP... after -m regexp.pm will not work. When using the command line approach, if the REGEXP macro is successfully parsed as a regular expression it will be undefined from the normal filepp macro list before processing starts. Care should obviously be taken when escaping special characters in the shell with command line regexps.

 

BLC MODULE - blc.pm

The Bracket Line Continuation module causes lines to be continued if they have more open brackets: "(" than close brackets: ")" on a line. The line will be continued until an equal number of open and close brackets are found.

Brackets can be prevented from being counted for line continuation by escaping them with a backslash: "" and ")". Any brackets found with a preceding backslash will be ignored when deciding if line continuation should be done and then have the backslash removed once the full line has been found.

 

C MACROS MODULE - cmacros.pm

The cmacros module causes the definition of the following predefined macros to be quoted: DATE, TIME, VERSION, BASE_FILE, FILE, (note: predefined macros are written as __MACRO__).

This makes the macros more "C" like, as the C preprocessor also puts quotes around these macros.

 

C MACROS MODULE - cpp.pm

The cpp makes filepp behave in a similar manner to a C preprocessor cpp(1).

DISCLAIMER: filepp is not meant to be a drop in replacement for a C preprocessor even with this module. I would not recommend using filepp as a C preprocessor unless you fully understand how it differs from a real C preprocessor. The output from filepp with the cpp module will not be the same as a real C preprocessor.

 

GRAB MODULE - grab.pm

The grab module is used to grab input before processing. Its file name is grab.pm.

The grab module is mainly for use in other modules, such as for.pm and bigfunc.pm. It grabs all input from a file before any processing is done on it. This allows other modules to do processing on the original input data before the main processing is done. For example, the for module will store the original input inside a loop and re-use it each time the loop is processed.

#grab macro definition...
The grab module will start grabbing of all input from the grab keyword, onwards.
#endgrab
Ends a grab. Everything between this keyword and the last preceding #grab will be grabbed and stored for use in other modules.

Grabs can be nested if required.

When calling grab from another module, use the following functions:

Grab::StartGrab($startkeyword,$endkeyword)
$startkeyword is the keyword that StartGrab is called from. $endkeyword is the keyword that grabbing should stop at.
@List=Grab::GetInput()
Returns a Perl list containing all input grabbed from when grab was last run.
$line=Grab::GetInputLine()
Returns the line number of the input file where grabbing last started.

 

FILEPP MODULE API

The behaviour of filepp can be modified or extended through the use of modules. filepp modules are in fact perl(1) modules, and the rest of this section assumes the reader has a knowledge of Perl.

filepp modules are perl(1) modules which extend or modify filepp's behaviour by either calling or replacing filepp's internal functions. filepp has the Perl package name Filepp so its internal functions can be called within modules either as Filepp::function() or just function(). Any of filepp's internal functions can be called or replaced from within a filepp module, the most useful ones are:

Debug($string,$number)
Print $string as debugging information if debugging is enabled. $number is optional and can be used to set the debugging level at which $string should be printed, lower numbers being higher priority. Command line option d prints all debugging info for 2 and below, option dd prints all debugging information for 3 and below and option dl prints all debugging information for 1 and below. If $number is not provided, defaults to 1.
AddProcessor($function,$pos,$type)
Allows the module to add a function named $function to filepp's processing chain. The processing chain is a set of functions which are run on each line of a file as it is processed. The default functions in the processing chain are ParseKeywords which does keyword parsing and ReplaceDefines which does macro replacement. Further functions can be added to the chain, with each function taking a string (the current line) as input and returning the processed string as output.

By default, or if $pos is set to 0, the processor is added to the end of the processing chain. If $pos is set to 1 the processor is added to the start of the processing chain.

$type controls what the processor is run on. There are three options for this, 0 (default): the processor runs on everything passed to the processing chain; 1: the processor runs on full lines only; 2: the processor runs on part lines only (a part line is the text following a keyword such as if which needs to be parsed for macros).

Both $pos and $type are optional parameters.

AddProcessorAfter($function,$existing,$type)
Adds function $function to the processing chain directly after existing processor $existing. If $existing is not found then $function is added to the end of the processing chain. Regular expression matching is used to compare $existing with the names of the functions in the processing chain.

$type is optional.

AddProcessorBefore($function,$existing,$type)
Adds function $function to the processing chain directly before existing processor $existing. If $existing is not found then $function is added to the start of the processing chain. Regular expression matching is used to compare $existing with the names of the functions in the processing chain.

$type is optional.

RemoveProcessor($function)
Removes the processor function $function from the processing chain.
$string=ReplaceDefines($string)
Replaces all macros in $string with their definitions and returns the processed string.
AddKeyword($string,$function)
Add the keyword named $string. When the keyword is found in text processing the function named $function will be run with everything following the keyword passed as a single argument.
RemoveKeyword($string)
Removes the keyword named $string.
RemoveAllKeywords()
Removes all the keywords currently defined for filepp (used for the -k command line option).
AddIfword($string)
Adds keyword named $string to Ifword list. An Ifword takes in the string following the keyword and optionally parses it, returning a 1 if the string parses to true and 0 for false. The default Ifwords are if, ifdef and ifndef.
RemoveIfword($string)
Removes keyword named $string from Ifword list (note: this does NOT remove the keyword, use RemoveKeyword for that).
AddElseword($string)
Adds keyword named $string to Elseword list. An Elseword takes in the string following the keyword and optionally parses it, returning a 1 if the string parses to true and 0 for false. The default Elsewords are else and elif.
RemoveElseword($string)
Removes keyword named $string from Elseword list.
AddEndifword($string)
Adds keyword named $string to Endifword list. An Endifword should return a 1 to indicate successful termination of the if block. If the Endifword returns 0 the Endifword is ignored and filepp assumes the current if block carries on after the Endifword. The default Endifword is endif.
RemoveEndifword($string)
Removes keyword named $string from Endifword list.
AddIncludePath($string)
Adds the include path $string to the list of directories to search for include files (used for the -I command line option).
AddModulePath($string)
Adds the path $string to the list of directories to search for filepp modules (used for the -M command line option).
AddOpenInputFunc($function)
Adds a $function to a list of functions to be run each time a new base input file is opened.
AddCloseInputFunc($function)
Adds a $function to a list of functions to be run each time a new base input file is closed.
AddOpenOutputFunc($function)
Adds a $function to a list of functions to be run each time an output file is opened.
AddCloseOutputFunc($function)
Adds a $function to a list of functions to be run each time an output file is closed.
AddInputFile($string)
Adds another input file to the list of files to be processed (used for adding input files at the command line).
ChangeOutputFile($string)
Closes the current output file and attempts to open a new one named $string.
SetKeywordchar($string)
Set the initial keyword char to $string (used for the -kc command line option).
SetContchar($string)
Set the line continuation char to $string (used for the -lc command line option).
SetContrepchar($string)
Set the line continuation replacement char to $string (used for the -lr command line option).
SetOptLineEndchar($string)
Set the optional keyword line end character to $string (used for the -lec command line option).
SetBlankSupp(1/0)
Turns blank-line suppression on/off (1 = suppress, 0 = don't suppress). When blank-line suppression is on, blank lines in input files will not be copied to the output. Unlike the corresponding command-line option (-b), this function can also have effect in the top-level file. The setting of blank-line suppression applies to the current file being processed and all files included in the current file.
ResetBlankSupp()
Resets blank-line suppression to the command-line specified value. This only affects the output of blank lines from the current file being processed and all files included in the current file. In the top-level file, this always turns blank-line suppression off.
SetEatTrail($string)
If $string is a macro, whenever the macro is replaced all blank space between the macro's replacement and the next character on the line will be eaten. For example, if macro foo is defined to bar and foo has been set to have it's trail eaten, the following:


 eat my foo trail

is replaced with


 eat my bartrail

CheckEatTrail($string)
Returns 1 if macro $string will have it's tail eaten, 0 otherwise.
SetEnvchar($string)
Set the prefix of environment variables converted to macros (envchar) to $string (used for -ec and -ecn command line options).
DefineEnv()
Define all environment variables as macros with prefix envchar (used for -e command line option).
SetOutput(1/0)
Turns writing of parsed input file to output file on/off. This takes either 1 (output on) or 0 (output off) as input. When the output is turned off, the only output produced from filepp will be that generated by modules.
SetWordBoundaries(1/0)
Turns on(1) or off(0) word boundary checking when replacing macros (used for the -w command line option).
SetCharPerlre(1/0)
Turns on(1) or off(0) allowing of keyword prefix char and line continuation char to be Perl regular expressions (used for the -re command line option).
UndefAll()
Undefines all currently defined macros, including predefined ones (used for the -u command line option).
UseModule($string)
Loads a perl(1) module named $string using the Perl command require (used for the -m command line option).
SetParseLineEnd($function)
Sets the function to determine if line continuation should be done on current line to $function.
$string=GetNextLine()
Returns the next line (after line continuation has been dealt with) of the input file currently being processed. Returns NULL for end of file.
Write($string)
Writes $string to the current output file.
Output($string)
Conditionally writes $string to the current output file. If output is turned on then writes $string. Output is toggled off/on using SetOutput function.

In addition all the standard filepp keywords have equivalent functions which optionally take a single argument. The functions have the same name as the keyword, only with a capital first letter (eg: #define string calls the function Define(string)).

A full description of the Parse function and all the other filepp internal functions is beyond the scope of this man page. The filepp script is well commented and hopefully readable by a Perl programmer, so use the source Luke!

 

BUGS

filepp has no known bugs, only "features". If you find any "features", please report them to the author.  

COPYING

Copyright (C) 2000-2007 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
FILEPP MODULES
FOR MODULE - for.pm
FOREACH MODULE - foreach.pm
LITERAL MODULE - literal.pm
TOUPPER MODULE - toupper.pm
TOLOWER MODULE - tolower.pm
C/C++ COMMENT MODULE - c-comment.pm
HASH COMMENT MODULE - hash-comment.pm
FUNCTION MODULE - function.pm
MATHS MODULE - maths.pm
FORMAT MODULE - format.pm
BIGDEF MODULE - bigdef.pm
BIGFUNC MODULE - bigfunc.pm
DEFPLUS MODULE - defplus.pm
REGEXP MODULE - regexp.pm
BLC MODULE - blc.pm
C MACROS MODULE - cmacros.pm
C MACROS MODULE - cpp.pm
GRAB MODULE - grab.pm
FILEPP MODULE API
BUGS
COPYING
SEE ALSO
AUTHOR

This document was created by man2html, using the manual pages.
Time: 20:02:20 GMT, February 27, 2007 ./filepp-1.8.0/filepp-1.8.0.spec0000644000573500001440000000212310571107114015125 0ustar darrenusersSummary: Generic file pre-processor Name: filepp Version: 1.8.0 Release: 1 Copyright: GPL Group: Applications/File Source: http://www.cabaret.demon.co.uk/filepp/filepp-1.8.0.tar.gz Url: http://www.cabaret.demon.co.uk/filepp/ Requires: perl BuildArch: noarch # Turn auto dependencies off as rpm treats filepp modules as normal Perl # modules, which messes things up. %undefine __find_provides %undefine __find_requires %description filepp is a generic file preprocessor that lets C preprocessor functionality be used with any file type. It supports the full set of C preprocessor keywords (#include, #define, #if, etc.). filepp is also highly customisable and allows users to easily add their own keywords or modify the behaviour of existing keywords, and is more user friendly than cpp. %prep %setup %build %configure make %install make install %clean %files %doc COPYING ChangeLog INSTALL README filepp.lsm filepp.html %{_bindir}/filepp %{_mandir}/man1/filepp.1* %{_datadir}/filepp %changelog * Tue Oct 09 2001 Darren Miller - created first rpm distribution of filepp ./filepp-1.8.0/filepp.spec.in0000644000573500001440000000213707733400031015075 0ustar darrenusersSummary: Generic file pre-processor Name: filepp Version: __VERSION__ Release: 1 Copyright: GPL Group: Applications/File Source: http://www.cabaret.demon.co.uk/filepp/filepp-__VERSION__.tar.gz Url: http://www.cabaret.demon.co.uk/filepp/ Requires: perl BuildArch: noarch # Turn auto dependencies off as rpm treats filepp modules as normal Perl # modules, which messes things up. %undefine __find_provides %undefine __find_requires %description filepp is a generic file preprocessor that lets C preprocessor functionality be used with any file type. It supports the full set of C preprocessor keywords (#include, #define, #if, etc.). filepp is also highly customisable and allows users to easily add their own keywords or modify the behaviour of existing keywords, and is more user friendly than cpp. %prep %setup %build %configure make %install make install %clean %files %doc COPYING ChangeLog INSTALL README filepp.lsm filepp.html %{_bindir}/filepp %{_mandir}/man1/filepp.1* %{_datadir}/filepp %changelog * Tue Oct 09 2001 Darren Miller - created first rpm distribution of filepp ./filepp-1.8.0/filepp.lsm.in0000644000573500001440000000151107260457737014755 0ustar darrenusersBegin4 Title: filepp Version: __VERSION__ Entered-date: __ISO_DATE__ Description: filepp is a generic file preprocessor that lets C preprocessor functionality be used with any file type. It supports the full set of C preprocessor keywords (#include, #define, #if, etc.). filepp is also highly customisable and allows users to easily add their own keywords or modify the behaviour of existing keywords, and is more user friendly than cpp. filepp is written in Perl. Keywords: cpp perl filepp preprocessing preprocessor Author: darren@cabaret.demon.co.uk (Darren Miller) Maintained-by: darren@cabaret.demon.co.uk (Darren Miller) Primary-site: http://www.cabaret.demon.co.uk/filepp/ filepp-__VERSION__.tar.gz Alternate-site: Original-site: Platforms: All platforms for which Perl is available. Copying-policy: GPL End ./filepp-1.8.0/filepp.1.in0000644000573500001440000006644510571106010014311 0ustar darrenusers.\" Hey Emacs! This file is -*- nroff -*- source. #define CPP1 \fBcpp\fP(1) #define SH1 \fBsh\fP(1) #define PERL1 \fBperl\fP(1) #define FILEPP1 \fBfilepp\fP .\" __FILEPP_INPUT__ version __VERSION__ .\" 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. .\" .TH FILEPP 1 "__DATE__" "Version: __VERSION__" .\" Please update the above date whenever this man page is modified. .SH NAME filepp \- A generic file preprocessor .SH SYNOPSIS .B filepp .RI [ options ] .I filename(s) .SH DESCRIPTION FILEPP1 is a generic file preprocessor designed to allow the functionality provided by the C preprocessor CPP1 to be used with any file type. FILEPP1 is designed to be easily customised and extended. .SH OPTIONS FILEPP1 accepts the following command line options: .TP .BI \-b Suppress blank lines originating from include files (this has no effect on the top-level file). .TP .BI \-c Read input from STDIN instead of a file. Note: if both \fB-c\fP and input files are specified, both are used as inputs in the order given. .TP .BI \-D macro Predefine \fImacro\fP to have a definition of `\|\fB1\fP\|'. .TP .BI \-D macro = defn Predefine \fImacro\fP to have a definition of \fIdefn\fP. .TP .BI \-d Output debugging information. .TP .BI \-dd Output verbose debugging information. This option shows all normal debugging information, plus the full list of defined macros every time the list changes. .TP .BI \-dl Output light debugging information. This option shows minimal debugging information. .TP .BI \-dpre char Prefix all debugging information with \fIchar\fP (can be character or string), can be used to make debugging easier to read. .TP .BI \-dpost char Postfix all debugging information with \fIchar\fP (can be character or string), this defaults to a newline. If \fIchar\fP does not contain a newline, then no newline will be printed after debugging messages. (Newlines can be put in \fIchar\fP using the \_\_NEWLINE\_\_ macro.) .TP .BI \-ds Print debugging info on stdout rather than stderr. .TP .BI \-e Define all environment variables as macros with prefix \fBenvchar\fP. .TP .BI \-ec " char" Set \fBenvchar\fP (prefix of environment variables defined as macros) to \fIchar\fP, defaults to \fB$\fP. (Note: this option only takes effect at the time the environment variables are converted to macros). .TP .BI -ecn Set \fBenvchar\fP (prefix of environment variables defined as macros) to nothing (no prefix). .TP .BI \-h Show summary of options. .TP .BI \-I dir Append directory \fIdir\fP to the list of directories searched for include files. .TP .BI \-imacros " file" Reads in macros from \fIfile\fP, but discards everything else in the file. .TP .BI \-k Turn off parsing of all keywords. This is useful if you just want to use the macro expansion facilities of FILEPP1. With this option all keywords found will be ignored, FILEPP1 will just replace any macros specified with the \fB-D\fP\fImacro\fP=\fIdefn\fP option. .TP .BI \-kc " char" Set keyword prefix character to \fIchar\fP (can also be a string). All FILEPP1 keywords are prefixed with the character \fB#\fP by default. This option allows the prefix to be changed to something else. .TP .BI \-lc " char" Set line continuation character to \fIchar\fP (can also be a string). When the line continuation character is found with a newline following it, it and the newline are replaced by the line continuation replacement character. Default is \fB\\\fP (CPP1 style). .TP .BI \-lec " char" Set optional keyword line end character to \fIchar\fP (can also be a string). This allows extra characters to be placed at the end of a line containing a keyword. The extra characters will be ignored. This is useful if keywords are to be embedded in HTML or C style comments. For example, to embed keywords in an HTML comment the keyword prefix character could be set to \fB<--!#\fP and the optional keyword line end character set to \fB-->\fP. An example keyword would then be: \fB\fP In the case the optional keyword line end characters \fB-->\fP would be ignored. .TP .BI \-lr " char" Set line continuation replacement character to \fIchar\fP (can also be a string). Default is a null string (CPP1 style). .TP .BI \-lrn Set line continuation replacement character to be a newline. .TP .BI \-m " module.pm" Load module \fImodule.pm\fP. \fImodule.pm\fP is a PERL1 module which can be used to extend or modify the behaviour of FILEPP1. See section \fBFILEPP MODULES\fP for details of modules included with filepp and \fBFILEPP MODULE API\fP for details on how to write your own modules. .TP .BI \-M dir Append directory \fIdir\fP to the list of directories searched for filepp modules. This list defaults to the directory the filepp modules are installed (if any) plus the default Perl module paths. (Note: this adds the directory to the Perl @INC list.) .TP .BI \-mp " char" Prefix all macros with \fIchar\fP. Macros are defined in the normal way, but will only be replaced when found prefixed with \fIchar\fP. For example, filepp macros will behave similar to Bourne shell (SH1) variables if \fIchar\fP is set to \fB$\fP. .TP .BI \-mpnk Turns off macro prefixes within keywords. When using a macro prefix character this option allows macros to be used without the prefix in keyword processing. For example, if the macro prefix is \fB$\fP then and \fB#if\fP would be written as: \fB#if $MACRO == 1\fP Using the \fBmpnk\fP option allows the \fB#if\fP to be written as: \fB#if MACRO == 1\fP .TP .BI \-o " \fIname\fP" Write output to \fIname\fP 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 \fIname~\fP. .TP .BI \-ov Overwrite mode, causes the output file to overwrite the input file. Useful when modifying a large number of files at once, eg: FILEPP1 -ov -DTHIS=THAT * The original input file(s) will be backed-up as \fIname~\fP. .TP .BI \-ovc " \fBIN\fP=\fBOUT\fP" Similar to overwrite mode, the difference is the output filename is input filename with \fBIN\fP part converted to \fBOUT\fP. For example, to process a set of files all ending with .in and have the output files all ending in .out do: FILEPP1 -ovc .in=.out *.in In this case a file called \fItest.in\fP will be processed and the output file will be \fItest.out\fP. Note: if the input file does not contain \fBIN\fP then the output file will have the same name as the input file and the original input file(s) will be backed-up as \fIname~\fP! .TP .BI \-pb Preserve blank lines. Using this option attempts to keep as many lines in the output file as are in the input file, so all blank lines which normally would not get printed are printed. Useful when comparing intput file with output. .TP .BI \-re Treat keyword and macro prefix characters and line continuation character as Perl regular expressions instead of normal strings. .TP .BI \-s Run FILEPP1 in safe mode. This turns off the \fBpragma\fP keyword. .TP .BI \-U macro Undefine previously defined \fImacro\fP. .TP .BI \-u Undefine all currently defined macros, including predefined ones. .TP .BI \-v Show version of program. .TP .BI \-w Turn on word boundaries when replacing macros. When word boundaries are on, macros will only be replaced if the macro appears in the text as a word. For example, by default \fImacro\fP would be replaced in both cases of the following text: \fImacro as word, macroNOTaword\fP but only the first occurrence would be replaced with the \fB-w\fP option. With this option enabled FILEPP1 will only replace macros which contain alphanumeric characters. International (non-ASCII) character sets can be supported using Perl's locale handling. .SH KEYWORDS FILEPP1 supports the following keywords: .TP .BR #include " <\fIFILE\fP>" Include a file in the file being processed. This variant is used for "system" include files. It searches for a file named \fIFILE\fP in a list of directories specified by you. Directories are specified with the command option `-I'. FILEPP1 does not predefine any system directories in which to search for files. .TP .BR #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 \fIFILE\fP first in the current directory, then in the list of directories specified with the command option `-I'. The current directory is the directory the base input file is in. .TP .BR #define " \fImacro\fP" Define the macro \fImacro\fP to have a definition of `1'. \fImacro\fP can then be used with the keywords \fB#ifdef\fP and \fB#ifndef\fP. .TP .BR #define " \fImacro\fP \fIdefn\fP" Define the macro \fImacro\fP to have the value \fIdefn\fP. \fImacro\fP can then be used with the keywords \fB#ifdef\fP and \fP#ifndef\fP. Also, all instances of \fImacro\fP following the \fB#define\fP statement will be replaced with the string \fIdefn\fP. The string \fIdefn\fP is taken to be all the characters on the line following \fImacro\fP. .TP .BR #define " \fImacro(arg1, arg2, ...)\fP \fIdefn\fP" Define the macro \fImacro\fP to have the value \fIdefn\fP with arguments \fI(arg1, arg2, ...)\fP. \fImacro\fP can be used as follows: \fB#define\fP \fImacro(foo)\fP defn with foo in Now when replacing occurs: \fImacro(bar)\fP will become: defn with bar in Macros can have any number of comma separated arguments. Macros can also have variable numbers of arguments if the final macro ends in ..., for example: \fB#define\fP \fIerror(string, args...)\fP fprintf(stderr, string, args); Here the first argument given becomes \fIstring\fP and all other arguments will become \fIargs\fP. If called as: \fIerror("%d,%s", i, string)\fP it will give fprintf(stderr, "%d,%s", i, string); Also, if a macro with a variable number of arguments is passed no arguments for the variable argument, then commas can be optionally removed from the definition by preceding the definition with "##". For example: \fB#define\fP \fIerror(string, args...)\fP fprintf(stderr, string, ##args); If this is called as: \fIerror("empty")\fP then result will be: fprintf(stderr, "empty"); The comma immediately before \fI##args\fP has been removed. .TP .BR #if " \fIexpr\fP" A conditional statement, \fIexpr\fP will be evaluated to true (1) or false (0). If \fIexpr\fP evaluates to true, the text between the \fB#if\fP and the next \fB#else\fP or \fB#endif\fP will be included. If \fIexpr\fP evaluates to false, the text between the \fB#if\fP and the next \fB#else\fP or \fB#endif\fP will be ignored. \fIexpr\fP can use all the usual cpp style comparisons (==, !=, <, >, etc.). Multiple comparisons can be combined with and (&&) and or (||). The \fBdefined\fP keyword can also be used to check if macros are defined. For example: \fI#if defined macro && macro == defn\fP Note: filepp's \fB#if\fP does not work in exactly the same way as CPP1's \fB#if\fP. CPP1's \fB#if\fP only does numerical style comparisons. Filepp's \fB#if\fP statement can also compare strings and regular expressions using PERL1's full range of comaprison operations. For example, to test if two strings are exactly equal use: \fI#if "MACRO" eq "string"\fP To test if strings are not equal use \fIne\fP instead of \fIeq\fP. Regular expressions can also be tested, for example to test if a macro has any whitespace in it use: \fI#if "MACRO" =~ /\\s/\fP To test if a macro does not have any whitespace in it \fI=~\fP can be replaced with \fI!~\fP. Perl experts: \fB#if\fP works by first parsing \fIexpr\fP for the \fBdefined\fP 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 \fIexpr\fP for any other macros and replaces them with their definition. Finally it passes \fIexpr\fP through Perl's \fBeval\fP function, which returns true or false. .TP .BR #elif " \fIexpr\fP" \fB#elif\fP stands for "else if". Like \fB#else\fP, it goes in the middle of a \fB#if\fP[\fBn\fP][\fBdef\fP]-\fB#endif\fP pair and subdivides it; it does not require a matching \fB#endif\fP of its own. Like \fB#if\fP, the \fB#elif\fP directive includes an expression to be tested. .TP .BR #ifdef " \fImacro\fP" A conditional statement, if \fImacro\fP has been defined the text between the \fB#ifdef\fP and the next \fB#else\fP or \fB#endif\fP will be included. If \fImacro\fP has not been defined the text between the \fB#ifdef\fP and the next \fB#else\fP or \fB#endif\fP will be ignored. .TP .BR #ifndef " \fImacro\fP" The reverse case of the \fB#ifdef\fP conditional. .TP .BR #else The \fB#else\fP directive can be added to a conditional to provide alternative text to be used if the condition is false. .TP .BR #endif Used to terminate a conditional statement. Normal processing resumes following the \fB#endif\fP. .TP .BR #undef " \fImacro\fP" Undefine a previously defined macro. .TP .BR #error " \fImesg\fP" Causes FILEPP1 to exit with the error message \fImesg\fP. .TP .BR #warning " \fImesg\fP" Causes FILEPP1 to issue the warning message \fImesg\fP. .TP .BR #comment " \fImesg\fP" As FILEPP1 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 \fB#comment\fP are treated as comments and removed by FILEPP1. .TP .BR #pragma " \fBfilepp\fP \fIfunction arg1, arg2, ...\fP" The \fB#pragma\fP keyword immediately followed by the word \fBfilepp\fP allows the user to execute a Perl function during parsing. The word immediately following \fBfilepp\fP is taken as the name of the function and the remainder of the line is taken to be a comma separated list of arguments to the function. Any of the FILEPP1 internal functions (see section \fBFILEPP MODULE API\fP) can be called with the \fB#pragma\fP keyword. \fIWarning:\fP There are obvious security risks with allowing arbitrary functions to be run, so the -s (safe mode) command line option has been added which turns the \fB#pragma\fP keyword off. .SH PREDEFINED MACROS FILEPP1 supports a set of predefined macros. All the predefined macros are of the form \fB__MACRO__\fP, where \fBMACRO\fP is: .TP .BR FILE This macro expands to the name of the current input file. .TP .BR LINE This macro expands to the current input line number. .TP .BR 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 "__DATE__". .TP .BR ISO_DATE This macro expands to a string that describes the date on which the preprocessor is being run. The string is in the format specified by ISO 8601 (YYYY-MM-DD) and looks like "__ISO_DATE__". .TP .BR 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 "__TIME__". .TP .BR BASE_FILE This macro expands to the name of the main input file. .TP .BR 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 \fB#include\fP directive and decremented at every end of file. .TP .BR NEWLINE This macro expands to a newline. .TP .BR TAB This macro expands to a tab. .TP .BR NULL This macro expands to nothing. It is useful if you want to define something to be nothing. .TP .BR VERSION This macro expands to a string constant which describes the version number of FILEPP1. The string is a sequence of decimal numbers separated by periods and looks like "__VERSION__". .TP .BR FILEPP_INPUT This macro expands to a string constant which says the file was generated automatically from the current \fBBASE_FILE\fP and looks like "__FILEPP_INPUT__". .SH FILEPP MODULES The following modules are included with the main filepp distribution: .PP #include "modules/for/for.1.in" .PP #include "modules/foreach/foreach.1.in" .PP #include "modules/literal/literal.1.in" .PP #include "modules/case/case.1.in" .PP #include "modules/comment/comment.1.in" .PP #include "modules/function/function.1.in" .PP #include "modules/maths/maths.1.in" .PP #include "modules/format/format.1.in" .PP #include "modules/bigdef/bigdef.1.in" .PP #include "modules/bigfunc/bigfunc.1.in" .PP #include "modules/defplus/defplus.1.in" .PP #include "modules/regexp/regexp.1.in" .PP #include "modules/blc/blc.1.in" .PP #include "modules/cmacros/cmacros.1.in" .PP #include "modules/cpp/cpp.1.in" .PP #include "modules/grab/grab.1.in" .PP #define EXISTING \fI$existing\fP #define FILENAME \fI$filename\fP #define FUNCTION \fI$function\fP #define NUMBER \fI$number\fP #define POSITION \fI$pos\fP #define STRING \fI$string\fP #define TYPE \fI$type\fP .SH FILEPP MODULE API The behaviour of FILEPP1 can be modified or extended through the use of modules. FILEPP1 modules are in fact PERL1 modules, and the rest of this section assumes the reader has a knowledge of Perl. FILEPP1 modules are PERL1 modules which extend or modify FILEPP1's behaviour by either calling or replacing FILEPP1's internal functions. FILEPP1 has the Perl package name \fBFilepp\fP so its internal functions can be called within modules either as \fBFilepp::function()\fP or just \fBfunction()\fP. Any of FILEPP1's internal functions can be called or replaced from within a FILEPP1 module, the most useful ones are: .TP .BR Debug(STRING, NUMBER) Print STRING as debugging information if debugging is enabled. NUMBER is optional and can be used to set the debugging level at which STRING should be printed, lower numbers being higher priority. Command line option \fBd\fP prints all debugging info for 2 and below, option \fBdd\fP prints all debugging information for 3 and below and option \fBdl\fP prints all debugging information for 1 and below. If NUMBER is not provided, defaults to 1. .TP .BR AddProcessor(FUNCTION, POSITION, TYPE) Allows the module to add a function named FUNCTION to FILEPP1's processing chain. The processing chain is a set of functions which are run on each line of a file as it is processed. The default functions in the processing chain are \fBParseKeywords\fP which does keyword parsing and \fBReplaceDefines\fP which does macro replacement. Further functions can be added to the chain, with each function taking a string (the current line) as input and returning the processed string as output. By default, or if POSITION is set to 0, the processor is added to the end of the processing chain. If POSITION is set to 1 the processor is added to the start of the processing chain. TYPE controls what the processor is run on. There are three options for this, 0 (default): the processor runs on everything passed to the processing chain; 1: the processor runs on full lines only; 2: the processor runs on part lines only (a part line is the text following a keyword such as \fBif\fP which needs to be parsed for macros). Both POSITION and TYPE are optional parameters. .TP .BR AddProcessorAfter(FUNCTION, EXISTING, TYPE) Adds function FUNCTION to the processing chain directly after existing processor EXISTING. If EXISTING is not found then FUNCTION is added to the end of the processing chain. Regular expression matching is used to compare EXISTING with the names of the functions in the processing chain. TYPE is optional. .TP .BR AddProcessorBefore(FUNCTION, EXISTING, TYPE) Adds function FUNCTION to the processing chain directly before existing processor EXISTING. If EXISTING is not found then FUNCTION is added to the start of the processing chain. Regular expression matching is used to compare EXISTING with the names of the functions in the processing chain. TYPE is optional. .TP .BR RemoveProcessor(FUNCTION) Removes the processor function FUNCTION from the processing chain. .TP .BR STRING = ReplaceDefines(STRING) Replaces all macros in STRING with their definitions and returns the processed string. .TP .BR AddKeyword(STRING, FUNCTION) Add the keyword named STRING. When the keyword is found in text processing the function named FUNCTION will be run with everything following the keyword passed as a single argument. .TP .BR RemoveKeyword(STRING) Removes the keyword named STRING. .TP .BR RemoveAllKeywords() Removes all the keywords currently defined for FILEPP1 (used for the -k command line option). .TP .BR AddIfword(STRING) Adds keyword named STRING to Ifword list. An Ifword takes in the string following the keyword and optionally parses it, returning a 1 if the string parses to true and 0 for false. The default Ifwords are \fBif\fP, \fBifdef\fP and \fBifndef\fP. .TP .BR RemoveIfword(STRING) Removes keyword named STRING from Ifword list (note: this does NOT remove the keyword, use \fBRemoveKeyword\fP for that). .TP .BR AddElseword(STRING) Adds keyword named STRING to Elseword list. An Elseword takes in the string following the keyword and optionally parses it, returning a 1 if the string parses to true and 0 for false. The default Elsewords are \fBelse\fP and \fBelif\fP. .TP .BR RemoveElseword(STRING) Removes keyword named STRING from Elseword list. .TP .BR AddEndifword(STRING) Adds keyword named STRING to Endifword list. An Endifword should return a 1 to indicate successful termination of the if block. If the Endifword returns 0 the Endifword is ignored and filepp assumes the current if block carries on after the Endifword. The default Endifword is \fBendif\fP. .TP .BR RemoveEndifword(STRING) Removes keyword named STRING from Endifword list. .TP .BR AddIncludePath(STRING) Adds the include path STRING to the list of directories to search for include files (used for the -I command line option). .TP .BR AddModulePath(STRING) Adds the path STRING to the list of directories to search for filepp modules (used for the -M command line option). .TP .BR AddOpenInputFunc(FUNCTION) Adds a FUNCTION to a list of functions to be run each time a new base input file is opened. .TP .BR AddCloseInputFunc(FUNCTION) Adds a FUNCTION to a list of functions to be run each time a new base input file is closed. .TP .BR AddOpenOutputFunc(FUNCTION) Adds a FUNCTION to a list of functions to be run each time an output file is opened. .TP .BR AddCloseOutputFunc(FUNCTION) Adds a FUNCTION to a list of functions to be run each time an output file is closed. .TP .BR AddInputFile(STRING) Adds another input file to the list of files to be processed (used for adding input files at the command line). .TP .BR ChangeOutputFile(STRING) Closes the current output file and attempts to open a new one named STRING. .TP .BR SetKeywordchar(STRING) Set the initial keyword char to STRING (used for the -kc command line option). .TP .BR SetContchar(STRING) Set the line continuation char to STRING (used for the -lc command line option). .TP .BR SetContrepchar(STRING) Set the line continuation replacement char to STRING (used for the -lr command line option). .TP .BR SetOptLineEndchar(STRING) Set the optional keyword line end character to STRING (used for the -lec command line option). .TP .BR SetBlankSupp(1/0) Turns blank-line suppression on/off (1 = suppress, 0 = don't suppress). When blank-line suppression is on, blank lines in input files will not be copied to the output. Unlike the corresponding command-line option (-b), this function can also have effect in the top-level file. The setting of blank-line suppression applies to the current file being processed and all files included in the current file. .TP .BR ResetBlankSupp() Resets blank-line suppression to the command-line specified value. This only affects the output of blank lines from the current file being processed and all files included in the current file. In the top-level file, this always turns blank-line suppression off. .TP .BR SetEatTrail(STRING) If STRING is a macro, whenever the macro is replaced all blank space between the macro's replacement and the next character on the line will be eaten. For example, if macro \fIfoo\fP is defined to \fIbar\fP and \fIfoo\fP has been set to have it's trail eaten, the following: eat my foo trail is replaced with eat my bartrail .TP .BR CheckEatTrail(STRING) Returns 1 if macro STRING will have it's tail eaten, 0 otherwise. .TP .BR SetEnvchar(STRING) Set the prefix of environment variables converted to macros (\fBenvchar\fP) to STRING (used for -ec and -ecn command line options). .TP .BR DefineEnv() Define all environment variables as macros with prefix \fBenvchar\fP (used for -e command line option). .TP .BR SetOutput(1/0) Turns writing of parsed input file to output file on/off. This takes either 1 (output on) or 0 (output off) as input. When the output is turned off, the only output produced from FILEPP1 will be that generated by modules. .TP .BR SetWordBoundaries(1/0) Turns on(1) or off(0) word boundary checking when replacing macros (used for the -w command line option). .TP .BR SetCharPerlre(1/0) Turns on(1) or off(0) allowing of keyword prefix char and line continuation char to be Perl regular expressions (used for the -re command line option). .TP .BR UndefAll() Undefines all currently defined macros, including predefined ones (used for the -u command line option). .TP .BR UseModule(STRING) Loads a PERL1 module named STRING using the Perl command \fBrequire\fP (used for the -m command line option). .TP .BR SetParseLineEnd(FUNCTION) Sets the function to determine if line continuation should be done on current line to FUNCTION. .TP .BR STRING = GetNextLine() Returns the next line (after line continuation has been dealt with) of the input file currently being processed. Returns NULL for end of file. .TP .BR Write(STRING) Writes STRING to the current output file. .TP .BR Output(STRING) Conditionally writes STRING to the current output file. If output is turned on then writes STRING. Output is toggled off/on using SetOutput function. .PP In addition all the standard FILEPP1 keywords have equivalent functions which optionally take a single argument. The functions have the same name as the keyword, only with a capital first letter (eg: \fB#define\fP \fIstring\fP calls the function \fBDefine(\fP\fIstring\fP\fB)\fP). A full description of the \fBParse\fP function and all the other FILEPP1 internal functions is beyond the scope of this man page. The FILEPP1 script is well commented and hopefully readable by a Perl programmer, so use the source Luke! .SH BUGS FILEPP1 has no known bugs, only "features". If you find any "features", please report them to the author. .SH COPYING Copyright (C) 2000-2007 Darren Miller .PP FILEPP1 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. .PP 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. .PP 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. .SH "SEE ALSO" .BR CPP1, .BR PERL1 .SH AUTHOR Darren Miller . ./filepp-1.8.0/Makefile.in0000644000573500001440000001427310564200436014411 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.34 $ # Last changed : $Date: 2007/02/13 00:06:54 $ # Description : Main Makefile # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ mandir = @mandir@ srcdir = @srcdir@ builddir = @builddir@ datarootdir = @datarootdir@ moduledir = @moduledir@ # top level of test build directory TESTBUILD = @abs_builddir@/testbuild module_subdirs = @module_subdirs@ all_subdirs = $(module_subdirs) tests ############################################################################## # Programs and files ############################################################################## FILEPP = $(builddir)/filepp FILEPPMAN = $(builddir)/filepp.1 FILEPPHTML = $(builddir)/filepp.html FILEPPLSM = $(builddir)/filepp.lsm FILEPPSPEC = $(builddir)/filepp-@VERSION@.spec DISTRIBDIR = $(builddir)/filepp-@VERSION@ DISTRIB = $(DISTRIBDIR).tar.gz CONFIGURE = $(srcdir)/configure ECHO = @echo@ RM = @rm@ CP = cp -pr MKDIR = $(srcdir)/mkinstalldirs INSTALL = @INSTALL@ TAR = tar GZIP = gzip MAN2HTML = man2html ############################################################################## # Dependencies ############################################################################## IFLAGS = -I$(srcdir) DFLAGS = -DHIDDEN default: $(FILEPP) $(FILEPPMAN) $(FILEPP): $(FILEPPIN) $(CONFIGURE) # man page $(FILEPPMAN): $(srcdir)/filepp.1.in @$(ECHO) Processing $(srcdir)/filepp.1.in $(COMPILE.filepp) $(srcdir)/filepp.1.in -o $@ # lsm entry $(FILEPPLSM): $(srcdir)/filepp.lsm.in # spec entry $(FILEPPSPEC): $(srcdir)/filepp.spec.in @$(ECHO) Processing $(srcdir)/filepp.spec.in $(COMPILE.filepp) -k $(srcdir)/filepp.spec.in -o $@ ######################################################################### # generic rule to make things in subdirectories ######################################################################### dirmake: @for subdir in $(DIRECTORIES); do \ $(ECHO) ""; \ $(ECHO) "Entering directory $$subdir"; \ (cd $$subdir && $(MAKE) $(TARGET)) \ || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" # check, test, demo, whatever you wanna call it test: $(builddir)/test.html check: test example:test demo: test # full test of all modules and filepp fulltest: testbuild test $(MAKE) dirmake DIRECTORIES="$(all_subdirs)" TARGET=test $(builddir)/test.html: $(FILEPP) $(srcdir)/test.html.in \ $(srcdir)/header.html.in $(srcdir)/footer.html.in $(srcdir)/testsuite # makes a test version of filepp and installs it so it uses the correct # versions of the modules (rather than any versions installed elsewhere) .PHONY: testbuild testbuild: $(MKDIR) $(TESTBUILD) (cd $(TESTBUILD) && @abs_top_srcdir@/configure --prefix=$(TESTBUILD) && $(MAKE) && $(MAKE) install) # html version of man page $(FILEPPHTML): $(FILEPPMAN) $(MAN2HTML) $(FILEPPMAN) > $(FILEPPHTML) # installation install: $(FILEPP) $(FILEPPMAN) @$(MKDIR) $(bindir) $(INSTALL) $(FILEPP) $(bindir) @$(MKDIR) $(mandir)/man1 $(INSTALL) -m 644 $(FILEPPMAN) $(mandir)/man1 $(MKDIR) $(moduledir) $(MAKE) dirmake DIRECTORIES="$(module_subdirs)" TARGET=install # distribution distrib: $(FILEPPMAN) $(FILEPPLSM) $(FILEPPHTML) $(FILEPPSPEC) -$(MKDIR) $(DISTRIBDIR) $(CP) $(FILEPPMAN) $(FILEPPLSM) $(FILEPPHTML) \ $(FILEPPSPEC) $(srcdir)/filepp.spec.in \ $(srcdir)/filepp.lsm.in $(srcdir)/filepp.1.in \ $(srcdir)/Makefile.in $(srcdir)/configure.in \ $(srcdir)/COPYING $(srcdir)/INSTALL $(srcdir)/README \ $(srcdir)/install-sh $(srcdir)/configure $(srcdir)/mkinstalldirs \ $(srcdir)/filepp.in $(srcdir)/ChangeLog \ $(srcdir)/footer.html.in $(srcdir)/header.html.in \ $(srcdir)/test.html.in $(srcdir)/testsuite $(srcdir)/testinc \ $(srcdir)/testmod.pm \ $(srcdir)/modules $(srcdir)/tests \ $(DISTRIBDIR) $(TAR) czvf $(DISTRIB) $(DISTRIBDIR) $(RM) -r $(DISTRIBDIR) # clean and distclean clean: $(MAKE) dirmake DIRECTORIES="$(all_subdirs)" TARGET=clean $(RM) $(builddir)/test.html *~ distclean: clean $(MAKE) dirmake DIRECTORIES="$(all_subdirs)" TARGET=distclean $(RM) Makefile $(FILEPPLSM) $(FILEPP) $(FILEPPMAN) $(FILEPPHTML) \ $(FILEPPSPEC) config.cache config.status config.log file $(DISTRIB) \ $(TESTBUILD) autom4te.cache ############################################################################## # Rules ############################################################################## .SUFFIXES: .in .html.in .html .lsm.in .lsm COMPILE.filepp = $(FILEPP) $(DFLAGS) $(IFLAGS) # rule to convert .html.in to .html .html.in.html: @$(ECHO) Processing $< $(COMPILE.filepp) $< -o $@ # rule to convert lsm.in to .lsm .lsm.in.lsm: @$(ECHO) Processing $< $(COMPILE.filepp) -k $< -o $@ ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/configure.in0000644000573500001440000000321410565412371014652 0ustar darrenusersdnl Process this file with autoconf to produce a configure script. AC_INIT(filepp.in) dnl This is the only place where the package version appears VERSION="1.8.0" AC_SUBST(VERSION) dnl default module directory moduledir="$datadir/filepp/modules" AC_ARG_WITH(moduledir, [ --with-moduledir=DIR Filepp modules installed in directory DIR], moduledir="$withval") dnl get rid of ${datarootdir} if test "$moduledir" = '${datarootdir}/filepp/modules'; then if test "$datarootdir" = 'NONE'; then moduledir=/usr/local/share/filepp/modules else moduledir=$datarootdir/filepp/modules fi fi dnl get rid of ${prefix} if test "$moduledir" = '${prefix}/share/filepp/modules'; then if test "$prefix" = 'NONE'; then moduledir=/usr/local/share/filepp/modules else moduledir=$prefix/share/filepp/modules fi fi AC_SUBST(moduledir) dnl Checks for programs. AC_PATH_PROG(PERL, perl) AC_PROG_INSTALL AC_SUBST(rm, "rm -fr") AC_SUBST(echo, "echo") AC_SUBST(diff, diff) AC_SUBST(module_subdirs, "modules/bigdef modules/bigfunc modules/blc modules/case modules/cmacros modules/comment modules/cpp modules/defplus modules/for modules/foreach modules/format modules/function modules/grab modules/literal modules/maths modules/regexp") AC_OUTPUT(Makefile filepp tests/Makefile modules/bigdef/Makefile modules/bigfunc/Makefile modules/blc/Makefile modules/case/Makefile modules/cmacros/Makefile modules/comment/Makefile modules/cpp/Makefile modules/defplus/Makefile modules/for/Makefile modules/foreach/Makefile modules/format/Makefile modules/function/Makefile modules/grab/Makefile modules/literal/Makefile modules/maths/Makefile modules/regexp/Makefile, chmod 755 filepp) ./filepp-1.8.0/COPYING0000644000573500001440000004311007124362167013377 0ustar darrenusers GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. ./filepp-1.8.0/INSTALL0000644000573500001440000002422707704300111013366 0ustar darrenusersfilepp Installation =================== To install filepp, first run the configure script. The only thing the configure script searches for is the location of Perl on your system. If it fails to find it, or you wish to use a different version to the one it finds, set the environment variable PERL to the full path to of the perl executable, for example: (bash,sh) : PERL=/usr/local/bin/perl export PERL (csh) : setenv PERL /usr/local/bin/perl The configure script will create the filepp executable for you and you're ready to go! To test filepp is working try making the file test.html with the command: make test This should create the file test.html from the files test.html.in, header.html.in and footer.html.in. If you wish to run the full filepp testsuite, use the command: make fulltest Note: you will need the "diff" command to run the full testsuite. If you wish to install filepp and it's man page use the command: make install This will default to installing filepp in /usr/local/bin/filepp and the man page in /usr/local/man/man1/filepp.1. You can specify which directory to install filepp in using the configure option --prefix, see below for further information. filepp also comes with some modules, which can be found in the modules directory. The modules get installed into the directory /usr/local/share/filepp/modules/ by default. This can be changed using the configure option --with-moduledir=moduledir Alternatively, moduledir is also affected by the configure options: --prefix=prefix (changes /usr/local to prefix) or --datadir=datadir (changes /usr/local/share to datadir) If for some reason you cannot run the configure script, all you need to do is copy filepp.in to filepp and then edit filepp and change the first line: @PERL@ to the location of perl on your system (eg: #!/usr/bin/perl). You also need to change line 37, replace @VERSION@ with the version number of the version of filepp (eg: 1.0.0), see the file filepp.lsm for this number. The moduledir is also set in the filepp script. If you do not run configure for whatever reason you should also change @moduledir@ on line 40 to the directory you intend to install the modules in (or delete the whole line if you are not using modules). Windows users should rename filepp.in to filepp.pl and change line 37, replace @VERSION@ with the version number of the version of filepp (eg: 1.0.0), see the file filepp.lsm for this number. You should also set the moduledir as described above. These are the generic instructions which come with configure: Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. ./filepp-1.8.0/README0000644000573500001440000000421210566651504013224 0ustar darrenusers filepp - A generic file pre-processor See the file INSTALL for installation instructions. The following examples of how filepp can be used are included with this ditribution: test.html - HTML document: to build: make test output: test.html input: test.html.in footer.html.in header.html.in testsuite - Testsuite, included in test.html. If all tests passed should return no output (except for 3 warnings about macro 'ARTHUR' which should be printed to stderr). testmod.pm - A very simple Filepp module. filepp.1 - Man page: to build: make man output: filepp.1 input: filepp.1.in filepp.lsm - Linux Software Map (LSM) entry: to build: make lsm output: filepp.lsm input: filepp.lsm.in The Makefile is used to build these files, it includes example rules which can be used to convert from a filepp input file to the output file. Filepp also supports modules which can be used to modify and extend the core functionality. All modules included with this release can be found in the "modules" directory. Credits: filepp is written by Darren Miller Thanks also go to the many who have submitted patches, bug reports, comments and generally helped make filepp what it is. Special thanks go to: Terry R. Friedrichsen Steve Hancock James Yolkowski Stephen Brooks For full documentation on how to use filepp read the man page. Copyright (C) 2000-2007 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Comments are welcome. - Darren Miller ./filepp-1.8.0/install-sh0000755000573500001440000001273607124362170014354 0ustar darrenusers#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 ./filepp-1.8.0/configure0000755000573500001440000023646510565412371014270 0ustar darrenusers#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="filepp.in" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias VERSION moduledir PERL INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA rm echo diff module_subdirs LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=\$ac_optarg ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$0" || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-moduledir=DIR Filepp modules installed in directory DIR _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu VERSION="1.8.0" moduledir="$datadir/filepp/modules" # Check whether --with-moduledir was given. if test "${with_moduledir+set}" = set; then withval=$with_moduledir; moduledir="$withval" fi if test "$moduledir" = '${datarootdir}/filepp/modules'; then if test "$datarootdir" = 'NONE'; then moduledir=/usr/local/share/filepp/modules else moduledir=$datarootdir/filepp/modules fi fi if test "$moduledir" = '${prefix}/share/filepp/modules'; then if test "$prefix" = 'NONE'; then moduledir=/usr/local/share/filepp/modules else moduledir=$prefix/share/filepp/modules fi fi # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_PERL+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $PERL in [\\/]* | ?:[\\/]*) ac_cv_path_PERL="$PERL" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PERL=$ac_cv_path_PERL if test -n "$PERL"; then { echo "$as_me:$LINENO: result: $PERL" >&5 echo "${ECHO_T}$PERL" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. { echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done IFS=$as_save_IFS fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' rm="rm -fr" echo="echo" diff=diff module_subdirs="modules/bigdef modules/bigfunc modules/blc modules/case modules/cmacros modules/comment modules/cpp modules/defplus modules/for modules/foreach modules/format modules/function modules/grab modules/literal modules/maths modules/regexp" ac_config_files="$ac_config_files Makefile filepp tests/Makefile modules/bigdef/Makefile modules/bigfunc/Makefile modules/blc/Makefile modules/case/Makefile modules/cmacros/Makefile modules/comment/Makefile modules/cpp/Makefile modules/defplus/Makefile modules/for/Makefile modules/foreach/Makefile modules/format/Makefile modules/function/Makefile modules/grab/Makefile modules/literal/Makefile modules/maths/Makefile modules/regexp/Makefile" ac_config_commands="$ac_config_commands default" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "filepp") CONFIG_FILES="$CONFIG_FILES filepp" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; "modules/bigdef/Makefile") CONFIG_FILES="$CONFIG_FILES modules/bigdef/Makefile" ;; "modules/bigfunc/Makefile") CONFIG_FILES="$CONFIG_FILES modules/bigfunc/Makefile" ;; "modules/blc/Makefile") CONFIG_FILES="$CONFIG_FILES modules/blc/Makefile" ;; "modules/case/Makefile") CONFIG_FILES="$CONFIG_FILES modules/case/Makefile" ;; "modules/cmacros/Makefile") CONFIG_FILES="$CONFIG_FILES modules/cmacros/Makefile" ;; "modules/comment/Makefile") CONFIG_FILES="$CONFIG_FILES modules/comment/Makefile" ;; "modules/cpp/Makefile") CONFIG_FILES="$CONFIG_FILES modules/cpp/Makefile" ;; "modules/defplus/Makefile") CONFIG_FILES="$CONFIG_FILES modules/defplus/Makefile" ;; "modules/for/Makefile") CONFIG_FILES="$CONFIG_FILES modules/for/Makefile" ;; "modules/foreach/Makefile") CONFIG_FILES="$CONFIG_FILES modules/foreach/Makefile" ;; "modules/format/Makefile") CONFIG_FILES="$CONFIG_FILES modules/format/Makefile" ;; "modules/function/Makefile") CONFIG_FILES="$CONFIG_FILES modules/function/Makefile" ;; "modules/grab/Makefile") CONFIG_FILES="$CONFIG_FILES modules/grab/Makefile" ;; "modules/literal/Makefile") CONFIG_FILES="$CONFIG_FILES modules/literal/Makefile" ;; "modules/maths/Makefile") CONFIG_FILES="$CONFIG_FILES modules/maths/Makefile" ;; "modules/regexp/Makefile") CONFIG_FILES="$CONFIG_FILES modules/regexp/Makefile" ;; "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "$CONFIG_FILES"; then _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim VERSION!$VERSION$ac_delim moduledir!$moduledir$ac_delim PERL!$PERL$ac_delim INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim INSTALL_DATA!$INSTALL_DATA$ac_delim rm!$rm$ac_delim echo!$echo$ac_delim diff!$diff$ac_delim module_subdirs!$module_subdirs$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 49; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES :C $CONFIG_COMMANDS do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s&@configure_input@&$configure_input&;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5 echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "default":C) chmod 755 filepp ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi ./filepp-1.8.0/mkinstalldirs0000755000573500001440000000127607305025274015155 0ustar darrenusers#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Last modified: 1995-03-05 # Public domain errstatus=0 for file in ${1+"$@"} ; do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d in ${1+"$@"} ; do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" 1>&2 mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$? fi if test ! -d "$pathcomp"; then errstatus=$lasterr fi pathcomp="$pathcomp/" done done exit $errstatus ./filepp-1.8.0/filepp.in0000644000573500001440000025543510565647642014201 0ustar darrenusers#!@PERL@ -w ######################################################################## # # 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. # ######################################################################## # # Project : File Preprocessor # Filename : $RCSfile: filepp.in,v $ # Author : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.139 $ # Last changed : $Date: 2007/02/17 18:55:30 $ # Description : Main program # Licence : GNU copyleft # ######################################################################## package Filepp; use strict "vars"; use strict "subs"; # Used to all filepp to work with any char, not just ascii, # feel free to remove this if it causes you problems use bytes; # version number of program my $VERSION = '@VERSION@'; # list of paths to search for modules, normal Perl list + module dir push(@INC, "@moduledir@"); # index of keywords supported and functions to deal with them my %Keywords = ( 'comment' => \&Comment, 'define' => \&Define, 'elif' => \&Elif, 'else' => \&Else, 'endif' => \&Endif, 'error' => \&Error, 'if' => \&If, 'ifdef' => \&Ifdef, 'ifndef' => \&Ifndef, 'include' => \&Include, 'pragma' => \&Pragma, 'undef' => \&Undef, 'warning' => \&Warning ); # set of functions which process the file in the Parse routine. # Processors are functions which take in a line and return the processed line. # Note: this is done as a string rather than pointer to a function because # it makes list easier to modify/remove from/print. my @PIDs = ( 0 , 1 ); my $next_pid = 2; # unique processor id - first one allocated my %Processors = ( '0' => "Filepp::ParseKeywords", '1' => "Filepp::ReplaceDefines" ); # processor types say what the processor should be run on: choice is: # 0: Everything (default) # 1: Full lines only (lines originating from Parse function) # 2: Part lines only (lines originating from within keywords, eg: # #if "condition", "condition" is a part line) my %ProcessorTypes = ( '0' => 1, '1' => 0 ); # functions to run each time a new base input file is opened or closed my @OpenInputFuncs = (); my @CloseInputFuncs = (); # functions to run each time a new output file is opened or closed my @OpenOutputFuncs = (); my @CloseOutputFuncs = (); # safe mode is for the paranoid, when enabled turns off #pragma filepp, # enabled by default my $safe_mode = 0; # test for shebang mode, used for "filepp script", ie. executable file with # "#!/usr/bin/perl /usr/local/bin/filepp" at the top my $shebang = 1; # allow $keywordchar, $contchar, $optlineendchar and $macroprefix # to be perl regexps my $charperlre = 0; # character(s) which prefix environment variables - defaults to shell-style '$' my $envchar = "\$"; # boolean determining whether line continuation is implicit if there are more # open brackets than close brackets on a line # disabled by default my $parselineend = \&Filepp::ParseLineEnd; # character(s) which replace continuation char(s) - defaults to C-style nothing my $contrepchar = ""; # character(s) which prefix keywords - defaults to C-style '#' my $keywordchar; if($charperlre) { $keywordchar = "\#"; } else { $keywordchar = "\Q#\E"; } # character(s) which signifies continuation of a line - defaults to C-style '\' my $contchar; if($charperlre) { $contchar = "\\\\"; } else { $contchar = "\Q\\\E"; } # character(s) which optionally signifies the end of a line - # defaults to empty string '' my $optlineendchar = ""; # character(s) which prefix macros - defaults to nothing my $macroprefix = ""; # flag to use macro prefix in keywords (on by default) my $macroprefixinkeywords = 1; # check if macros must occur as words when replacing, set this to '\b' if # you prefer cpp style behaviour as default my $bound = ''; # number of line currently being parsed (int) my $line = 0; # file currently being parsed my $file = ""; # list of input files my @Inputfiles; # list of files to include macros from my @Imacrofiles; # flag to control when output is written my $output = 1; # name of outputfile - defaults to STDOUT my $outputfile = ""; # overwrite mode - automatically overwrites old file with new file my $overwrite = 0; # overwrite conversion mode - conversion from input filename to output filename my $overwriteconv = ""; # list of keywords which have "if" functionality my %Ifwords = ('if', '', 'ifdef', '', 'ifndef', ''); # list of keywords which have "else" functionality my %Elsewords = ('else', '', 'elif', ''); # list of keywords which have "endif" functionality my %Endifwords = ('endif', ''); # current level of include files my $include_level = -1; # current parse level my $parse_level = -1; # suppress blank lines in header files (indexed by include level) my $blanksuppopt = 0; my @blanksupp; # try to keep same number lines in output file as input file my $preserveblank = 0; # counter of recursion level for detecting recursive macros my $recurse_level = -1; # debugging info, 1=on, 0=off my $debug = 0; # send debugging info to stdout rather than stderr my $debugstdout = 0; # debug prefix character or string my $debugprefix = ""; # debug postfix character or string my $debugpostfix = "\n"; # hash of macros defined - standard ones already included my %Defines = ( '__BASE_FILE__' => "", '__DATE__' => "", '__FILEPP_INPUT__' => "Generated automatically from __BASE_FILE__ by filepp", '__FILE__' => $file, '__INCLUDE_LEVEL__' => $include_level, '__ISO_DATE__' => "", '__LINE__' => $line, '__NEWLINE__' => "\n", '__NULL__' => "", '__TAB__' => "\t", '__TIME__' => "", '__VERSION__' => $VERSION ); # hash of first chars in each macro my %DefineLookup; # length of longest and shortest define my ($defmax, $defmin); GenerateDefinesKeys(); # set default values for date and time { # conversions of month number into letters (0-11) my @MonthChars = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); #prepare standard defines my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isbst) = localtime(time()); $year += 1900; $sec = sprintf("%02d", $sec); $min = sprintf("%02d", $min); $hour = sprintf("%02d", $hour); $mday = sprintf("%02d", $mday); $mon = sprintf("%02d", $mon); Redefine("__TIME__", $hour.":".$min.":".$sec); Redefine("__DATE__", $MonthChars[$mon]." ".$mday." ".$year); $mon = sprintf("%02d", ++$mon); Redefine("__ISO_DATE__", $year."-".$mon."-".$mday); } # hash table for arguments to macros which need them my %DefinesArgs = (); # hash table for functions which macros should call (if any) my %DefinesFuncs = (); # eat-trailing-whitespace flag for each macro my %EatTrail = (); # list of include paths my @IncludePaths; # help string my $usage = "filepp: generic file preprocessor, version ".$VERSION." usage: filepp [options] inputfile(s) options: -b\t\tsuppress blank lines from include files -c\t\tread input from STDIN instead of file -Dmacro[=defn]\tdefine macros (same as #define) -d\t\tprint debugging information -dd\t\tprint verbose debugging information -dl\t\tprint some (light) debugging information -dpre char\tprefix all debugging information with char -dpost char\tpostfix all debugging information with char, defaults to newline -ds\t\tsend debugging info to stdout rather than stderr -e\t\tdefine all environment variables as macros -ec char\tset environment variable prefix char to \"char\" (default \$) -ecn\t\tset environment variable prefix char to nothing (default \$) -h\t\tprint this help message -Idir\t\tdirectory to search for include files -imacros file\tread in macros from file, but discard rest of file -k\t\tturn off parsing of all keywords, just macro expansion is done -kc char\tset keyword prefix char to \"char\" (defaults to #) -lc char\tset line continuation character to \"char\" (defaults to \\) -lec char\tset optional keyword line end char to \"char\" -lr char\tset line continuation replacement character to \"char\" -lrn\t\tset line continuation replacement character to newline -m module\tload module -mp char\tprefix all macros with \"char\" (defaults to no prefix) -mpnk\t\tdo not use macro prefix char in keywords -Mdir\t\tdirectory to search for filepp modules -o output\tname of output file (defaults to stdout) -ov\t\toverwrite mode - output file will overwrite input file -ovc IN=OUT\toutput file(s) will have be input file(s) with IN conveted to OUT -pb\t\tpreseve blank lines in output that would normally be removed -s\t\trun in safe mode (turns off pragma keyword) -re\t\ttreat keyword and macro prefixes and line cont chars as reg exps -Umacro\tundefine macro -u\t\tundefine all predefined macros -v\t\tprint version and exit -w\t\tturn on word boundaries when replacing macros all other arguments are assumed to be input files "; ############################################################################## # SetDebug - controls debugging level ############################################################################## sub SetDebug { $debug = shift; Debug("Debugging level set to $debug", 1); } ############################################################################## # Debugging info ############################################################################## sub Debug { # print nothing if not debugging if($debug == 0) { return; } my $msg = shift; my $level = 1; # check if level has been provided if($#_ > -1) { $level = shift; } if($level <= $debug) { # if currently parsing a file show filename and line number if($file ne "" && $line > 0) { $msg = $file.":".$line.": ".$msg; } # else show program name else { $msg = "filepp: ".$msg; } if($debugstdout) { print(STDOUT $debugprefix.$msg.$debugpostfix); } else { print(STDERR $debugprefix.$msg.$debugpostfix); } } } ############################################################################## # Standard error handler. # #error msg - print error message "msg" and exit ############################################################################## sub Error { my $msg = shift; # close and delete output file if created close(OUTPUT); if($outputfile ne "-") { # output is not stdout my $inputfile; my $found = 0; # do paranoid check to make sure we are not deleting an input file foreach $inputfile (@Inputfiles) { if($outputfile eq $inputfile) { $found = 1; last; } } # delete output file if($found == 0) { unlink($outputfile); } } # print error message $debug = 1; Debug($msg, 0); exit(1); } ############################################################################## # SafeMode - turns safe mode on ############################################################################## sub SafeMode { $safe_mode = 1; Debug("Filepp safe mode enabled", 2); } ############################################################################## # CleanStart($sline) - strip leading whitespace from start of $sline. ############################################################################## sub CleanStart { my $sline = shift; for($sline) { # '^' = start of line, '\s+' means all whitespace, replace with nothing s/^\s+//; } return $sline; } ############################################################################## # Strip($sline, $char, $level) - strip $char's from start and end of $sline # removes up to $level $char's from start and end of line, it is not an # error if $level chars do not exist at the start or end of line ############################################################################## sub Strip { my $sline = shift; my $char = shift; my $level = shift; # strip leading chars from line $sline =~ s/\A([$char]{0,$level})//g; # strip trailing chars from line $sline =~ s/([$char]{0,$level})\Z//g; return $sline; } ############################################################################## # SetMacroPrefix $string - prefixs all macros with $string ############################################################################## sub SetMacroPrefix { $macroprefix = shift; # make sure prefix will not be treated as a Perl regular expression if(!$charperlre) { $macroprefix = "\Q$macroprefix\E"; } Debug("Setting macro prefix to <".$macroprefix.">", 2); } ############################################################################## # SetKeywordchar $string - sets the first char(s) of each keyword to # something other than "#" ############################################################################## sub SetKeywordchar { $keywordchar = shift; # make sure char will not be treated as a Perl regular expression if(!$charperlre) { $keywordchar = "\Q$keywordchar\E"; } Debug("Setting keyword prefix character to <".$keywordchar.">", 2); } ############################################################################## # GetKeywordchar - returns the current keywordchar ############################################################################## sub GetKeywordchar { return $keywordchar; } ############################################################################## # SetContchar $string - sets the line continuation char to something other # than "\" ############################################################################## sub SetContchar { $contchar = shift; # make sure char will not be treated as a Perl regular expression if(!$charperlre) { $contchar = "\Q$contchar\E"; } Debug("Setting line continuation character to <".$contchar.">", 2); } ############################################################################## # SetContrepchar $string - sets the replace of the line continuation char to # something other than "" ############################################################################## sub SetContrepchar { $contrepchar = shift; Debug("Setting line continuation replacement character to <".$contrepchar.">", 2); } ############################################################################## # SetOptLineEndchar $string - sets the optional line end char to something # other than "" ############################################################################## sub SetOptLineEndchar { $optlineendchar = shift; # make sure char will not be treated as a Perl regular expression if(!$charperlre) { $optlineendchar = "\Q$optlineendchar\E"; } Debug("Setting optional line end character to <".$optlineendchar.">", 2); } ############################################################################## # SetEnvchar $string - sets the first char(s) of each defined environment # variable to $string - NOTE: change only takes effect when DefineEnv run ############################################################################## sub SetEnvchar { $envchar = shift; Debug("Setting environment variable prefix character to <".$envchar.">",2); } my $stack = -1; my @LineBuffer = (); ############################################################################## # Process a line and put output in buffer - buffer written in Parse ############################################################################## sub ProcessLine { my $line = shift; # unless blank lines are suppressed at this include level unless($blanksupp[$include_level] && /^\s*$/) { # run processing chain (defaults to ReplaceDefines) $LineBuffer[$stack] .= RunProcessors($line, 3); } } ############################################################################## # RunProcessors $string, $calledfrom # run the current processing chain on the string # $string is the string to be processed and should be returned by the processor # $calledfrom says where the processors are called from, the choice is: # # 0 or default: Part line (from within a keyword) - if called recursively # runs all processors AFTER current processor, then continues with processing. # This is used when a keyword wants to run all remaining processors on a line # before doing its keyword task. # # 1: Full line (from Parse function) - if called recursively runs all # processors BEFORE current processor, then continues with processing # # 2: Part line (from within a keyword) - if called recursively runs all # processors BEFORE current processor, then continues with processing. # This is used when keywords are using text taken from somewhere other than # the current line, this text needs to go through the same processors as # the current line has been through so it can "catch up" (eg: regexp.pm). # # 3: Full line - run all processors before and including this one # ############################################################################## my @Stack; # list of processors currently running at each level of stack my @PID; # id of processor running at this level of stack my @Level; # parse level for current stack sub RunProcessors { my $string = shift; my $calledfrom = 0; if($#_ > -1) { $calledfrom = shift; } my $i; # increment stack $stack++; $Level[$stack] = $parse_level; $LineBuffer[$stack] = ""; # turn off macoprefix if in a keyword my $tmpprefix = ""; if($calledfrom != 1 && $macroprefixinkeywords == 0) { $tmpprefix = $macroprefix; $macroprefix = ""; } # make local copy of processor list, this allows processors to # add/delete other processors without affecting current processing run my @myPIDs= @PIDs; $Stack[$stack] = \@myPIDs; # These tests are done to make RunProcessors recursion safe. # If RunProcessors is called from within a function that was itself called # by RunProcessors, then the second calling of RunProcessors will only # execute the processors before the currently running processor in the # chain my $recursing = 0; my $run_procs = "all"; if($stack > 0 && $Level[$stack] == $Level[$stack - 1]) { if($calledfrom == 0) { $run_procs = "after"; } else { $run_procs = "before"; } if($calledfrom == 3) { $run_procs = "all"; $calledfrom = 1; } } # initial state my $state = "before"; my $pid; foreach $pid (@{$Stack[$stack]}) { $PID[$stack] = $pid; # flag to say if before or after processor called from if($stack > 0 && $Level[$stack] == $Level[$stack - 1]) { if($pid == $PID[$stack - 1]) { $state = "this"; } elsif($state eq "this") { $state = "after"; } } # run if running all or before/after current processor in prev chain if($run_procs eq "all" || $run_procs eq $state) { # called from anywhere (default) if($ProcessorTypes{$pid} == 0 || # called from keyword (part lines only - within keywords) (($calledfrom == 0 || $calledfrom == 2) && $ProcessorTypes{$pid} == 2) || # called from Parse function (whole lines only) ($calledfrom == 1 && $ProcessorTypes{$pid} == 1)) { # run processor Debug("Running processor ".$Processors{$pid}."[".$parse_level. "][".$stack."][".$pid."] on \"".$string."\"", 3); $string = $Processors{$pid}->($string); } } } # return macro prefix to its former glory if($calledfrom != 1 && $macroprefixinkeywords == 0) { $macroprefix = $tmpprefix; } # check for anything in $line_buffer if($LineBuffer[$stack] ne "") { $string .= $LineBuffer[$stack]; $LineBuffer[$stack] = ""; } # decrease place on stack $stack--; return $string; } ############################################################################## # PrintProcessors # print the current processing chain ############################################################################## sub PrintProcessors { my @PrintPIDs = @PIDs; if($#_ > -1) { @PrintPIDs = @_; } my $pid; Debug("Current processing chain:", 3); my $i = 0; foreach $pid (@PrintPIDs) { Debug($Processors{$pid}."[".$pid."] type ".$ProcessorTypes{$pid}, 3); $i++; } } ############################################################################## # AddProcessor(function[, first[, type]]) # add a line processor to processing chain, defaults to end of chain # if "first" is set to one adds processor to start of chain ############################################################################## sub AddProcessor { my $function = shift; my $first = 0; my $type = 0; my $my_pid = $next_pid++; # check if flag to add processor to start of chain is set if($#_ > -1) { $first = shift; } # check if processor has a type if($#_ > -1) { $type = shift; } # adding processor to start of chasin if($first) { @PIDs = reverse(@PIDs); } push(@PIDs, $my_pid); $Processors{$my_pid} = $function; if($first) { @PIDs = reverse(@PIDs); } $ProcessorTypes{$my_pid} = $type; Debug("Added processor ".$function." of type ".$type, 2); if($debug > 1) { PrintProcessors(); } } ############################################################################## # AddProcessorAfter(function, processor[, type]) # add a line processor to processing chain immediately after an existing # processor, if existing processor not found, new processor is added to # end of chain ############################################################################## sub AddProcessorAfter { my $function = shift; my $existing = shift; my $type = 0; # check if processor has a type if($#_ > -1) { $type = shift; } my $i = 0; my $found = 0; my @CurrentPIDs = @PIDs; my $pid; my $my_pid = $next_pid++; # reset processing chain @PIDs = (); foreach $pid (@CurrentPIDs) { push(@PIDs, $pid); if(!$found) { # check done as regular expression for greater flexibility if($Processors{$pid} =~ /$existing/) { push(@PIDs, $my_pid); $Processors{$my_pid} = $function; $found = 1; } } } if(!$found) { Warning("Did not find processor $existing in chain, processor $function added to end of list"); AddProcessor($function, 0, $type); return; } $ProcessorTypes{$my_pid} = $type; Debug("Added processor ".$function." of type ".$type, 2); if($debug > 1) { PrintProcessors(); } } ############################################################################## # AddProcessorBefore(function, processor[, type]) # add a line processor to processing chain immediately after an existing # processor, if existing processor not found, new processor is added to # end of chain ############################################################################## sub AddProcessorBefore { my $function = shift; my $existing = shift; my $type = 0; # check if processor has a type if($#_ > -1) { $type = shift; } my $i = 0; my $found = 0; my @CurrentPIDs = @PIDs; my $pid; my $my_pid = $next_pid++; # reset processing chain @PIDs = (); foreach $pid (@CurrentPIDs) { if(!$found) { # check done as regular expression for greater flexibility if($Processors{$pid} =~ /$existing/) { push(@PIDs, $my_pid); $Processors{$my_pid} = $function; $found = 1; } } push(@PIDs, $pid); } if(!$found) { Warning("Did not find processor $existing in chain, processor $function added to start of list"); AddProcessor($function, 1, $type); return; } $ProcessorTypes{$my_pid} = $type; Debug("Added processor ".$function." of type ".$type, 2); if($debug > 1) { PrintProcessors(); } } ############################################################################## # RemoveProcessor(function) # remove a processor name "function" from list ############################################################################## sub RemoveProcessor { my $function = shift; my $i = 0; # find function while($i <= $#PIDs && $Processors{$PIDs[$i]} ne $function) { $i++; } # check function found if($i > $#PIDs) { Warning("Attempt to remove function ".$function. " which does not exist"); return; } # remove function my $pid = $PIDs[$i]; # cannot delete functions yet, as we may still be in a processing # chain that uses them later # delete($Processors{$pid}); # delete($ProcessorTypes{$pid}); for(; $i<$#PIDs; $i++) { $PIDs[$i] = $PIDs[$i+1]; } pop(@PIDs); Debug("Removed processor ".$function."[".$pid."]", 2); PrintProcessors(); } ############################################################################## # Add a function to run each time a base file is opened ############################################################################## sub AddOpenInputFunc { my $func = shift; push(@OpenInputFuncs, $func); } ############################################################################## # Add a function to run each time a base file is closed ############################################################################## sub AddCloseInputFunc { my $func = shift; push(@CloseInputFuncs, $func); } ############################################################################## # Add a function to run each time a base file is opened ############################################################################## sub AddOpenOutputFunc { my $func = shift; push(@OpenOutputFuncs, $func); } ############################################################################## # Add a function to run each time a base file is closed ############################################################################## sub AddCloseOutputFunc { my $func = shift; push(@CloseOutputFuncs, $func); } ############################################################################## # AddKeyword(keyword, function) # Define a new keyword, when keyword (preceded by keyword char) is found, # function is run on the remainder of the line. ############################################################################## sub AddKeyword { my $keyword = shift; my $function = shift; $Keywords{$keyword} = $function; Debug("Added keyword ".$keyword." which runs ".$function, 2); } ############################################################################## # RemoveKeyword(keyword) # Keyword is deleted from list, all occurrences of keyword found in # document are ignored. ############################################################################## sub RemoveKeyword { my $keyword = shift; delete $Keywords{$keyword}; # sort keywords index into reverse order, this ensures #if[n]def comes # before #if when comparing input with keywords Debug("Removed keyword ".$keyword, 2); } ############################################################################## # RemoveAllKeywords - removes all current keywords. ############################################################################## sub RemoveAllKeywords { %Keywords = (); Debug("Removed all current keywords", 2); } ############################################################################## # AddIfword - adds a keyword to ifword hash ############################################################################## sub AddIfword { my $ifword = shift; $Ifwords{$ifword} = ''; Debug("Added Ifword: ".$ifword, 2); } ############################################################################## # RemoveIfword - removes a keyword from ifword hash ############################################################################## sub RemoveIfword { my $ifword = shift; delete $Ifwords{$ifword}; Debug("Removed Ifword: ".$ifword, 2); } ############################################################################## # AddElseword - adds a keyword to elseword hash ############################################################################## sub AddElseword { my $elseword = shift; $Elsewords{$elseword} = ''; Debug("Added Elseword: ".$elseword, 2); } ############################################################################## # RemoveElseword - removes a keyword from elseword hash ############################################################################## sub RemoveElseword { my $elseword = shift; delete $Elsewords{$elseword}; Debug("Removed Elseword: ".$elseword, 2); } ############################################################################## # AddEndifword - adds a keyword to endifword hash ############################################################################## sub AddEndifword { my $endifword = shift; $Endifwords{$endifword} = ''; Debug("Added Endifword: ".$endifword, 2); } ############################################################################## # RemoveEndifword - removes a keyword from endifword hash ############################################################################## sub RemoveEndifword { my $endifword = shift; delete $Endifwords{$endifword}; Debug("Removed Endifword: ".$endifword, 2); } ############################################################################## # AddIncludePath - adds another include path to the list ############################################################################## sub AddIncludePath { my $path = shift; push(@IncludePaths, $path); Debug("Added include path: \"".$path."\"", 2); } ############################################################################## # AddModulePath - adds another module search path to the list ############################################################################## sub AddModulePath { my $path = shift; # add new path to start of list @INC = reverse(@INC); push(@INC, $path); @INC = reverse(@INC); Debug("Added module path: \"".$path."\"", 2); } # set if file being written to has same name as input file my $same_file = ""; ############################################################################## # OpenOutputFile - opens the output file ############################################################################## sub OpenOutputFile { $outputfile = shift; Debug("Output file: ".$outputfile, 1); # check for outputfile name, if not specified use STDOUT if($outputfile eq "") { $outputfile = "-"; } # output is not stdout and file with that name already exists if($outputfile ne "-" && FileExists($outputfile) ) { $same_file = $outputfile; # paranoid: check file is writable and normal file if(-w $outputfile && -f $outputfile) { $outputfile = $outputfile.".fpp".$$; my $i=0; # paranoid: check temp file does not exist while(FileExists($outputfile)) { $outputfile = $outputfile.$i; $i++; if($i >= 10) { Error("Cound not get temp filename"); } } } else { Error("Cannot read or write to ".$outputfile); } } if(!open(OUTPUT, ">".$outputfile)) { Error("Cannot open output file: ".$outputfile); } # run any open functions my $func; foreach $func (@OpenOutputFuncs) { $func->(); } } ############################################################################## # CloseOutputFile - close the output file ############################################################################## sub CloseOutputFile { # run any close functions my $func; foreach $func (@CloseOutputFuncs) { $func->(); } close(OUTPUT); # if input and output have same name, rename output to input now if($same_file ne "") { if(rename($same_file, $same_file."~") == -1) { Error("Could not rename ".$same_file." ".$same_file."~"); } if(rename($outputfile, $same_file) == -1) { Error("Could not rename ".$outputfile." ".$same_file); } } # reset same_file $same_file = ""; } ############################################################################## # ChangeOutputFile - change the output file ############################################################################## sub ChangeOutputFile { CloseOutputFile(); $outputfile = shift; OpenOutputFile($outputfile); } ############################################################################## # AddInputFile - adds another input file to the list ############################################################################## sub AddInputFile { my $file = shift; push(@Inputfiles, $file); Debug("Added input file: \"".$file."\"", 2); } ############################################################################## # UseModule(module) # Module "module.pm" is used, "module.pm" can be any perl module and can use # or replace any of the functions in this package ############################################################################## sub UseModule { my $module = shift; Debug("Loading module ".$module, 1); require $module; if($@) { Error($@); } } ############################################################################## # find end of next word in $sline, assumes leading whitespace removed ############################################################################## sub GetNextWordEnd { my $sline = shift; # check for whitespace in this string if($sline =~ /\s/) { # return length of everything up to first whitespace return length($`); } # whitespace not found, return length of the whole string return length($sline); } ############################################################################## # Print current table of defines - used for debugging ############################################################################## sub PrintDefines { my $define; Debug("Current ".$keywordchar."define's:", 3); foreach $define (keys(%Defines)) { Debug(" macro:\"".$define."\", definition:\"".$Defines{$define}."\"",3); } } ############################################################################## # DefineEnv - define's all environment variables to macros, each prefixed # by $envchar ############################################################################## sub DefineEnv { my $macro; Debug("Defining environment variables as macros", 2); foreach $macro (keys(%ENV)) { Define($envchar.$macro." ".$ENV{$macro}); } } ############################################################################## # Find out if arguments have been used with macro ############################################################################## sub DefineArgsUsed { my $string = shift; # check '(' is first non-whitespace char after macro if($string =~ /^\s*\(/) { return 1; } return 0; } ############################################################################## # ParseArgs($string) - find the arguments in a string of form # (arg1, arg2, arg3...) trailing chars # or # arg1, arg2, arg3... ############################################################################## sub ParseArgs { my $string = shift; $string = CleanStart($string); my @Chars; my $char; # split string into chars (can't use split coz it deletes \n at end) for($char=0; $char ')', '"' => '"', '\'' => '\''); my $s = -1; # start of chars my $backslash = 0; # number of special char pairs to allow my $pairs = 1; # deal with first '(' if there (ie func(args) rather than func args) if($#Chars >= 0 && $Chars[0] eq '(') { push(@Endchar, ')'); $Chars[0] = ''; $s++; $pairs++; # ignore this pair of special char pairs } # replace args with their values foreach $char (@Chars) { # deal with end of special chars, ),",' etc. if($#Endchar > -1 && $char eq $Endchar[$#Endchar]) { # if char before this was a backslash, ignore this char if($backslash) { chop($arg); # delete backslash from string } else { # pop end char of list and reduce pairs if its a bracket if(pop(@Endchar) eq ')') { $pairs--; } } } # deal with start of special chars elsif(exists($SpecialChars{$char})) { # if char before this was a backslash, ignore this char if($backslash) { chop($arg); # delete backslash from string } # only start new pair if not already in special char pair # (not including main args brackets of course) elsif($#Endchar < $pairs-1) { push(@Endchar, $SpecialChars{$char}); # need to treat brackets differently for macros within # macros "this(that(tother)))", otherwise lose track of ()'s if($char eq '(') { $pairs++; } } } # deal with ',', add arg to list and start search for next one elsif($#Endchar == $s && $char eq ',') { # if char before this was a backslash, ignore this char if($backslash) { chop($arg); # delete backslash from string } else { push(@Args, CleanStart($arg)); $char = ''; $arg = ""; next; } } # deal \\ with an escaping \ ie. \" or \, or \\ if($char eq '\\') { if($backslash) { # found \\ $backslash = 0; # second backslash ignored chop($arg); # delete backslash from string } else{$backslash = 1;} } elsif($backslash) { $backslash = 0; } # check for end of args string if($#Endchar < $s) { push(@Args, CleanStart($arg)); $char = ''; # put remainder of string back together $arg = join('', @Chars); last; } $arg = $arg.$char; # add char to current arg $char = ''; # set char to null } # deal with last arg or string following args if it exists push(@Args, $arg); return @Args; } ############################################################################## # Find the arguments in a macro and replace them ############################################################################## sub FindDefineArgs { my $substring = shift; my $macro = shift; # get definition list for this macro my @Argnames = split(/\,/, $DefinesArgs{$macro}); # check to see if macro can have any number of arguments (last arg ...) my $anyargs = ($#Argnames >= 0 && $Argnames[$#Argnames] =~ /\.\.\.\Z/o); # get arguments passed to this macro my @Argvals = ParseArgs($substring); # everything following macro args should be returned as tail my $tail = pop(@Argvals); # check the right number of args have been passed, should be all args # present plus string at end of args (assuming macro cannot have any number # of arguments) if(!$anyargs && $#Argvals != $#Argnames) { # show warning if wrong args (unless macro should have zero args and # 1 arg provided which is blank space if(!($#Argnames == -1 && $#Argvals == 0 && $Argvals[0] =~ /\A\s*\Z/)) { Warning("Macro \'".$macro."\' used with ".($#Argvals+1). " args, expected ".($#Argnames+1)); } # delete all excess args while($#Argvals > $#Argnames) { pop(@Argvals); } } # make all missing args blanks while($#Argvals < $#Argnames) { push(@Argvals, ""); } return (@Argvals, $tail); } ############################################################################## # FunctionMacro: used with functions to inform a module which macro # was being replaced when the function was called - used in bigfunc.pm ############################################################################## my $functionmacro = ""; sub FunctionMacro { return $functionmacro; } ############################################################################## # Replace all defined macro's arguments with their values # Inputs: # $macro = the macro to be replaces # $string = the string following the occurrence of macro ############################################################################## sub ReplaceDefineArgs { my ($string, $tail, %Used) = @_; # check if args used, if not do nothing if(DefineArgsUsed($tail)) { my $macro = $string; # get arguments following macro my @Argvals = FindDefineArgs($tail, $macro); $tail = pop(@Argvals); # tail returned as last element my @Argnames = split(/\,/, $DefinesArgs{$macro}); my $i; # replace previous macro with defn + args $string = $Defines{$macro}; # check if macro should call a function if(exists($DefinesFuncs{$macro})) { # replace all macros in argument list for($i=0; $i<=$#Argvals; $i++) { $Argvals[$i] = ReplaceDefines($Argvals[$i]); } if($debug > 1) { my $argstring = ""; if($#Argvals >= 0) { $argstring = join(", ", @Argvals); } Debug("Running function $DefinesFuncs{$macro} with args (". $argstring.")", 2); } # set name of macro which is being parse (needed in bigfunc.pm) $functionmacro = $macro; $string = $DefinesFuncs{$macro}->(@Argvals); # don't need do anything else, return now return $string, $tail; } # call function that does the real work ($string, $tail) = ArgReplacer(\@Argvals, \@Argnames, $macro, $string, $tail, %Used); } else { Debug("Macro \"".$string."\" found without args, ignored", 2); } return ($string, $tail); } ############################################################################## # ############################################################################## sub ArgReplacer { my ($argvals, $argnames, $macro, $string, $tail, %Used) = @_; my @Argvals = @{$argvals}; my @Argnames = @{$argnames}; my ($i, $j); # check if last arg ends in ... (allows any number of args in macro) if($#Argnames >= 0 && $Argnames[$#Argnames] =~ s/\.\.\.\Z//o) { # concatanate all extra args into final arg while($#Argvals > $#Argnames) { my $arg1 = pop(@Argvals); my $arg2 = pop(@Argvals); push(@Argvals, $arg2.", ".$arg1); } # check for ## at start of macro name in args list if($string =~ /\#\#$Argnames[$#Argnames]/) { # if last argument is empty remove preciding "," if($#Argvals == $#Argnames && $Argvals[$#Argnames] eq "") { $string =~ s/\,\s*\#\#$Argnames[$#Argnames]//g; } else { $string =~ s/\#\#$Argnames[$#Argnames]/$Argnames[$#Argnames]/g; } } } # if %Used is empty, then assume all macros have been replaced already, # nasty hack for when called from bigfunc if(keys(%Used) == 0) { %Used = %Defines; } # to get args passed to macro to same processed level as rest of # macro, they need to be checked for occurrences of all used macros, # this is a nasty hack to temporarily change defines list to %Used { my %RealDefines = %Defines; my $realdefmin = $defmin; my $realdefmax = $defmax; my %RealDefineLookup = %DefineLookup; %Defines = %Used; GenerateDefinesKeys(); for($i=0; $i<=$#Argvals; $i++) { $Argvals[$i] = ReplaceDefines($Argvals[$i]); } # return defines to normal %Defines = %RealDefines; $defmin = $realdefmin; $defmax = $realdefmax; %DefineLookup = %RealDefineLookup; } # The next step replaces argnames with argvals. Once a bit of string # has been replaced it is removed from further processing to avoid # unwanted recursive macro replacement. my @InString = ( $string ); # string to be replaced my @InDone = ( 0 ); # flag to say if string section replaced my @OutString; # output of string sections after each # macro has been replaced my @OutDone; # output flags my $k = 0; for($i=0; $i<=$#Argnames; $i++) { for($j=0; $j<=$#InString; $j++) { if($InDone[$j] == 0) { # replace macros and split up string so replaced part # is flagged as done and rest is left for further # processing while($InString[$j] =~ /$bound$Argnames[$i]$bound/) { $OutString[$k] = $`; $OutDone[$k] = 0; $k++; $OutString[$k] = $Argvals[$i]; $OutDone[$k] = 1; $k++; $InString[$j] = $'; # one more quote for emacs ' } } $OutString[$k] = $InString[$j]; $OutDone[$k] = $InDone[$j]; $k++; } @InString = @OutString; @InDone = @OutDone; $k = 0; } # rebuild string $string = join('', @InString); Debug("Replaced \"".$macro."\" for \"".$string."\" [".$recurse_level."]", 2); return ($string, $tail); } ############################################################################## # When replacing macros with args, the macro and everything following the # macro (the tail) are passed to ReplaceDefineArgs. The function extracts # the args from the tail and then returns the replaced macro and the new # tail. This function extracts the remaining part of the real tail from # the current input string. ############################################################################## sub ReclaimTail { my ($input, $tail) = @_; # split strings into chars and compare each one until difference found my @Input = split(//, $input); my @Tail = split(//, $tail); $tail = $input = ""; while($#Input >= 0 && $#Tail >= 0 && $Input[$#Input] eq $Tail[$#Tail]) { $tail = pop(@Tail).$tail; pop(@Input); } while($#Input >=0) { $input = pop(@Input).$input; } return ($input, $tail); } ############################################################################## # Replace all defined macro's in a line with their value. Recursively run # through macros as many times as needed (to find macros within macros). # Inputs: # $input = string to process # $tail = rest of line following $string (if any), this will only be used # if string contains a macro with args, the args will probably be # at the start of the tail # %Used = all macros found in $string so far, these will not be checked # again to avoid possible recursion # Initially just $input is passed in, other args are added for recursive calls ############################################################################## sub ReplaceDefines { my ($input, $tail, %Used) = @_; # check for recursive macro madness (set to same level as Perl warning) if(++$recurse_level > 97) { $recurse_level--; Warning("Recursive macro detected in \"".$input."\""); if($tail) { return ($input, $tail); } return $input; } my $out = ""; # initialise output to empty string OUTER : while($input =~ /\S/o) { my ($macro, $string); my @Words; ###################################################################### # if macros start with prefix, skip to next prefix ###################################################################### if($macroprefix ne "") { my $found = 0; # find next potential macro in line if any while(!$found && $input =~ /$macroprefix\S/) { # everything before prefix $out = $out.$`; # reclaim first char in macro my $match = $&; # everything after prefix $input = chop($match).$'; # one more quote for emacs ' # check if first chars are in macro if(exists($DefineLookup{substr($input, 0, $defmin)})) { $found = 1; } # put prefix back onto output and carry on searching else { $out = $out.$match; } } # no more macros if(!$found) { $out = $out.$input; $input = ""; last OUTER; } } ###################################################################### # replacing macros which are "words" only - quick and easy ###################################################################### if($bound eq '\b') { @Words = split(/(\w+)/, $input, 2); $out = $out.$Words[0]; if($#Words == 2) { $macro = $Words[1]; $input = $Words[2]; } else { $input = ""; last OUTER; } } ###################################################################### # replacing all types of macro - slow and horrid ###################################################################### else { # forward string to next non-whitespace char that starts a macro while(!exists($DefineLookup{substr($input, 0, $defmin)})) { if($input =~ /^\s/ ) { # remove preceding whitespace @Words = split(/^(\s+)/, $input, 2); $out = $out.$Words[1]; $input = $Words[2]; } else { # skip to next char $out = $out.substr($input, 0, 1); $input = substr($input, 1); } if($input eq "") { last OUTER; } } # remove the longest possible potential macro (containing no # whitespace) from the start of input @Words = split(/(\s+)/, $input, 2); $macro = $Words[0]; if($#Words == 2) {$input = $Words[1].$Words[2]; } else {$input = ""; } # shorten macro if too long if(length($macro) > $defmax) { $input = substr($macro, $defmax).$input; $macro = substr($macro, 0, $defmax); } # see if a macro exists in "macro" while(length($macro) > $defmin && !(exists($Defines{$macro}) && !exists($Used{$macro}))) { # chop a char off macro and try again $input = chop($macro).$input; } } # check if macro is at start of string and has not been used yet if(exists($Defines{$macro}) && !exists($Used{$macro})) { # set macro as used $Used{$macro} = $Defines{$macro}; # temporarily add tail to input if($tail) { $input = $input.$tail; } # replace macro with defn if(CheckDefineArgs($macro)) { ($string, $input) = ReplaceDefineArgs($macro, $input, %Used); } else { $string = $Defines{$macro}; Debug("Replaced \"".$macro."\" for \"".$string."\" [".$recurse_level."]", 2); } # FIXME - what is this line for??????? ($string=~ m/\#\#/) and ($string=~ s/\s*\#\#\s*//gm); @Words = ReplaceDefines($string, $input, %Used); $out = $out.$Words[0]; if($#Words == 0) { $input = ""; } else { # remove space up to start of next char if(CheckEatTrail($macro)) { $Words[1] =~ s/^[ \t]*//o; } $input = $Words[1]; } delete($Used{$macro}); # reclaim all unparsed tail if($tail && $tail ne "") { ($input, $tail) = ReclaimTail($input, $tail); } } # macro not matched, add to output and move swiftly on else { if($bound eq '\b') { $out = $out.$macro; } else { $out = $out.substr($macro, 0, 1); $input = substr($macro, 1).$input; } } } $recurse_level--; # append any whitespace left in string and return it if($tail) { return ($out.$input, $tail); } return $out.$input; } ############################################################################## # GenerateDefinesKey creates all keys and indices needed for %Defines ############################################################################## sub GenerateDefinesKeys { # find longest and shortest macro my ($define, $length) = each %Defines; $defmin = $defmax = length($define); %DefineLookup = (); foreach $define (keys(%Defines)) { $length = length($define); if($length > $defmax) { $defmax = $length; } if($length < $defmin) { $defmin = $length; } } # regenerate lookup table of first letters foreach $define (keys(%Defines)) { $DefineLookup{substr($define, 0, $defmin)} = 1; } } ############################################################################## # Set a define ############################################################################## sub SetDefine { my ($macro, $value) = @_; # add macro and value to hash table $Defines{$macro} = $value; # add define to keys my $length = length($macro); if($length < $defmin || $defmin == 0) { GenerateDefinesKeys(); } else { if($length > $defmax) { $defmax = $length; } $length = substr($macro, 0, $defmin); $DefineLookup{$length} = 1; } } ############################################################################## # Get a define without doing any macro replacement # also returns list of args to macro if it has any ############################################################################## sub GetDefine { my $macro = shift; if(exists($DefinesArgs{$macro})) { return ($Defines{$macro}, $DefinesArgs{$macro}); } return $Defines{$macro}; } ############################################################################## # Replace a define, checks if macro defined and only redefine's if it is ############################################################################## sub Redefine { my $macro = shift; my $value = shift; # check if defined if(CheckDefine($macro)) { SetDefine($macro, $value); } } ############################################################################## # Set a define argument list ############################################################################## sub SetDefineArgs { my $macro = shift; my $args = shift; # add macro args to hash table $DefinesArgs{$macro} = $args; } ############################################################################## # Set a function which should be called when a macro is found ############################################################################## sub SetDefineFuncs { my $macro = shift; my $func = shift; # add macro function to hash table $DefinesFuncs{$macro} = $func; } ############################################################################## # Check if a macro is defined ############################################################################## sub CheckDefine { my $macro = shift; return exists($Defines{$macro}); } ############################################################################## # Check if a macro is defined and has arguments ############################################################################## sub CheckDefineArgs { my $macro = shift; return exists($DefinesArgs{$macro}); } ############################################################################## # Check if a macro is defined and calls a function ############################################################################## sub CheckDefineFuncs { my $macro = shift; return exists($DefinesFuncs{$macro}); } ############################################################################## # Check if a macro is defined and eats trailing whitespace ############################################################################## sub CheckEatTrail { my $macro = shift; return exists($EatTrail{$macro}); } ############################################################################## # Set eat-trailing-whitespace for a macro ############################################################################## sub SetEatTrail { my $macro = shift; $EatTrail{$macro} = 1; } ############################################################################## # Test if a file exists and is readable ############################################################################## sub FileExists { my $filename = shift; # test if file is readable and not a directory if( !(-r $filename) || -d $filename ) { Debug("Checking for file: ".$filename."...not found!", 2); return 0; } Debug("Checking for file: ".$filename."...found!", 2); return 1; } ############################################################################## # #comment - rest of line ignored as a comment ############################################################################## sub Comment { # nothing to be done here Debug("Commented line", 2); } ############################################################################## # Define a variable, accepted inputs: # $macrodefn = $macro $defn - $macro associated with $defn # ie: #define TEST test string # $macro = TEST, $defn = "test string" # Note: $defn = rest of line after $macro # $macrodefn = $macro - $macro defined without a defn, rest of line ignored # ie: #define TEST_DEFINE # $macro = TEST_DEFINE, $defn = "1" ############################################################################## sub Define { my $macrodefn = shift; my $macro; my $defn; my $i; # check there is an argument if($macrodefn !~ /\S/o) { Filepp::Error("define keyword used without arguments"); } # find end of macroword - assume separated by space or tab $i = GetNextWordEnd($macrodefn); # separate macro and defn (can't use split, doesn't work with '0') $macro = substr($macrodefn, 0, $i); $defn = substr($macrodefn, $i); # strip leading whitespace from $defn if($defn) { $defn =~ s/^[ \t]*//; } else { $defn = ""; } # check if macro has arguments (will be a '(' in macro) if($macro =~ /\(/) { # split up macro, args and defn - delimiters = space, (, ), ',' my @arglist = split(/([\s,\(,\),\,])/, $macro." ".$defn); my $macroargs = ""; my $arg; # macro is first element in list, remove it from list $macro = $arglist[0]; $arglist[0] = ""; # loop through list until ')' and find all args foreach $arg (@arglist) { # end of arg list, leave loop if($arg eq ")") { $arg = ""; last; } # ignore space, ',' and '(' elsif($arg =~ /[\s,\,,\(]/) { $arg = ""; } # argument found, add to ',' separated list elsif($arg ne "") { $macroargs = $macroargs.",".$arg; $arg = ""; } } $macroargs = Strip($macroargs, ",", 1); # store args SetDefineArgs($macro, $macroargs); Debug("Define: macro ".$macro." has args (".$macroargs.")", 2); # put rest of defn back together $defn = join('',@arglist); $defn = CleanStart($defn); } # make sure macro is not being redefined and used to have args else { delete($DefinesArgs{$macro}); delete($DefinesFuncs{$macro}); } # define the macro defn pair SetDefine($macro, $defn); Debug("Defined \"".$macro."\" to be \"".$defn."\"", 2); if($debug > 2) { PrintDefines(); } } ############################################################################## # Else, standard if[n][def]-else-endif # usage: #else somewhere between #if[n][def] key and #endif ############################################################################## sub Else { # else always true - only ran when all preceding 'if's have failed return 1; } ############################################################################## # Endif, standard ifdef-[else]-endif # usage: #endif somewhere after #ifdef key and optionally #else ############################################################################## sub Endif { # this always terminates an if block return 1; } ############################################################################## # If conditionally includes or ignores parts of a file based on expr # usage: #if expr # expr is evaluated to true(1) or false(0) and include usual ==, !=, > etc. # style comparisons. The "defined" keyword can also be used, ie: # #if defined MACRO || !defined(MACRO) ############################################################################## sub If { my $expr = shift; Debug("If: parsing: \"".$expr."\"", 2); # check for any "defined MACRO" tests and evaluate them if($expr =~ /defined/) { my $indefined = 0; # split expr up into its component parts, the split is done on the # following list of chars and strings: '!','(',')','&&','||', space my @Exprs = split(/([\s,\!,\(,\)]|\&\&|\|\|)/, $expr); # search through parts for "defined" keyword and check if macros # are defined foreach $expr (@Exprs) { if($indefined == 1) { # previously found a defined keyword, check if next word # could be the macro to test for (not any of the listed chars) if($expr && $expr !~ /([\s,\!,\(,\)]|\&\&|\|\|)/) { # replace macro with 0 or 1 depending if it is defined Debug("If: testing if \"".$expr."\" defined...", 2); if(CheckDefine($expr)) { $expr = 1; Debug("If: defined", 2); } else { $expr = 0; Debug("If: NOT defined", 2); } $indefined = 0; } } elsif($expr eq "defined") { # get rid of defined keyword $expr = ""; # search for next macro following "defined" $indefined = 1; } } # put full expr string back together my $newexpr = join('',@Exprs); $expr = $newexpr; } # pass parsed line though processors $expr = RunProcessors($expr); # evaluate line and return result (1 = true) Debug("If: evaluating \"".$expr."\"", 2); my $result = eval($expr); # check if statement is valid if(!defined($result)) { # try to get rid of any remaining text - convert it to 0 if($expr =~ /[a-z]|[A-Z]/) { $expr =~ s/[a-z]|[A-Z]/0/g; # tidy up 0's $expr =~ s/0+/0/g; Debug("If: WARNING - revaluated as \"".$expr."\"", 2); $result = eval($expr); if(!defined($result)) { Warning("\"".$@."\""); if($@ eq "") { $result = 1; } else { $result = 0; } } } } if($result) { Debug("If: \"".$expr."\" true", 1); return 1; } Debug("If: \"".$expr."\" false", 1); return 0; } ############################################################################## # Elif equivalent to "else if". Placed between #if[n][def] and #endif, # equivalent to nesting #if's ############################################################################## sub Elif { my $input = shift; return If($input); } ############################################################################## # Ifdef conditionally includes or ignores parts of a file based on macro, # usage: #ifdef MACRO # if macro has been previously #define'd everything following the # #ifdef will be included, else it will be ignored until #else or #endif ############################################################################## sub Ifdef { my $macro = shift; # separate macro from any trailing garbage $macro = substr($macro, 0, GetNextWordEnd($macro)); # check if macro defined - if not set to be #ifdef'ed out if(CheckDefine($macro)) { Debug("Ifdef: ".$macro." defined", 1); return 1; } Debug("Ifdef: ".$macro." not defined", 1); return 0; } ############################################################################## # Ifndef conditionally includes or ignores parts of a file based on macro, # usage: #ifndef MACRO # if macro has been previously #define'd everything following the # #ifndef will be ignored, else it will be included until #else or #endif ############################################################################## sub Ifndef { my $macro = shift; # separate macro from any trailing garbage $macro = substr($macro, 0, GetNextWordEnd($macro)); # check if macro defined - if not set to be #ifdef'ed out if(CheckDefine($macro)) { Debug("Ifndef: ".$macro." defined", 1); return 0; } Debug("Ifndef: ".$macro." not defined", 1); return 1; } ############################################################################## # Parses all macros from file, but discards all other output ############################################################################## sub IncludeMacros { my $file = shift; my $currentoutput = $output; SetOutput(0); Parse($file); SetOutput($currentoutput); } ############################################################################## # Include $filename in output file, format: # #include "filename" - local include file, ie. in same directory, try -Ipath # also if not not found in current directory # #include - system include file, use -Ipath ############################################################################## sub Include { my $input = shift; my $filename = $input; my $fullname; my $sysinclude = 0; my $found = 0; my $i; # check for recursive includes (level set to same as Perl recurse warn) if($include_level >= 98) { Warning("Include recursion too deep - skipping \"".$filename."\"\n"); return; } # replace any defined values in the include line $filename = RunProcessors($filename); # check if it is a system include file (#include ) or a local # include file (#include "filename") if(substr($filename, 0, 1) eq "<") { $sysinclude = 1; # remove <> from filename $filename = substr($filename, 1); ($filename) = split(/\>/, $filename, 2); } elsif(substr($filename, 0, 1) eq "\"") { # remove double quotes from filename $filename = substr($filename, 1); ($filename) = split(/\"/, $filename, 2); } # else assume filename given without "" or <>, naughty but allowed # check for file in current directory if($sysinclude == 0) { # get name of directory base file is in my $dir = ""; if($file =~ /\//) { my @Dirs = split(/(\/)/, $file); for($i=0; $i<$#Dirs; $i++) { $dir = $dir.$Dirs[$i]; } } if(FileExists($dir.$filename)) { $fullname = $dir.$filename; $found = 1; } } # if first char in file is "/", ignore include path if($filename =~ /^\// && FileExists($filename)) { $fullname = $filename; $found = 1; } # search for file in include paths, first path on command line first $i = 0; while($found == 0 && $i <= $#IncludePaths) { $fullname = $IncludePaths[$i]."/".$filename; if(FileExists($fullname)) { $found = 1; } $i++; } # include file if found, error if not if($found == 1) { Debug("Including file: \"".$fullname."\"", 1); # recursively call Parse Parse($fullname); } else { Warning("Include file \"".$filename."\" not found", 1); } } ############################################################################## # Pragma filepp Function Args # Pragma executes a filepp function, everything following the function name # is passed as arguments to the function. # The format is: # #pragma filepp function args... # If pragma is not followed by "filepp", it is ignored. ############################################################################## sub Pragma { my $input = shift; # check for "filepp" in string if($input =~ /^filepp\b/) { my ($function, $args); ($input, $function, $args) = split(/\s/, $input, 3); if($function) { if(!$args) { $args = ""; } if($safe_mode) { Debug("Safe mode enabled, NOT running: ".$function."(".$args.")", 1); } else { my @Args = ParseArgs($args); Debug("Running function: ".$function."(".$args.")", 1); $function->(@Args); } } } } ############################################################################## # Turn normal output on/off (does not affect any output produced by keywords) # 1 = on, 0 = off ############################################################################## sub SetOutput { $output = shift; Debug("Output set to ".$output, 2); } ############################################################################## # Turn blank suppression on and off at this include level # 1 = on, 0 = off ############################################################################## sub SetBlankSupp { $blanksupp[$include_level] = shift; Debug("Blank suppression set to ".$blanksupp[$include_level], 2); } ############################################################################## # Reset blank suppression to command-line value (except at level 0) ############################################################################## sub ResetBlankSupp { if($include_level == 0) { $blanksupp[$include_level] = 0; } else { $blanksupp[$include_level] = $blanksuppopt; } Debug("Blank suppression reset to ".$blanksupp[$include_level], 2); } ############################################################################## # Set if macros are only replaced if the macro is a 'word' ############################################################################## sub SetWordBoundaries { my $on = shift; if($on) { $bound = '\b'; Debug("Word Boundaries turned on", 2); } else { $bound = ''; Debug("Word Boundaries turned off", 2); } } ############################################################################## # DEPRECATED - this function will be removed in later versions, use Set # Toggle if macros are only replaced if the macro is a 'word' ############################################################################## sub ToggleWordBoundaries { if($bound eq '\b') { SetWordBoundaries(1); } else { SetWordBoundaries(0); } } ############################################################################## # Set treating keywordchar, contchar, macroprefix and optlineendchar as # Perl regexps ############################################################################## sub SetCharPerlre { $charperlre = shift; Debug("Characters treated as Perl regexp's : ".$charperlre, 2); } ############################################################################## # Undef a previously defined variable, usage: # #undef $macro ############################################################################## sub Undef { my $macro = shift; my $i; # separate macro from any trailing garbage $macro = substr($macro, 0, GetNextWordEnd($macro)); # delete macro from table delete $Defines{$macro}; delete $DefinesArgs{$macro}; delete $DefinesFuncs{$macro}; # and remove its eat-trailing-whitespace flag if(CheckEatTrail($macro)) { delete $EatTrail{$macro}; } # regenerate keys GenerateDefinesKeys(); Debug("Undefined macro \"".$macro."\"", 2); if($debug > 1) { PrintDefines(); } } ############################################################################## # UndefAll - undefines ALL macros ############################################################################## sub UndefAll { %Defines = (); %DefineLookup = (); %EatTrail = (); $defmin = $defmax = 0; Debug("Undefined ALL macros", 2); if($debug > 1) { PrintDefines(); } } ############################################################################## # #warning msg - print warning message "msg" ############################################################################## sub Warning { my $msg = shift; my $lastdebug = $debug; $debug = 1; Debug($msg, 1); $debug = $lastdebug; } ############################################################################## # ParseLineEnd - takes in line from input most recently read and checks # if line should be continued (ie. next line in input read and appended # to current line). # Returns two values: # $more - boolean, 1 = read another line from input to append to this one # 0 = no line continuation # $line - the line to be read. If any modification needs to be done to the # line for line contination, it is done here. # Example: if line is to be continued: set $more = 1, then # remove line continuation character and newline from end of # $line and replace with line continuation character. ############################################################################## sub ParseLineEnd { my $thisline = shift; my $more = 0; # check if end of line has a continuation char, if it has get next line if($thisline =~ /$contchar$/) { $more = 1; # remove backslash and newline $thisline =~ s/$contchar\n\Z//; # append line continuation character $thisline = $thisline.$contrepchar; } return ($more, $thisline); } ############################################################################## # Set name of function to take check if line shoule be continued ############################################################################## sub SetParseLineEnd { my $func = shift; $parselineend = $func; } ############################################################################## # Get name of function to take check if line shoule be continued ############################################################################## sub GetParseLineEnd { return $parselineend; } ############################################################################## # GetNextLine - returns the next line of the current INPUT line, # line continuation is taken care of here. ############################################################################## sub GetNextLine { my $thisline = ; if($thisline) { Redefine("__LINE__", ++$line); my $more = 0; ($more, $thisline) = $parselineend->($thisline); while($more) { Debug("Line continuation", 2); my $nextline = ; if(!$nextline) { return $thisline; } # increment line count Redefine("__LINE__", ++$line); ($more, $thisline) = $parselineend->($thisline.$nextline); # maintain same number of lines in input as output if($preserveblank) { Filepp::Output("\n"); } } } return $thisline; } ############################################################################## # Write($string) - writes $string to OUTPUT file ############################################################################## sub Write { my $string = shift; print(OUTPUT $string); } ############################################################################## # Output($string) - conditionally writes $string to OUTPUT file ############################################################################## sub Output { my $string = shift; if($output) { Write($string); } } # counter for number of #if[n][def] loops currently in my $iflevel = 0; # flag to control when to write output my @Writing = (1); # initialise default to 'writing' # flag to show if current 'if' block has passed a 'true if' my @Ifdone = (0); # initialise first to 'not passed true if' ############################################################################## # Keyword parsing routine ############################################################################## sub ParseKeywords { # input is next line in file my $inline = shift; my $outline = ""; my $thisline = $inline; my $keyword; my $found = 0; # remove whitespace from start of line $thisline = CleanStart($thisline); # check if first char on line is a # if($thisline && $thisline =~ /^$keywordchar/) { # remove "#" and any following whitespace $thisline =~ s/^$keywordchar\s*//g; # remove the optional end line char if($optlineendchar ne "") { $thisline =~ s/$optlineendchar\Z//g; } # check for keyword if($thisline && $thisline =~ /^\w+\b/ && exists($Keywords{$&})) { $keyword = $&; $found = 1; # remove newline from line chomp($thisline); # remove leading whitespace and keyword from line my $inline = CleanStart(substr($thisline, length($keyword))); # check for 'if' style keyword if(exists($Ifwords{$keyword})) { # increment ifblock level and set ifdone to same # value as previous block $iflevel++; $Ifdone[$iflevel] = 0; $Writing[$iflevel] = $Writing[$iflevel - 1]; if(!$Writing[$iflevel]) { $Ifdone[$iflevel] = 1; } } # check for out of place 'else' or 'endif' style keyword elsif($iflevel <= 0 && (exists($Elsewords{$keyword}) || exists($Endifwords{$keyword}) )) { Warning($keywordchar.$keyword." found without preceding ". $keywordchar."[else]ifword"); } # decide if to run 'if' or 'else' keyword if(exists($Ifwords{$keyword}) || exists($Elsewords{$keyword})){ if(!($Ifdone[$iflevel])) { # check return value of 'if' if($Keywords{$keyword}->($inline)) { $Ifdone[$iflevel] = 1; $Writing[$iflevel] = 1; } else { $Writing[$iflevel] = 0; } } else { $Writing[$iflevel] = 0; } } # check for 'endif' style keyword elsif(exists($Endifwords{$keyword})) { # run endif keyword and decrement iflevel if true if($Keywords{$keyword}->($inline)) { $iflevel--; } } # run all other keywords elsif($Writing[$iflevel]) { $Keywords{$keyword}->($inline); } # write a blank line if preserving blank lines # (assumes keywords have no output) if($preserveblank) { $outline = $outline."\n"; } } # keyword if statement } # no keywords in line - write line to file if not #ifdef'ed out if(!$found && $Writing[$iflevel]) { $outline = $outline.$inline; } # keep same number of files in output and input elsif(!$found && $preserveblank) { $outline = $outline."\n"; } return $outline; } ############################################################################## # Main parsing routine - inputs either: # Parse($file) - open file name $file and parse it, # Parse("<", $var [, $line]) - read input from variable $var and parse it, # optional $line var sets __LINE__ to $line, used in grab.pm ############################################################################## sub Parse { # change file being parsed to this file, remember last filename so # it can be returned at the end my $lastparse = $file; $file = shift; my $varmode = 0; my $lastcount = $line; # current line number # increment parse level $parse_level++; # input passed as a variable rather than file if($file eq "<" && $#_ >= 0) { $varmode = 1; $file = $lastparse; # leave filename alone if($#_ >= 1) { $line = $_[1]; } # set line number if provided Debug("Parsing variable...", 3); } if(!$varmode) { Debug("Parsing ".$file."...", 1); Redefine("__FILE__", $file); # increment include level Redefine("__INCLUDE_LEVEL__", ++$include_level); # set blank line suppression: # no suppression for top level files if($include_level == 0) { $blanksupp[$include_level] = 0; } # include level 1 - set suppression to command line given value elsif($include_level == 1) { # inherit root value if set if($blanksupp[0]) { $blanksupp[$include_level] = 1; } else {$blanksupp[$include_level] = $blanksuppopt; } } # all other include levels - keep suppression at existing value else { $blanksupp[$include_level] = $blanksupp[$include_level - 1]; } # reset line count, remembering previous count for future reference $line = 0; } Redefine("__LINE__", $line); # open file and set its handle to INPUT local *INPUT; # input passed as a variable rather than file if($varmode) { if(!open(INPUT, "<", \$_[0])) { Error("Could not open variable ".$_[0]." for parsing"); } } elsif(!open(INPUT, $file)) { Error("Could not open file ".$file); } # if a base file, run any initialisation functions if(!$varmode && $include_level == 0) { my $func; foreach $func (@OpenInputFuncs) { $func->(); } } # parse each line of file $_ = GetNextLine(); # if in "shebang" mode, throw away first line (the #!/blah bit) if(!$varmode && $shebang) { # check for "#!...perl ...filepp..." if($_ && $_ =~ /^\#\!.*perl.+filepp/) { Debug("Skipping first line (shebang): ".$_, 1); $_ = GetNextLine(); } } while($_) { # unless blank lines are suppressed at this include level unless($blanksupp[$include_level] && /^\s*$/) { # run processing chain (defaults to ReplaceDefines) $_ = RunProcessors($_, 1); # write output to file or STDOUT if($output) { Write($_); } } $_ = GetNextLine(); } # run any close functions if(!$varmode && $include_level == 0) { my $func; foreach $func (@CloseInputFuncs) { $func->(); } } # check all #if blocks have been closed at end of parsing if($lastparse eq "" && $iflevel > 0) { Warning("Unterminated if block"); } # close file close(INPUT); if(!$varmode) { Debug("Parsing ".$file." done. (".$line." lines processed)", 1); } # reset $line $line = $lastcount; Redefine("__LINE__", $line); if(!$varmode) { # reset $file $file = $lastparse; Redefine("__FILE__", $file); if($file ne "") { Debug("Parsing returned to ".$file." at line ".$line, 1); } # decrement include level Redefine("__INCLUDE_LEVEL__", --$include_level); } else { Debug("Parsing variable done", 3); } # decrement parse level $parse_level--; } ############################################################################## # Main routine ############################################################################## # parse command line my $i=0; my $argc=0; while($ARGV[$argc]) { $argc++; } while($ARGV[$i]) { # suppress blank lines in header files if($ARGV[$i] eq "-b") { $blanksuppopt = 1; } # read from stdin instead of file elsif($ARGV[$i] eq "-c") { AddInputFile("-"); } # Defines: -Dmacro[=defn] or -D macro[=defn] elsif(substr($ARGV[$i], 0, 2) eq "-D") { my $macrodefn; # -D macro[=defn] format if(length($ARGV[$i]) == 2) { if($i+1 >= $argc) { Error("Argument to `-D' is missing"); } $macrodefn = $ARGV[++$i]; } # -Dmacro[=defn] format else { $macrodefn = substr($ARGV[$i], 2); } my $macro = $macrodefn; my $defn = ""; my $j = index($macrodefn, "="); if($j > -1) { $defn = substr($macrodefn, $j+1); $macro = substr($macrodefn, 0, $j); } # add macro and defn to hash table Define($macro." ".$defn); } # Debugging turned on: -d elsif($ARGV[$i] eq "-d") { SetDebug(2); } # Full debugging turned on: -dd elsif($ARGV[$i] eq "-dd") { SetDebug(3); } # Light debugging turned on: -dl elsif($ARGV[$i] eq "-dl") { SetDebug(1); } # Send debugging info to stdout rather than stderr elsif($ARGV[$i] eq "-ds") { $debugstdout = 1; } # prefix all debugging info with string elsif($ARGV[$i] eq "-dpre") { if($i+1 >= $argc) { Error("Argument to `-dpre' is missing"); } $debugprefix = ReplaceDefines($ARGV[++$i]); } # prefix all debugging info with string elsif($ARGV[$i] eq "-dpost") { if($i+1 >= $argc) { Error("Argument to `-dpost' is missing"); } # replace defines is called here in case a newline is required, # this allows it to be added as __NEWLINE__ $debugpostfix = ReplaceDefines($ARGV[++$i]); } # define environment variables as macros: -e elsif($ARGV[$i] eq "-e") { DefineEnv(); } # set environment variable prefix char elsif($ARGV[$i] eq "-ec") { if($i+1 >= $argc) { Error("Argument to `-ec' is missing"); } SetEnvchar($ARGV[++$i]); } # set environment variable prefix char to nothing elsif($ARGV[$i] eq "-ecn") { SetEnvchar(""); } # show help elsif($ARGV[$i] eq "-h") { print(STDERR $usage); exit(0); } # Include paths: -Iinclude or -I include elsif(substr($ARGV[$i], 0, 2) eq "-I") { # -I include format if(length($ARGV[$i]) == 2) { if($i+1 >= $argc) { Error("Argument to `-I' is missing"); } AddIncludePath($ARGV[++$i]); } # -Iinclude format else { AddIncludePath(substr($ARGV[$i], 2)); } } # Include macros from file: -imacros file elsif($ARGV[$i] eq "-imacros") { if($i+1 >= $argc) { Error("Argument to `-imacros' is missing"); } push(@Imacrofiles, $ARGV[++$i]); } # turn off keywords elsif($ARGV[$i] eq "-k") { RemoveAllKeywords(); } # set keyword prefix char elsif($ARGV[$i] eq "-kc") { if($i+1 >= $argc) { Error("Argument to `-kc' is missing"); } SetKeywordchar($ARGV[++$i]); } # set line continuation character elsif($ARGV[$i] eq "-lc") { if($i+1 >= $argc) { Error("Argument to `-lc' is missing"); } SetContchar($ARGV[++$i]); } # set optional line end character elsif($ARGV[$i] eq "-lec") { if($i+1 >= $argc) { Error("Argument to `-lec' is missing"); } SetOptLineEndchar($ARGV[++$i]); } # set line continuation replacement char to newline elsif($ARGV[$i] eq "-lrn") { SetContrepchar("\n"); } # set line continuation replacement character elsif($ARGV[$i] eq "-lr") { if($i+1 >= $argc) { Error("Argument to `-lr' is missing"); } SetContrepchar($ARGV[++$i]); } # Module paths: -Minclude or -M include elsif(substr($ARGV[$i], 0, 2) eq "-M") { # -M include format if(length($ARGV[$i]) == 2) { if($i+1 >= $argc) { Error("Argument to `-M' is missing"); } AddModulePath($ARGV[++$i]); } # -Minclude format else { AddModulePath(substr($ARGV[$i], 2)); } } # use module elsif($ARGV[$i] eq "-m") { if($i+1 >= $argc) { Error("Argument to `-m' is missing"); } UseModule($ARGV[++$i]); } # set macro prefix elsif($ARGV[$i] eq "-mp") { if($i+1 >= $argc) { Error("Argument to `-mp' is missing"); } SetMacroPrefix($ARGV[++$i]); } # turn off macro prefix within keywords elsif($ARGV[$i] eq "-mpnk") { $macroprefixinkeywords = 0; } # turn on overwrite mode elsif($ARGV[$i] eq "-ov") { $overwrite = 1; } # turn on overwrite conversion mode elsif($ARGV[$i] eq "-ovc") { if($i+1 >= $argc) { Error("Argument to `-ovc' is missing"); } $overwriteconv = $ARGV[++$i]; if($overwriteconv !~ /=/) { Error("-ovc argument is of form IN=OUT"); } $overwrite = 1; } # Output filename: -o filename or -ofilename elsif(substr($ARGV[$i], 0, 2) eq "-o") { # -o filename if(length($ARGV[$i]) == 2) { if($i+1 >= $argc) { Error("Argument to `-o' is missing"); } $outputfile = $ARGV[++$i]; } # -ofilename else { $outputfile = substr($ARGV[$i], 2); } } # preserve blank lines in output file elsif($ARGV[$i] eq "-pb") { $preserveblank = 1; } # treat $keywordchar, $contchar and $optlineendchar as regular expressions elsif($ARGV[$i] eq "-re") { if($charperlre) { SetCharPerlre(0); } else { SetCharPerlre(1); } } # Safe mode - turns off #pragma elsif($ARGV[$i] eq "-s") { SafeMode(); } # Undef: -Umacro or -U macro elsif(substr($ARGV[$i], 0, 2) eq "-U") { my $macro; # -U macro format if(length($ARGV[$i]) == 2) { if($i+1 >= $argc) { Error("Argument to `-U' is missing"); } $macro = $ARGV[++$i]; } # -Umacro format else { $macro = substr($ARGV[$i], 2); } # undef macro Undef($macro); } # Undefine all macros elsif($ARGV[$i] eq "-u") { UndefAll(); } # print version number and exit elsif($ARGV[$i] eq "-v") { print(STDERR "filepp version ".$VERSION."\n"); exit(0); } # only replace macros if they appear as 'words' elsif($ARGV[$i] eq "-w") { if($bound eq '') { SetWordBoundaries(1); } else { SetWordBoundaries(0); } } # default - an input file name else { if(!FileExists($ARGV[$i])) { Error("Input file \"".$ARGV[$i]."\" not readable"); } AddInputFile($ARGV[$i]); } $i++; } # check input files have been specified if($#Inputfiles == -1) { Error("No input files given"); } # import macros from file if any if($#Imacrofiles >= 0) { my $file; foreach $file (@Imacrofiles) { IncludeMacros($file); } } # print initial defines if debugging if($debug > 1) { PrintDefines(); } # open the output file if(!$overwrite) { OpenOutputFile($outputfile); } # parse all input files in order given on command line my $base_file = ""; foreach $base_file (@Inputfiles) { Redefine("__BASE_FILE__", $base_file); # set open output file if in overwrite mode if($overwrite) { if($overwriteconv ne "") { # convert output filename if needed my ($in,$out) = split(/=/, $overwriteconv, 2); my $outfile = $base_file; $outfile =~ s/\Q$in\E/$out/; OpenOutputFile($outfile); } else { OpenOutputFile($base_file); } } Parse($base_file); # close output file if in overwrite mode if($overwrite) { CloseOutputFile(); } } # close output file if(!$overwrite) { CloseOutputFile(); } exit(0); # Hey emacs !! # Local Variables: # mode: perl # End: ######################################################################## # End of file ######################################################################## ./filepp-1.8.0/ChangeLog0000644000573500001440000002123610571102746014116 0ustar darrenusers2007-02-27 Darren Miller * Version 1.8.0 released * Fixed problems with loops in bigfunc 2007-01-14 Darren Miller * Rewrote processing chain - macros within macros now work properly 2005-09-01 Darren Miller * Added -U option for undefining macros 2004-01-13 Darren Miller * Version 1.7.2 released (unofficial - not on website) * Fixed bug with full paths in include lines 2003-08-10 Darren Miller * Modified for.pm, foreach.pm and bigfunc.pm to use grab module * Added grab module - allows grabbing of all input for delayed/optional/multiple processing * Modified Parse function so it can also read from variables * Fixed problems with brackets of form (a(b)) in blc.pm 2003-07-14 Darren Miller * Version 1.7.1 released * Fixed Makefile problems for none GNU systems 2003-07-13 Darren Miller * Version 1.7.0 released * Added options for dealing with multiple input and output files at once * Added testsuite for all modules and filepp features * Added "bigfunc" module - similar to bigdef module except keywords in the definition are evaluated when the macro is REPLACED rather than when the macro is DEFINED * Added AddProcessorBefore and AddProcessorAfter functions to allow greater control over processing chain * Modified comment modules to allow comments to be removed before keyword processing takes place, fixes problems caused when keywords have comments after them (thanks to Stefan Becker for reporting this) * Converted keyword processing function into part of processing chain * Merged function.pm processor into ReplaceDefines so functions are processed the same time as macros, this makes macro prefixes also work with functions * Fixed bug which broke macros with arguments using -D (thanks to Jeremy Rand for reporting this) * Added cpp style ## concatenation (thanks to Andy Thaller for this) * Remove erroenous error message from foreach and for * Changed literal module so in_string flag is reset for each call (thanks to Daniel Grimwood for this) * Added "use bytes;" so filepp works with all character sets 2002-11-17 Darren Miller * Version 1.6.0 released * Added defplus module - allows existing macros to be appended to (thanks to John Lombardo for the suggestion) * Added foreach module - implements a foreach loop (thanks to John Lombardo for suggesting this) * Added blc module - with this module lines are continued if the number of open brackets "(" on the line is greater than the number of close brackets ")" (thanks to Zousar Shaker for this) * Added SetParseLineEnd function - allows different functions to be used to determine if line continuation is done * Added -imacros option to read in macros from a file * Added any number of arguments to macros using: macro(arg1, arg2, arg3...), also allows removal of preceding , using ##, ie: macro(string, arg...) printf("string, ##arg) * Added AddOpenInputFunc, AddCloseInputFunc, AddOpenOutputFunc and AddCloseOutputFunc funcitons, - allows any function to be run each time a new base input or output file is opened or closed * Added macro prefix option (-mp) which prefixes all macros with a character (thanks to Roger Yip for suggesting this) * Added more control over debug info and option to send it to stdout * Modified literal module to work with macros with arguments * Fixed bug which caused arguments of macros to be replaced too many times (thanks to Daniel Grimwood for help with this) * Fixed problem with "include" files not being found in subdirectories (thanks to Zousar Shaker for reporting this) * Fixed bug in comment modules: hash and C comments appearing in quotes are now ignored * Fixed bug in regexp module: \1 and $1 in regexps now work properly (thanks to Roger Yip for this) 2002-07-08 Darren Miller * Version 1.5.0 released * Added optional character(s) at end of keyword line to allow neater embedding of keywords in HTML/C style comments (thanks to Zousar Shaker for this) * Added regexp module - allows Perl regular expression replacements to be done with filepp * #if keyword now prints out any errors from Perl's eval() * Added check to make sure #if blocks are closed * Added Output function (thanks to Chris Drexler for suggesting this) 2002-02-06 Darren Miller * Version 1.4.2 released * Changed AddProcessors to allow specifiation of a processor type * #if, #include and #for keywords now run current list of processors on their input rather than just ReplaceDefines * Fixed bug in GetNextWordEnd when macros are followed by tabs (thanks to Bill Roberson for this) 2002-01-08 Darren Miller * Version 1.4.1 released * Added "bigdef" module - allows easy definition of multi-line macros * Changed AddProcessors to allow processors to be added to start or end of processing chain * Fixed ParseArgs so "(" or "'" work as would be expected * Removed annoying message when processing empty file 2001-10-07 Darren Miller * Version 1.4.0 released * Added "format" module - provides "printf" style function for text and number formatting along with other text formatting functions * Added "maths" module - implements simple math routines * Added "function" module - allows macros to call Perl functions 2001-06-07 Darren Miller * Version 1.3.0 released * Added "for" module - implements simple loops via #for keyword * Added "toupper" and "tolower" modules * Added "c-comment" and "hash-comment" modules * Added "literal" module * Added AddProcessor function which allows user definable processing functions (thanks to James Yolkowski for this) * Added EatTrail functions (thanks again to Terry R. Friedrichsen for help with this) * Keyword prefix and line continuation characters no longer treated as Perl regular expressions by default, but option exists to revert to old behaviour * Added -b option to suppress blank lines from include files (thanks to Terry R. Friedrichsen for help with this) * Changed behaviour of Endifwords - now return true of false in same way as Ifwords and Elsewords * Added AddModulePath and -M option to specify modules search paths * Added AddInputPath and AddInputFile functions * Added OpenOutputFile and ChangeOutputFile functions * Added option to define environment variables as macros * Added rudimentary "shebang" support, filepp can be started as: #!/usr/bin/perl /usr/local/bin/filepp 2001-03-25 Darren Miller * Version 1.2.2 released * Added {Add,Remove}{If,Else,Endif}word functions to module API * Added SetOuput function to module API * Made GetNextLine function consistent with documentation * Fixed another nested #if block bug 2001-03-11 Darren Miller * Version 1.2.1 released * Fixed bug preventing a macro definition being '0' * Added __NEWLINE__ macro * Changed behaviour so macros with args cannot have space between macro and initial "(" on #define line (cpp like) (thanks to Thomas Link for reporting this) * Fixed nested #elif/#else bug * Added loop counter to try and detect recursive macros and includes * Added -w option which only replaces macros if they appear in the text as words (thanks to Steve Hancock for help with this) * Reduced amount of debugging info shown with -d * Added -dd option which shows old style verbose debugging * Changed #include "file.h" so the directory first searched for "file.h" is the directory the base file is in * Speeded up macro replacement 2001-02-18 Darren Miller * Version 1.2.0 released * Added module support (thanks to James Yolkowski for help with this) * Added option to customise line continuation (defaults to cpp style) * Added option to customise keyword prefix character * Added pragma keyword to allow arbitrary functions to be run * Added safe mode command line option to optionally turn pragma keyword off (for the paranoid) * Improved handling of macros with arguments, now more cpp like 2000-12-12 Darren Miller * Version 1.1.1 released * Fixed nested if bug * Added testsuite (thanks to Stephen Brooks again) * Added __ISO_DATE__ macro 2000-12-10 Darren Miller * Version 1.1.0 released * Added support for macros with arguments * Added support for #if keyword (thanks to Stephen Brooks for help with this) 2000-12-06 Darren Miller * Version 1.0.0 First public release ./filepp-1.8.0/footer.html.in0000644000573500001440000000035707125121452015132 0ustar darrenusers#ifndef FOOTER_STRING #define FOOTER_STRING Footer file #endif

This is file __FILE__, included in __BASE_FILE__ at include level __INCLUDE_LEVEL__.


FOOTER_STRING


./filepp-1.8.0/header.html.in0000644000573500001440000000034507214006723015063 0ustar darrenusers #ifndef TITLE #define TITLE This is the default title #endif TITLE

TITLE


./filepp-1.8.0/test.html.in0000644000573500001440000000232607673164321014623 0ustar darrenusers#comment This is a filepp comment - note continued line on next line #define TITLE Test Document \ for filepp #include

__FILEPP_INPUT__ version __VERSION__ on __DATE__ at __TIME__.

#define SHOW_HOMEPAGE #ifdef SHOW_HOMEPAGE

filepp homepage

#endif #if (!defined((SHOW_HOMEPAGE))) || defined DONT_SHOW_HOMEPAGE

Homepage will not be shown

#endif #define FOUR 4 #if FOUR == (2+3)

filepp can't do sums!

#elif FOUR == (1+3)

filepp can do sums too!

#endif #define GOTARGS(arg1, arg2) This has macro arguments: "arg1" and "arg2"

GOTARGS(foo bar, baa baa \ black sheep)

#if 0 You'll never see this! #endif # comment Keywords can be indented by either tabs or spaces # ifdef HIDDEN

The Hidden Link at line __LINE__!

#else

The Hidden Link is remains hidden!

#endif

Filepp testsuite: Any output between here and OK is an error

#include

OK

#define FOOTER_STRING The End. #include "footer.html.in" ./filepp-1.8.0/testsuite0000644000573500001440000002077307526033175014332 0ustar darrenusers#comment ##################################################################### #comment Filepp testsuite. This is run with the command: filepp testsuite #comment It should produce no output other than a final OK. #comment Thanks to Stephen Brooks for providing the original version of this. #comment ##################################################################### #comment ##################################################################### #comment Numerical defines, ifs and ifdefs #comment ##################################################################### #define FRED 1 #if FRED == 1 #else FAIL __LINE__ #endif #if FRED == 2 FAIL __LINE__ #else #endif #define GEORGE 1 #if defined GEORGE #else FAIL __LINE__ #endif #if ! defined GEORGE FAIL __LINE__ #else #endif #define BILL 3 #if defined BILL #else FAIL __LINE__ #endif #if ! defined BILL FAIL __LINE__ #else #endif #if defined GINGER FAIL __LINE__ #else #endif #if ! defined GINGER #else FAIL __LINE__ #endif #if GEORGE == BILL FAIL __LINE__ #endif #if GEORGE != BILL #else FAIL __LINE__ #endif #define HERBERT 34 #define JOHN 34 #if (GEORGE == BILL) && (JOHN == HERBERT) FAIL __LINE__ #endif #if (GEORGE != BILL) && (JOHN == HERBERT) #else FAIL __LINE__ #endif #if (GEORGE == BILL) && (JOHN != HERBERT) FAIL __LINE__ #else #endif #if (GEORGE > BILL) && (JOHN != HERBERT) FAIL __LINE__ #else #endif #if (JOHN < BILL) FAIL __LINE__ #else #endif #if (JOHN < 33) FAIL __LINE__ #else #endif #if (JOHN > 33) #else FAIL __LINE__ #endif #ifdef BILL #else FAIL __LINE__ #endif #undef BILL #ifdef BILL FAIL __LINE__ #endif #ifdef PAUL FAIL __LINE__ #else #endif #define ZERO 0 #if("ZERO" ne "0") FAIL __LINE__ #endif #comment Fancy Perl regexp if statements #if("ZERO" =~ /\s/) FAIL __LINE__ #elif("ZERO" =~ /\d/) #else FAIL __LINE__ #endif #comment This next test is to check recursion is avoided, this used to throw #comment filepp into a recursive loop #define RECURS1 RECURS2 RECURS2 #define RECURS2 RECURS1 RECURS1 #if "RECURS1" eq "RECURS2" #endif #comment ##################################################################### #comment Macros with arguments and perl string comparisons #comment ##################################################################### #define ARTHUR(bill, ben) bill and ben #if (defined ARTHUR) #else FAIL __LINE__ #endif #if !defined (ARTHUR) FAIL __LINE__ #else #ifdef ARTHUR #else FAIL __LINE__ #endif #ifndef ARTHUR FAIL __LINE__ #else #endif #endif #if "ARTHUR" eq "ARTHUR" #else FAIL __LINE__ #endif #if("ARTHUR" eq "ARTHUR") #else FAIL __LINE__ #endif #if "ARTHUR(bill,ben)" ne "bill and ben" FAIL __LINE__ #endif #warning testsuite should now show warning about macro 'ARTHUR': #if "ARTHUR()" ne " and " FAIL __LINE__ #endif #warning testsuite should now show warning about macro 'ARTHUR': #if "ARTHUR(ben)" eq "bill and ben" FAIL __LINE__ #endif #warning testsuite should now show warning about macro 'ARTHUR': #if "ARTHUR(bill ben)" eq "bill and ben" FAIL __LINE__ #endif #if "ARTHUR(fred, ben)" eq "bill and ben" FAIL __LINE__ #endif #define DEREK(VAL1, VAL2) :VAL1:VAL2: #if "DEREK(func(arg1,arg2),scalar)" ne ":func(arg1,arg2):scalar:" FAIL __LINE__ #endif #define NOTARGS() NO ARGS IN THIS ONE #if ("NOTARGS()" ne "NO ARGS IN THIS ONE") FAIL __LINE__ #endif #define MANYARGS(ONE, TWO, THREE, FOUR) ONE and TWO TWO and THREE and FOUR #if "MANYARGS(1,2,3,4())" ne "1 and 2 2 and 3 and 4()" FAIL __LINE__ #endif #if "MANYARGS (spaces, tabs tabs, , and gaps)" ne \ "spaces and tabs tabs tabs tabs and and and gaps" FAIL __LINE__ #endif #define NOARGS (ONE, TWO) ONE TWO #if "NOARGS" ne "(ONE, TWO) ONE TWO" FAIL __LINE__ #endif #define RECURSION(AGAIN) AGAIN #if "RECURSION(RECURSION(RECURSION(OK)))" ne "OK" FAIL __LINE__ #endif #comment ##################################################################### #comment macros with any number of args #comment ##################################################################### #define testmac(arg1, arg2, arg3...) #if("testmac(one, two, three, four, five) more stuff after" ne \ " more stuff after") FAIL __LINE__ #endif #define eprintf(format, lastarg...) fprintf(stderr, format, ##lastarg) #if "eprintf(%s, string);" ne "fprintf(stderr, %s, string);" FAIL __LINE__ #endif #if "eprintf(%s%d, string, int);" ne "fprintf(stderr, %s%d, string, int);" FAIL __LINE__ #endif #if "eprintf(empty);" ne "fprintf(stderr, empty);" FAIL __LINE__ #endif #define error(string, args...) fprintf(stderr, string, args); #if "error(%d\,%s, i, string)" ne "fprintf(stderr, %d,%s, i, string);" FAIL __LINE__ #endif #define error(string, args...) fprintf(stderr, string, ##args); #if "error(empty)" ne "fprintf(stderr, empty);" FAIL __LINE__ #endif #comment ##################################################################### #comment Nested ifs #comment ##################################################################### #if 1 #if 0 FAIL __LINE__ #else #endif #else FAIL __LINE__ #endif #comment ##################################################################### #if 0 FAIL __LINE__ #if 1 FAIL __LINE__ #else FAIL __LINE__ #endif FAIL __LINE__ #else #endif #comment ##################################################################### #ifndef ARTHUR FAIL __LINE__ #ifndef PHIL FAIL __LINE__ #else FAIL __LINE__ #endif FAIL __LINE__ #else #endif #comment ##################################################################### #ifndef PHIL #ifndef ARTHUR FAIL __LINE__ #else #endif #else FAIL __LINE__ #endif #comment ##################################################################### #ifndef ARTHUR FAIL __LINE__ #ifndef PHIL FAIL __LINE__ #else FAIL __LINE__ #endif #else #endif #comment ##################################################################### #comment elsif #comment ##################################################################### #if 1 #if 0 FAIL __LINE__ #elif 1 #if 0 FAIL __LINE__ #elif 1 #else FAIL __LINE__ #endif #else FAIL __LINE__ #endif #elif 1 FAIL __LINE__ #elif 1 FAIL __LINE__ #endif #define OUTER_IF #define INNER_IF 1 #if defined(OUTER_IF) # if (INNER_IF==1) # define INNER_IF_TEST # elif (INNER_IF==2) FAIL __LINE__ # else FAIL __LINE__ # endif # define OUTER_IF_TEST #else # if (0) FAIL __LINE__ # endif FAIL __LINE__ #endif #ifndef INNER_IF_TEST FAIL __LINE__ #endif #ifndef OUTER_IF_TEST FAIL __LINE__ #endif #comment ##################################################################### #comment Includes #comment ##################################################################### #include "testinc" #ifndef INCLUDED FAIL __LINE__ #endif #comment ##################################################################### #comment Non-ascii #comment ##################################################################### #comment define £ POUND #comment £ £ £ #comment ##################################################################### #comment White space #comment ##################################################################### # if 1 # else FAIL __LINE__ \ # endif #ifndef \ GEORGE FAIL __LINE__ #endif #define TAB tab #if "TAB" ne "tab" FAIL __LINE__ #endif #comment ##################################################################### #comment Pragma, Modules and keywords #comment ##################################################################### #pragma filepp UseModule testmod.pm #TEST comment This should be parsed as a TESTEND normal comment #TEST if TESTEND 0 FAIL __LINE__ #TEST endif #TEST pragma filepp SetCharPerlre 1 #TEST pragma filepp SetKeywordchar # #pragma filepp SetContchar \\\\ #comment Normal line \ continution (perlre) #if \ 0 FAIL __LINE__ #endif #pragma filepp SetCharPerlre 0 #pragma filepp SetContchar NULL #pragma filepp SetContchar \ #comment Normal line \ continution #if \ 0 FAIL __LINE__ #endif #pragma filepp SetOptLineEndchar */ #pragma filepp SetKeywordchar /*# /*#define OPTCHARS test*/ /*#pragma filepp SetKeywordchar #*/ #pragma filepp SetOptLineEndchar #if ("OPTCHARS" ne "test") FAIL __LINE__ #endif #comment ##################################################################### #comment Safemode #comment ##################################################################### #pragma filepp SafeMode #pragma filepp SetKeywordchar UNSAFE #comment FAIL __LINE__ #comment ##################################################################### #comment End of tests #comment ##################################################################### ./filepp-1.8.0/testinc0000644000573500001440000000002307215524775013742 0ustar darrenusers#define INCLUDED 1 ./filepp-1.8.0/testmod.pm0000644000573500001440000000133507522606150014357 0ustar darrenusersuse strict; ############################################################################## # set keyword char to #TEST - allows normal C pre-processor stuff through ############################################################################## my $keychar = "#TEST"; Filepp::SetKeywordchar($keychar); ############################################################################## # set line continution char to something other than "\" ############################################################################## Filepp::SetContchar("TESTEND"); return 1; ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/0000755000573500001440000000000010571107073014006 5ustar darrenusers./filepp-1.8.0/modules/bigdef/0000755000573500001440000000000010571107106015223 5ustar darrenusers./filepp-1.8.0/modules/bigdef/Makefile.in0000644000573500001440000000553010565412477017310 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - bigdef module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.6 $ # Last changed : $Date: 2007/02/16 20:34:07 $ # Description : Makefile for bigdef module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = @srcdir@ datarootdir = @datarootdir@ moduledir = @moduledir@ # top level of test build directory TESTBUILD = @top_builddir@/testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=@echo@ DIFF=@diff@ RM=@rm@ INSTALL=@INSTALL@ test: @$(ECHO) ----------- Testing bigdef.pm ------------- $(TESTFILEPP) -m bigdef.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing bigdef.pm and for.pm - $(TESTFILEPP) -m bigdef.pm -m for.pm $(srcdir)/test2.in -o test2.out $(DIFF) $(srcdir)/test2.good test2.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing bigdef.pm and comment.pm - $(TESTFILEPP) $(srcdir)/test3.in -o test3.out $(DIFF) $(srcdir)/test3.good test3.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing bigdef.pm ------------ $(TESTFILEPP) -m bigdef.pm $(srcdir)/test4.in -o test4.out $(DIFF) $(srcdir)/test4.good test4.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/bigdef.pm $(moduledir) clean: $(RM) test.out test2.out test3.out test4.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/bigdef/README0000644000573500001440000000263610566651505016125 0ustar darrenusers bigdef - Allow easy definition of multi-line macros This is a filepp module which allows easy definition of multi-line macros. It adds two keywords: #bigdef MACRO DEFINITION MORE DEFINITION YET MORE DEFINITION ETC. #endbigdef The syntax of #bigdef is the same as #define, only all lines following the #bigdef up to the #endbigdef are included in the macro. There is a simple test file included with this module. To test the bigdef module use the following command (the file "test" is in this directory): filepp -m bigdef.pm test.in For full documentation on how to use filepp and the bigdef module read the filepp man page. Copyright (C) 2000-2007 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Comments are welcome. - Darren Miller ./filepp-1.8.0/modules/bigdef/bigdef.1.in0000644000573500001440000000402307701320125017130 0ustar darrenusers.\" Hey Emacs! This file is -*- nroff -*- source. .\" __FILEPP_INPUT__ version __VERSION__ .\" 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. .\" .SH BIGDEF MODULE - bigdef.pm The bigdef module allows easy definition of multi-line macros. Its file name is \fBbigdef.pm\fP. .PP A multi-line macro is a macro which has a definition which spans more than one line. The normal way to define these is to place a line continuation character at the end of each line in the definition. However, this can be annoying and unreadable for large multi-line macros. The bigdef module tries to improve on this by providing two keywords: .TP .BR #bigdef " \fImacro\fP \fIdefinition...\fP" The \fB#bigdef\fP keyword has the same syntax as \fB#define\fP, the only difference being the macro definition is everything following the macro name including all following lines up to the next \fB#endbigdef\fP keyword. .TP .BR #endbigdef Ends a bigdef. Everything between this keyword and the last preceding \fB#bigdef\fP is included in the macro. .PP Any keywords found in the definition will be evaluated as normal AT THE TIME THE MACRO IS DEFINED and any output from these will be included in the definition. Note: The difference between bigfunc and bigdef is the time keywords in the definition are evaluated. Bigdef evaluates them as the macro is DEFINED, bigfunc evaluates them whenever the macro is REPLACED. ./filepp-1.8.0/modules/bigdef/bigdef.pm0000644000573500001440000000732707700655523017025 0ustar darrenusers######################################################################## # # bigdef 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. # ######################################################################## # # Project : File Preprocessor - bigdef module # Filename : $RCSfile: bigdef.pm,v $ # Author : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.5 $ # Last changed : $Date: 2003/07/02 22:23:15 $ # Description : Allows easy definition of multi-line macros # Licence : GNU copyleft # ######################################################################## # THIS IS A FILEPP MODULE, YOU NEED FILEPP TO USE IT!!! # usage: filepp -m bigdef.pm ######################################################################## package Bigdef; use strict; # version number of module my $VERSION = '1.0.1'; # current big definition my $currentdef = ""; ############################################################################## # bigdef processor, when in a big define this eats all input (after processing # for other keywords) ############################################################################## sub Processor { my $input = shift; $currentdef = $currentdef.$input; return ""; } ############################################################################## # bigdef keyword - starts a bigdef # same syntax as #define, only does not terminate until a #endbigdef is found ############################################################################## sub Bigdef { my $input = shift; # check not already in a bigdef if($currentdef ne "") { Filepp::Error("Nested bigdef's are not allowed"); } # start macro definition $currentdef = $input."\n"; # add processor - make it first in the list so all other processors are # ignored, this prevents any macro's in the bigdef being processed twice Filepp::AddProcessorAfter("Bigdef::Processor", "ParseKeywords", 1); } ############################################################################## # add bigdef keyword ############################################################################## Filepp::AddKeyword("bigdef", "Bigdef::Bigdef"); ############################################################################## # endbigdef keyword # no input, used to finish bigdef ############################################################################## sub Endbigdef { # check in bigdef if($currentdef eq "") { Filepp::Error("endbigdef found without preceding bigdef"); } # remove processor Filepp::RemoveProcessor("Bigdef::Processor"); # define macro Filepp::Define($currentdef); $currentdef = ""; } ############################################################################## # add bigdef keyword ############################################################################## Filepp::AddKeyword("endbigdef", "Bigdef::Endbigdef"); return 1; ######################################################################## # End of file ######################################################################## ./filepp-1.8.0/modules/bigdef/test.good0000644000573500001440000000410410566651505017066 0ustar darrenusers First macro: multi line macro ####################################################################### Second macro: multi line macro with args : and ------ ####################################################################### Third macro: This is ####################################################################### Fourth macro: Macro with conditional bits in: This should be in test macro ####################################################################### Fifth macro: bigdef - Allow easy definition of multi-line macros This is a filepp module which allows easy definition of multi-line macros. It adds two keywords: #bigdef MACRO DEFINITION MORE DEFINITION YET MORE DEFINITION ETC. #endbigdef The syntax of #bigdef is the same as #define, only all lines following the #bigdef up to the #endbigdef are included in the macro. There is a simple test file included with this module. To test the bigdef module use the following command (the file "test" is in this directory): filepp -m bigdef.pm test.in For full documentation on how to use filepp and the bigdef module read the filepp man page. Copyright (C) 2000-2007 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Comments are welcome. - Darren Miller ####################################################################### ./filepp-1.8.0/modules/bigdef/test.in0000644000573500001440000000207607716264027016554 0ustar darrenusers#bigdef test1() multi line macro #endbigdef First macro: test1() ####################################################################### #bigdef test2(arg1, arg2) multi line macro with args : and ------ #endbigdef Second macro: test2(this, that) ####################################################################### #bigdef test3() lots of spaces #endbigdef #define spaces don't you want to know about the wasted spaces Third macro: This is ####################################################################### #bigdef test4() Macro with conditional bits in: #define SHOWME #ifdef SHOWME This should be in test macro #else This should not be in test macro #endif #endbigdef Fourth macro: test4() ####################################################################### #bigdef test5() #pragma filepp SetKeywordchar ## ##include "README" ##pragma filepp SetKeywordchar # #endbigdef Fifth macro: test5() ####################################################################### ./filepp-1.8.0/modules/bigdef/test2.good0000644000573500001440000000014710565412477017155 0ustar darrenusers First macro: 8 5 8 5 8 5 8 5 ####################################################################### ./filepp-1.8.0/modules/bigdef/test2.in0000644000573500001440000000024110565412477016626 0ustar darrenusers#bigdef test1() #for THIS 1 < 5 1 __LINE__ THIS #endfor #endbigdef First macro: test1() ####################################################################### ./filepp-1.8.0/modules/bigdef/test3.good0000644000573500001440000000002410565412477017150 0ustar darrenuserstesting1 testing2 ./filepp-1.8.0/modules/bigdef/test3.in0000644000573500001440000000021410565412477016627 0ustar darrenusers#pragma filepp UseModule bigdef.pm #pragma filepp UseModule c-comment.pm #bigdef expandme() testing1 // 123 testing2 #endbigdef expandme() ./filepp-1.8.0/modules/bigdef/test4.good0000644000573500001440000000007410565412477017156 0ustar darrenusers===> The test is working! :) ===> The test is working! :) ./filepp-1.8.0/modules/bigdef/test4.in0000644000573500001440000000024510565412477016634 0ustar darrenusers#bigdef func(arg) #if "arg" eq "test" ===> The test is not working! :( #else ===> The test is working! :) #endif #endbigdef func(test) #define TESTY test func(test) ./filepp-1.8.0/modules/bigdef/Makefile0000644000573500001440000000554610571107106016675 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - bigdef module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.6 $ # Last changed : $Date: 2007/02/16 20:34:07 $ # Description : Makefile for bigdef module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = . datarootdir = ${prefix}/share moduledir = /usr/local/share/filepp/modules # top level of test build directory TESTBUILD = ../../testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=echo DIFF=diff RM=rm -fr INSTALL=/usr/bin/install -c test: @$(ECHO) ----------- Testing bigdef.pm ------------- $(TESTFILEPP) -m bigdef.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing bigdef.pm and for.pm - $(TESTFILEPP) -m bigdef.pm -m for.pm $(srcdir)/test2.in -o test2.out $(DIFF) $(srcdir)/test2.good test2.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing bigdef.pm and comment.pm - $(TESTFILEPP) $(srcdir)/test3.in -o test3.out $(DIFF) $(srcdir)/test3.good test3.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing bigdef.pm ------------ $(TESTFILEPP) -m bigdef.pm $(srcdir)/test4.in -o test4.out $(DIFF) $(srcdir)/test4.good test4.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/bigdef.pm $(moduledir) clean: $(RM) test.out test2.out test3.out test4.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/bigfunc/0000755000573500001440000000000010571107106015420 5ustar darrenusers./filepp-1.8.0/modules/bigfunc/Makefile.in0000644000573500001440000000554210565412377017507 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - bigfunc module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.10 $ # Last changed : $Date: 2007/02/16 20:33:03 $ # Description : Makefile for bigfunc module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = @srcdir@ datarootdir = @datarootdir@ moduledir = @moduledir@ # top level of test build directory TESTBUILD = @top_builddir@/testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=@echo@ DIFF=@diff@ RM=@rm@ INSTALL=@INSTALL@ test: @$(ECHO) ----------- Testing bigfunc.pm ------------ $(TESTFILEPP) -m bigfunc.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing bigfunc.pm and for.pm - $(TESTFILEPP) -m bigfunc.pm -m for.pm $(srcdir)/test2.in -o test2.out $(DIFF) $(srcdir)/test2.good test2.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing bigfunc.pm and comment.pm - $(TESTFILEPP) $(srcdir)/test3.in -o test3.out $(DIFF) $(srcdir)/test3.good test3.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing bigfunc.pm ------------ $(TESTFILEPP) -m bigfunc.pm $(srcdir)/test4.in -o test4.out $(DIFF) $(srcdir)/test4.good test4.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/bigfunc.pm $(moduledir) clean: $(RM) test.out test2.out test3.out test4.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/bigfunc/README0000644000573500001440000000315710566651505016321 0ustar darrenusers bigfunc - Allow easy definition of multi-line functions This is a filepp module which allows easy definition of multi-line functions. It adds two keywords: #bigfunc MACRO DEFINITION MORE DEFINITION YET MORE DEFINITION ETC. #endbigfunc The syntax of #bigfunc is the same as #define, only all lines following the #bigfunc up to the #endbigfunc are included in the macro. bigfunc behaves similarly to bigdef. The difference is keywords in bigdefs are evaluated when the macro is DEFINED. Keywords in bigfunc are evaluted when the macro (or function) is REPLACED. There is a simple test file included with this module. To test the bigfunc module use the following command (the file "test" is in this directory): filepp -m bigfunc.pm test.in For full documentation on how to use filepp and the bigfunc module read the filepp man page. Copyright (C) 2000-2007 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Comments are welcome. - Darren Miller ./filepp-1.8.0/modules/bigfunc/bigfunc.1.in0000644000573500001440000000403707701320127017531 0ustar darrenusers.\" Hey Emacs! This file is -*- nroff -*- source. .\" __FILEPP_INPUT__ version __VERSION__ .\" 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. .\" .SH BIGFUNC MODULE - bigfunc.pm The bigfunc module allows easy definition of multi-line macros. Its file name is \fBbigfunc.pm\fP. .PP A multi-line macro is a macro which has a definition which spans more than one line. The normal way to define these is to place a line continuation character at the end of each line in the definition. However, this can be annoying and unreadable for large multi-line macros. The bigfunc module tries to improve on this by providing two keywords: .TP .BR #bigfunc " \fImacro\fP \fIdefinition...\fP" The \fB#bigfunc\fP keyword has the same syntax as \fB#define\fP, the only difference being the macro definition is everything following the macro name including all following lines up to the next \fB#endbigfunc\fP keyword. .TP .BR #endbigfunc Ends a bigfunc. Everything between this keyword and the last preceding \fB#bigfunc\fP is included in the macro. .PP Any keywords found in the definition will be evaluated as normal AT THE TIME THE MACRO IS REPLACED and any output from these will be included in the definition. Note: The difference between bigfunc and bigdef is the time keywords in the definition are evaluated. Bigdef evaluates them as the macro is DEFINED, bigfunc evaluates them whenever the macro is REPLACED. ./filepp-1.8.0/modules/bigfunc/bigfunc.pm0000644000573500001440000001054110565647643017416 0ustar darrenusers######################################################################## # # bigfunc 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. # ######################################################################## # # Project : File Preprocessor - bigfunc module # Filename : $RCSfile: bigfunc.pm,v $ # Author : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.16 $ # Last changed : $Date: 2007/02/17 18:55:31 $ # Description : This allows last minute processing of stuff # Licence : GNU copyleft # ######################################################################## # THIS IS A FILEPP MODULE, YOU NEED FILEPP TO USE IT!!! # usage: filepp -m bigfunc.pm ######################################################################## package Bigfunc; use strict; # version number of module my $VERSION = '1.0.0'; require "function.pm"; require "grab.pm"; my %Defines; my %DefineArgs; my $firstline = ""; ######################################################################## # Bigfunc keyword - same as bigdef - only difference is any keywords # in the macro are evaluated when the macro is called rather than # when the macro is defined. ######################################################################## sub Bigfunc { $firstline = shift; # check there are brackets () in the function name if($firstline !~ /\(/) { Filepp::Error("bigfunc: macro must have brackets [use macro() for 0 arguments]"); } # grab all input until endbigfunc Grab::StartGrab("bigfunc", "endbigfunc"); } Filepp::AddKeyword("bigfunc", "Bigfunc::Bigfunc"); ######################################################################## # EndBigfunc keyword ######################################################################## sub EndBigfunc { # check endbigfunc is after a bigfunc if($firstline eq "") { Filepp::Error("endbigfunc found without preceding bigfunc"); } # get input from grab module my @Input = Grab::GetInput(); my $macrodefn = join("", $firstline, "\n", @Input); # reset firstline $firstline = ""; # define the macro temporarily (gets redefined as a function later) Filepp::Define($macrodefn); # get the defined macro back my ($macro, $junk) = split(/\(/, $macrodefn, 2); my ($defn, $args) = Filepp::GetDefine($macro); # store args if any given if(defined($args)) { $DefineArgs{$macro} = $args; } # define the macro defn pair $Defines{$macro} = $defn; # add a function which will call this macro Function::AddFunction($macro, "Bigfunc::Run"); } Filepp::AddKeyword("endbigfunc", "Bigfunc::EndBigfunc"); ######################################################################## # Function to parse the bigfunc ######################################################################## sub Run { my $macro = Filepp::FunctionMacro(); my @Argvals = @_; my @Argnames = split(/\,/, $DefineArgs{$macro}); my $parseline = Filepp::GetParseLineEnd(); # split macro into single lines my @Input = split(/\n/, $Defines{$macro}); my $output = ""; my $i = 0; my %Dummy = (); # process all lines in macro while($i <= $#Input) { my $tail = ""; my $string; # replace any arguments ($string, $tail) = Filepp::ArgReplacer(\@Argvals, \@Argnames, $macro, $Input[$i], $tail, %Dummy); $Input[$i] = $string.$tail; # run processing chain before here to catch up $output .= Filepp::RunProcessors($Input[$i++]."\n", 1); } return $output; } return 1; ######################################################################## # End of file ######################################################################## ./filepp-1.8.0/modules/bigfunc/test.good0000644000573500001440000000442610566651505017272 0ustar darrenusers First macro: multi line macro ####################################################################### Second macro: multi line macro with args : and ------ ####################################################################### Third macro: This is ####################################################################### Fourth macro: Macro with conditional bits in: This should be in test macro ####################################################################### Fifth macro: bigfunc - Allow easy definition of multi-line functions This is a filepp module which allows easy definition of multi-line functions. It adds two keywords: #bigfunc MACRO DEFINITION MORE DEFINITION YET MORE DEFINITION ETC. #endbigfunc The syntax of #bigfunc is the same as #define, only all lines following the #bigfunc up to the #endbigfunc are included in the macro. bigfunc behaves similarly to bigdef. The difference is keywords in bigdefs are evaluated when the macro is DEFINED. Keywords in bigfunc are evaluted when the macro (or function) is REPLACED. There is a simple test file included with this module. To test the bigfunc module use the following command (the file "test" is in this directory): filepp -m bigfunc.pm test.in For full documentation on how to use filepp and the bigfunc module read the filepp man page. Copyright (C) 2000-2007 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Comments are welcome. - Darren Miller ####################################################################### ./filepp-1.8.0/modules/bigfunc/test.in0000644000573500001440000000211007715676123016741 0ustar darrenusers#bigfunc test1() multi line macro #endbigfunc First macro: test1() ####################################################################### #bigfunc test2(arg1, arg2) multi line macro with args : and ------ #endbigfunc Second macro: test2(this, that) ####################################################################### #bigfunc test3() lots of spaces #endbigfunc #define spaces don't you want to know about the wasted spaces Third macro: This is ####################################################################### #bigfunc test4() Macro with conditional bits in: #define SHOWME #ifdef SHOWME This should be in test macro #else This should not be in test macro #endif #endbigfunc Fourth macro: test4() ####################################################################### #bigfunc test5() #pragma filepp SetKeywordchar ## ##include "README" ##pragma filepp SetKeywordchar # #endbigfunc Fifth macro: test5() ####################################################################### ./filepp-1.8.0/modules/bigfunc/test2.good0000644000573500001440000000015710565647643017360 0ustar darrenusers First macro: Start 10 1 2 3 4 End 10 ####################################################################### ./filepp-1.8.0/modules/bigfunc/test2.in0000644000573500001440000000026610565647643017037 0ustar darrenusers#bigfunc test1() Start __LINE__ #for THIS 1 < 5 1 THIS #endfor End __LINE__ #endbigfunc First macro: test1() ####################################################################### ./filepp-1.8.0/modules/bigfunc/test3.good0000644000573500001440000000002410564200524017330 0ustar darrenuserstesting1 testing2 ./filepp-1.8.0/modules/bigfunc/test3.in0000644000573500001440000000021710564200524017012 0ustar darrenusers#pragma filepp UseModule bigfunc.pm #pragma filepp UseModule c-comment.pm #bigfunc expandme() testing1 // 123 testing2 #endbigfunc expandme() ./filepp-1.8.0/modules/bigfunc/test4.good0000644000573500001440000000007410564200524017336 0ustar darrenusers===> The test is working! :) ===> The test is working! :) ./filepp-1.8.0/modules/bigfunc/test4.in0000644000573500001440000000024710564200524017016 0ustar darrenusers#bigfunc func(arg) #if "arg" eq "test" ===> The test is working! :) #else ===> The test is not working! :( #endif #endbigfunc func(test) #define TESTY test func(test) ./filepp-1.8.0/modules/bigfunc/Makefile0000644000573500001440000000556010571107106017066 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - bigfunc module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.10 $ # Last changed : $Date: 2007/02/16 20:33:03 $ # Description : Makefile for bigfunc module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = . datarootdir = ${prefix}/share moduledir = /usr/local/share/filepp/modules # top level of test build directory TESTBUILD = ../../testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=echo DIFF=diff RM=rm -fr INSTALL=/usr/bin/install -c test: @$(ECHO) ----------- Testing bigfunc.pm ------------ $(TESTFILEPP) -m bigfunc.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing bigfunc.pm and for.pm - $(TESTFILEPP) -m bigfunc.pm -m for.pm $(srcdir)/test2.in -o test2.out $(DIFF) $(srcdir)/test2.good test2.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing bigfunc.pm and comment.pm - $(TESTFILEPP) $(srcdir)/test3.in -o test3.out $(DIFF) $(srcdir)/test3.good test3.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing bigfunc.pm ------------ $(TESTFILEPP) -m bigfunc.pm $(srcdir)/test4.in -o test4.out $(DIFF) $(srcdir)/test4.good test4.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/bigfunc.pm $(moduledir) clean: $(RM) test.out test2.out test3.out test4.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/blc/0000755000573500001440000000000010571107106014543 5ustar darrenusers./filepp-1.8.0/modules/blc/Makefile.in0000644000573500001440000000427510564200543016621 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - blc module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:03 $ # Description : Makefile for blc module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = @srcdir@ datarootdir = @datarootdir@ moduledir = @moduledir@ # top level of test build directory TESTBUILD = @top_builddir@/testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=@echo@ DIFF=@diff@ RM=@rm@ INSTALL=@INSTALL@ test: @$(ECHO) ----------- Testing blc.pm ---------------- $(TESTFILEPP) -m blc.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/blc.pm $(moduledir) clean: $(RM) test.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/blc/README0000644000573500001440000000270110566651506015437 0ustar darrenusers blc - bracket line continuation This is a filepp module which modifies line continuation so as well as continuing lines which end in the line continuation character (normally \), lines are also continued if they contain more open brackets "(" than close brackets ")". This makes it easier to call macros with a long arguments. There is a simple test file included with this module. To test the blc module use the following command (the file "test" is in this directory): filepp -m blc.pm test.in For full documentation on how to use filepp and the blc module read the filepp man page. Thanks to Zousar Shaker for writing the original version of this function. Copyright (C) 2000-2007 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Comments are welcome. - Darren Miller ./filepp-1.8.0/modules/blc/blc.1.in0000644000573500001440000000253107525532027016004 0ustar darrenusers.\" Hey Emacs! This file is -*- nroff -*- source. .\" __FILEPP_INPUT__ version __VERSION__ .\" 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. .\" .SH BLC MODULE - blc.pm The Bracket Line Continuation module causes lines to be continued if they have more open brackets: "(" than close brackets: ")" on a line. The line will be continued until an equal number of open and close brackets are found. Brackets can be prevented from being counted for line continuation by escaping them with a backslash: "\(" and "\)". Any brackets found with a preceding backslash will be ignored when deciding if line continuation should be done and then have the backslash removed once the full line has been found. ./filepp-1.8.0/modules/blc/blc.pm0000644000573500001440000000643707711732441015663 0ustar darrenusers######################################################################## # # elc 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. # ######################################################################## # # Project : File Preprocessor - elc module # Filename : $RCSfile: blc.pm,v $ # Author : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.2 $ # Last changed : $Date: 2003/07/30 12:08:01 $ # Description : Allows easy definition of multi-line macros # Licence : GNU copyleft # ######################################################################## # THIS IS A FILEPP MODULE, YOU NEED FILEPP TO USE IT!!! # usage: filepp -m elc.pm ######################################################################## ######################################################################## # Thanks to Zousar Shaker for writing the original version of this function ######################################################################## package Blc; use strict; # version number of module my $VERSION = '1.1.0'; ############################################################################## # ParseLineEnd - See ParseLineEnd in filepp for full description of how this # function works. # This version differs from normal in that line is continued if line # continuation character is at end of line or if there are more ('s on # a line than )'s (not including \( and \) ) ############################################################################## sub ParseLineEnd { my $thisline = shift; my $more = 0; # check for normal style line continuation ($more, $thisline) = Filepp::ParseLineEnd($thisline); # if line not being continued already, check to see if it should be if($more == 0) { # check if end of line has more open brackets than close brackets my @Open = ($thisline =~ /(?=[^\\]\()/g); my @Close = ($thisline =~ /(?=[^\\]\))/g); if($#Open > $#Close) { $more = 1; # remove newline and replace with single space $thisline =~ s/\n\Z/\ /; } # if line has ended - deal with escaped brackets else { # replace '\(' and '\)' with '(' and ')' $thisline =~ s/\\\(/\(/g; $thisline =~ s/\\\)/\)/g; } } return ($more, $thisline); } ############################################################################## # set elc as line contination function ############################################################################## Filepp::SetParseLineEnd("Blc::ParseLineEnd"); return 1; ######################################################################## # End of file ######################################################################## ./filepp-1.8.0/modules/blc/test.good0000644000573500001440000000212307711732441016402 0ustar darrenusers Test line 1 About to call the macro The macro named 'MyMacro' has been called with arguments 'TestArg1' and 'Short Test Arg' The macro named 'MyMacro' has been called with arguments 'TestArg1' and 'Short Test Arg (with brackets)' The macro named 'MyMacro' has been called with arguments 'TestArg1' and '"Long Test Arg with a single inner bracket ("' The macro named 'MyMacro' has been called with arguments 'TestArg1' and 'Long Test Arg with no brackets or commas or other things which could cause problems' The macro named 'MyMacro' has been called with arguments 'TestArg1' and '"Long Test Arg with no brackets, but with a comma, which could cause problems, but since we're within quotation marks, it's not an issue"' Done calling the macro A line with (brackets in which goes on for several lines (and has brackets within) brackets and then goes on some more) Normal line continuation test(xtype, x, ytype, y) (streuth(xtype, typeof (x)) && blimey (ytype, typeof (y))) A line with an ( escaped bracket. A line with another ) escaped bracket. A line with \(brackets which stay escaped\). ./filepp-1.8.0/modules/blc/test.in0000644000573500001440000000165607711732441016072 0ustar darrenusers#define MyMacro(arg1,arg2) The macro named 'MyMacro' has been called with arguments 'arg1' and 'arg2' Test line 1 About to call the macro MyMacro(TestArg1,Short Test Arg) MyMacro(TestArg1,Short Test Arg \(with brackets\)) MyMacro(TestArg1,"Long Test Arg with a single inner bracket \(") MyMacro(TestArg1,Long Test Arg with no brackets or commas or other things which could cause problems) MyMacro(TestArg1,"Long Test Arg with no brackets, but with a comma, which could cause problems, but since we're within quotation marks, it's not an issue") Done calling the macro A line with (brackets in which goes on for several lines (and has brackets within) brackets and then goes on some more) Normal line \ continuation test(xtype, x, ytype, y) \ (streuth(xtype, typeof (x)) \ && blimey (ytype, typeof (y))) A line with an \( escaped bracket. A line with another \) escaped bracket. A line with \\(brackets which stay escaped\\). ./filepp-1.8.0/modules/blc/Makefile0000644000573500001440000000431310571107106016204 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - blc module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:03 $ # Description : Makefile for blc module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = . datarootdir = ${prefix}/share moduledir = /usr/local/share/filepp/modules # top level of test build directory TESTBUILD = ../../testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=echo DIFF=diff RM=rm -fr INSTALL=/usr/bin/install -c test: @$(ECHO) ----------- Testing blc.pm ---------------- $(TESTFILEPP) -m blc.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/blc.pm $(moduledir) clean: $(RM) test.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/case/0000755000573500001440000000000010571107106014716 5ustar darrenusers./filepp-1.8.0/modules/case/Makefile.in0000644000573500001440000000501410564200546016767 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - tolower and toupper module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:06 $ # Description : Makefile for tolower module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = @srcdir@ datarootdir = @datarootdir@ moduledir = @moduledir@ # top level of test build directory TESTBUILD = @top_builddir@/testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=@echo@ DIFF=@diff@ RM=@rm@ INSTALL=@INSTALL@ test: @$(ECHO) ----------- Testing tolower.pm ------------ $(TESTFILEPP) -m tolower.pm $(srcdir)/test.in -o testlower.out $(DIFF) $(srcdir)/testlower.good testlower.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing toupper.pm ------------ $(TESTFILEPP) -m toupper.pm $(srcdir)/test.in -o testupper.out $(DIFF) $(srcdir)/testupper.good testupper.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/tolower.pm $(moduledir) $(INSTALL) -m 644 $(srcdir)/toupper.pm $(moduledir) clean: $(RM) testlower.out testupper.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/case/README0000644000573500001440000000245110566651506015614 0ustar darrenusers case - modify case of all letters in a file This filepp module provides to modules: toupper and tolower. The toupper module converts all letters to upper case. The tolower module converts all letters to lower case. There is a simple test file included with this module. To test the for module use the following commands (the file "test" is in this directory): filepp -m toupper.pm test.in filepp -m tolower.pm test.in For full documentation on how to use filepp and the case module read the filepp man page. Copyright (C) 2000-2007 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Comments are welcome. - Darren Miller ./filepp-1.8.0/modules/case/case.1.in0000644000573500001440000000176107307256003016331 0ustar darrenusers.\" Hey Emacs! This file is -*- nroff -*- source. .\" __FILEPP_INPUT__ version __VERSION__ .\" 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. .\" .SH TOUPPER MODULE - toupper.pm The toupper module converts all lowercase letters to uppercase. .SH TOLOWER MODULE - tolower.pm The tolower module converts all uppercase letters to lowercase. ./filepp-1.8.0/modules/case/test.in0000644000573500001440000000014307704477745016252 0ustar darrenusersALL UPPERCASE ON THIS LINE all lowercase on this line Mix Of CaseS ON tHIs LiNe. 1234 -* () \//\@# ./filepp-1.8.0/modules/case/testlower.good0000644000573500001440000000014307701050742017622 0ustar darrenusersall uppercase on this line all lowercase on this line mix of cases on this line. 1234 -* () \//\@# ./filepp-1.8.0/modules/case/testupper.good0000644000573500001440000000014307701050742017625 0ustar darrenusersALL UPPERCASE ON THIS LINE ALL LOWERCASE ON THIS LINE MIX OF CASES ON THIS LINE. 1234 -* () \//\@# ./filepp-1.8.0/modules/case/tolower.pm0000644000573500001440000000350407360070455016761 0ustar darrenusers######################################################################## # # tolower 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. # ######################################################################## # # Project : File Preprocessor - tolower module # Filename : $RCSfile: tolower.pm,v $ # Author : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.2 $ # Last changed : $Date: 2001/10/07 15:13:49 $ # Description : This module converts all letters to upper case. # Licence : GNU copyleft # ######################################################################## # THIS IS A FILEPP MODULE, YOU NEED FILEPP TO USE IT!!! # usage: filepp -m tolower.pm ######################################################################## package ToLower; use strict; # version number of module my $VERSION = '1.0.0'; sub ToLower { my $string = shift; $string =~ s/([A-Z])/\L$1\E/g; return $string; } Filepp::AddProcessor("ToLower::ToLower"); return 1; ######################################################################## # End of file ######################################################################## ./filepp-1.8.0/modules/case/toupper.pm0000644000573500001440000000350407360070455016764 0ustar darrenusers######################################################################## # # toupper 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. # ######################################################################## # # Project : File Preprocessor - toupper module # Filename : $RCSfile: toupper.pm,v $ # Author : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.2 $ # Last changed : $Date: 2001/10/07 15:13:49 $ # Description : This module converts all letters to upper case. # Licence : GNU copyleft # ######################################################################## # THIS IS A FILEPP MODULE, YOU NEED FILEPP TO USE IT!!! # usage: filepp -m toupper.pm ######################################################################## package ToUpper; use strict; # version number of module my $VERSION = '1.0.0'; sub ToUpper { my $string = shift; $string =~ s/([a-z])/\U$1\E/g; return $string; } Filepp::AddProcessor("ToUpper::ToUpper"); return 1; ######################################################################## # End of file ######################################################################## ./filepp-1.8.0/modules/case/Makefile0000644000573500001440000000503210571107106016356 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - tolower and toupper module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:06 $ # Description : Makefile for tolower module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = . datarootdir = ${prefix}/share moduledir = /usr/local/share/filepp/modules # top level of test build directory TESTBUILD = ../../testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=echo DIFF=diff RM=rm -fr INSTALL=/usr/bin/install -c test: @$(ECHO) ----------- Testing tolower.pm ------------ $(TESTFILEPP) -m tolower.pm $(srcdir)/test.in -o testlower.out $(DIFF) $(srcdir)/testlower.good testlower.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing toupper.pm ------------ $(TESTFILEPP) -m toupper.pm $(srcdir)/test.in -o testupper.out $(DIFF) $(srcdir)/testupper.good testupper.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/tolower.pm $(moduledir) $(INSTALL) -m 644 $(srcdir)/toupper.pm $(moduledir) clean: $(RM) testlower.out testupper.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/cmacros/0000755000573500001440000000000010571107107015433 5ustar darrenusers./filepp-1.8.0/modules/cmacros/Makefile.in0000644000573500001440000000431610564200547017510 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - cmacros module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:07 $ # Description : Makefile for cmacros module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = @srcdir@ datarootdir = @datarootdir@ moduledir = @moduledir@ # top level of test build directory TESTBUILD = @top_builddir@/testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=@echo@ DIFF=@diff@ RM=@rm@ INSTALL=@INSTALL@ test: @$(ECHO) ----------- Testing cmacros.pm ------------- $(TESTFILEPP) -m cmacros.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/cmacros.pm $(moduledir) clean: $(RM) test.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/cmacros/README0000644000573500001440000000310710566651510016322 0ustar darrenusers cmacros - make certain macros more "C" like This filepp module provides the module: cmacros The cmacros module puts quotes around certain macros which would not normally be quoted by filepp. This makes filepp's output more like the output of the C preprocessor which always puts quotes around these macros. The macros are: __DATE__ __TIME__ __VERSION__ __BASE_FILE__ __FILE__ It is easy to modify the list of macros if required by editing the module. There is a simple test file included with this module. To test the for module use the following commands (the file "test.c" is in this directory): filepp -m cmacros.pm test.in Also try: filepp test.in to see the effect of including the module. For full documentation on how to use filepp and the comment module read the filepp man page. Copyright (C) 2000-2007 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Comments are welcome. - Darren Miller ./filepp-1.8.0/modules/cmacros/cmacros.1.in0000644000573500001440000000215607553360521017564 0ustar darrenusers.\" Hey Emacs! This file is -*- nroff -*- source. .\" __FILEPP_INPUT__ version __VERSION__ .\" 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. .\" .SH C MACROS MODULE - cmacros.pm The cmacros module causes the definition of the following predefined macros to be quoted: \fBDATE, TIME, VERSION, BASE_FILE, FILE,\fP (note: predefined macros are written as __MACRO__). This makes the macros more "C" like, as the C preprocessor also puts quotes around these macros. ./filepp-1.8.0/modules/cmacros/cmacros.pm0000644000573500001440000000614007553360521017430 0ustar darrenusers######################################################################## # # cmacros 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. # ######################################################################## # # Project : File Preprocessor - cmacros module # Filename : $RCSfile: cmacros.pm,v $ # Author : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.2 $ # Last changed : $Date: 2002/10/16 21:59:45 $ # Description : Quotes C macros (eg: __FILE__ file.c becomes "file.c") # Licence : GNU copyleft # ######################################################################## # THIS IS A FILEPP MODULE, YOU NEED FILEPP TO USE IT!!! # usage: filepp -m cmacros.pm ######################################################################## package Cmacros; use strict; # version number of module my $VERSION = '1.0.0'; # macros which get defined once when filepp starts my @StaticMacros = ( "__DATE__", "__TIME__", "__VERSION__"); # macros which change during processing my @DynamicMacros = ( "__BASE_FILE__", "__FILE__"); ######################################################################## # Function which checks all macros in list begin and end with " ######################################################################## sub UpdateMacros { my @Macros = @_; my $macro; my $defn; foreach $macro (@Macros) { if(Filepp::Ifdef($macro)) { $defn = Filepp::ReplaceDefines($macro); if($defn !~ /\A\".*\"\Z/) { Filepp::Debug("cmacros: quoting macro $macro"); Filepp::Define($macro." \"".$defn."\""); } } } } ######################################################################## # Startup - quote all macros ######################################################################## UpdateMacros(@StaticMacros); UpdateMacros(@DynamicMacros); ######################################################################## # This function adds cmacros style information whenever the current file # being processed changes ######################################################################## sub CheckMacros { # take in current line and pass it on unaltered my $input = shift; UpdateMacros(@DynamicMacros); return $input; } Filepp::AddProcessor("Cmacros::CheckMacros", 1); return 1; ######################################################################## # End of file ######################################################################## ./filepp-1.8.0/modules/cmacros/test.c0000644000573500001440000000015707526544700016573 0ustar darrenusersBASE_FILE __BASE_FILE__ DATE __DATE__ FILE __FILE__ TIME __TIME__ VERSION __VERSION__ #include "testinc.h" ./filepp-1.8.0/modules/cmacros/test.good0000644000573500001440000000012307704477745017306 0ustar darrenusersBASE_FILE "./test.in" FILE "./test.in" BASE_FILE "./test.in" FILE "./testinc.h" ./filepp-1.8.0/modules/cmacros/test.in0000644000573500001440000000007407704477745016771 0ustar darrenusersBASE_FILE __BASE_FILE__ FILE __FILE__ #include "testinc.h" ./filepp-1.8.0/modules/cmacros/testinc.h0000644000573500001440000000005007701050743017254 0ustar darrenusersBASE_FILE __BASE_FILE__ FILE __FILE__ ./filepp-1.8.0/modules/cmacros/Makefile0000644000573500001440000000433410571107107017077 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - cmacros module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:07 $ # Description : Makefile for cmacros module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = . datarootdir = ${prefix}/share moduledir = /usr/local/share/filepp/modules # top level of test build directory TESTBUILD = ../../testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=echo DIFF=diff RM=rm -fr INSTALL=/usr/bin/install -c test: @$(ECHO) ----------- Testing cmacros.pm ------------- $(TESTFILEPP) -m cmacros.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/cmacros.pm $(moduledir) clean: $(RM) test.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/comment/0000755000573500001440000000000010571107107015446 5ustar darrenusers./filepp-1.8.0/modules/comment/Makefile.in0000644000573500001440000000512510564200550017514 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - c-comment.pm and hash-comment.pm module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.4 $ # Last changed : $Date: 2007/02/13 00:08:08 $ # Description : Makefile for c-comment.pm module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = @srcdir@ datarootdir = @datarootdir@ moduledir = @moduledir@ # top level of test build directory TESTBUILD = @top_builddir@/testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=@echo@ DIFF=@diff@ RM=@rm@ INSTALL=@INSTALL@ test: @$(ECHO) ----------- Testing c-comment.pm ---------- $(TESTFILEPP) -m c-comment.pm $(srcdir)/test.in -o test-c.out $(DIFF) $(srcdir)/test-c.good test-c.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing hash-comment.pm ------- $(TESTFILEPP) -m hash-comment.pm $(srcdir)/test.in -o test-hash.out $(DIFF) $(srcdir)/test-hash.good test-hash.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/comment.pm $(moduledir) $(INSTALL) -m 644 $(srcdir)/c-comment.pm $(moduledir) $(INSTALL) -m 644 $(srcdir)/hash-comment.pm $(moduledir) clean: $(RM) test-c.out test-hash.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/comment/README0000644000573500001440000000265710566651510016346 0ustar darrenusers comment - remove comments from files This filepp module provides to modules: c-comment and hash-comment The c-comment module removes C and C++ style comments from files. The hash-comment module removes everything following a "#" on a line, this is the comment style used for Perl, Bourne Shell, C Shell, Make and many configuration files. There is a simple test file included with this module. To test the for module use the following commands (the file "test" is in this directory): filepp -m c-comment.pm test.in filepp -m hash-comment.pm test.in For full documentation on how to use filepp and the comment module read the filepp man page. Copyright (C) 2000-2007 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Comments are welcome. - Darren Miller ./filepp-1.8.0/modules/comment/c-comment.pm0000644000573500001440000000661207700655523017705 0ustar darrenusers######################################################################## # # c-comment 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. # ######################################################################## # # Project : File Preprocessor - c-comment module # Filename : $RCSfile: c-comment.pm,v $ # Author : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.7 $ # Last changed : $Date: 2003/07/02 22:23:15 $ # Description : This module removes all C and C++ style comments from # a file. # Licence : GNU copyleft # ######################################################################## # THIS IS A FILEPP MODULE, YOU NEED FILEPP TO USE IT!!! # usage: filepp -m c-comment.pm ######################################################################## package CComment; use strict; # version number of module my $VERSION = '1.2.0'; require "comment.pm"; # remove all comments from string sub RemoveComments { my $string = shift; # remove all C++ style comments $string = Comment::RemoveComments("//", $string); # remove all C comments my $newstring = Comment::RemoveComments("/\\*", $string); while($string =~ /\S/ && $newstring ne $string) { # remove newline that may have been added by RemoveComments if($newstring =~ /\n$/) { chomp($newstring); } # start of comment has been removed - find closing */ # get rest of string and check for end of comment in this line $string = Comment::GetLineEnd(); if($string =~ /\*\//) { # get rest of line my $line = $'; # one more quote for emacs ' $string = $newstring.$line; } # multi-line comment else { # find line with end of comment $string = Filepp::GetNextLine(); my $newlines = 1; while($string && $string !~ /\*\//) { $string = Filepp::GetNextLine(); $newlines++; } if($string) { # get rest of line following end of comment $string = $newstring.substr($string, index($string, "*/")+2); } else { $string = $newstring; } # make number of lines in output equal to number of lines in input while($newlines-- > 0) { if($newstring =~ /\S/) { $string = $string."\n"; } else { $string = "\n".$string; } } } # check for more comments on this line $newstring = Comment::RemoveComments("/\\*", $string); } return $string; } if(Filepp::Ifdef("REMOVE_C_COMMENTS_FIRST")) { Filepp::Undef("REMOVE_C_COMMENTS_FIRST"); Filepp::AddProcessor("CComment::RemoveComments", 1); } else { Filepp::AddProcessor("CComment::RemoveComments"); } return 1; ######################################################################## # End of file ######################################################################## ./filepp-1.8.0/modules/comment/comment.1.in0000644000573500001440000000344707674413547017631 0ustar darrenusers.\" Hey Emacs! This file is -*- nroff -*- source. .\" __FILEPP_INPUT__ version __VERSION__ .\" 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. .\" .SH C/C++ COMMENT MODULE - c-comment.pm The c-comment module removes all C style: \fI/* comment */\fP and C++ style: \fI// comment\fP comments from a file. C and C++ comments are removed after keywords have been processed. If you wish to remove C and C++ comments before keywords are processed, define the macro \fBREMOVE_C_COMMENTS_FIRST\fP before loading the module, eg: \fBfilepp -DREMOVE_C_COMMENTS_FIRST -m c-comment.pm\fP .SH HASH COMMENT MODULE - hash-comment.pm The hash-comment module removes all comments of the style: \fI# comment\fP from a file. This is the commenting style used by Perl, Bourne Shell, C Shell and many other programs and configuration files. Hash comments are removed after keywords have been processed. If you wish to remove hash comments before keywords are processed, define the macro \fBREMOVE_HASH_COMMENTS_FIRST\fP before loading the module (Note: if you do this and also use # as the keyword character then the keywords will be removed BEFORE they are processed). ./filepp-1.8.0/modules/comment/comment.pm0000644000573500001440000000633210565404220017451 0ustar darrenusers######################################################################## # # comment 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. # ######################################################################## # # Project : File Preprocessor - comment module # Filename : $RCSfile: comment.pm,v $ # Author : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.5 $ # Last changed : $Date: 2007/02/16 19:40:00 $ # Description : This module contains a function to remove all # comments where the comment is defined as all # characters on a line following the string $comment # Licence : GNU copyleft # ######################################################################## # THIS IS A FILEPP MODULE, YOU NEED FILEPP TO USE IT!!! # usage: normally called from within another module, see # hash-comment.pm and c-comment.pm ######################################################################## package Comment; use strict; # version number of module my $VERSION = '1.0.0'; my $string; # remove all comments from string # inputs: # comment - the comment, a string or char # string - the input string which may contain comments to be removed # outputs: # output - the string with the comment removed sub RemoveComments { my $comment = shift; $string = shift; my $output = ""; if($string !~ /$comment/m) { return $string; } my $line = $string; foreach $string (split(/\n/, $line)) { my $search = 1; while($search) { # check for comment in string if($string =~ /$comment/) { # keep everything before first comment $output = $output.$`; # set string to everything after comment $string = $'; # one more quote for emacs ' # make note of removed part of string my $removed = $&; # check comment is not enclosed in quotes eg: "#", # count number of '"' in string and if odd then comment in quotes my @Count = ($output =~ /[^\\]\"/g); if($#Count % 2 != 0) { # if true comment is NOT in quotes $search = 0; } # put comment back onto string else { $output = $output.$removed; } } else { $output = $output.$string; $search = 0; } } # put newline back $output = $output."\n"; } return $output; } # return whatever is left of the last line processed after comment removal sub GetLineEnd { return $string; } return 1; ######################################################################## # End of file ######################################################################## ./filepp-1.8.0/modules/comment/hash-comment.pm0000644000573500001440000000422407700655523020403 0ustar darrenusers######################################################################## # # hash-comment 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. # ######################################################################## # # Project : File Preprocessor - hash-comment module # Filename : $RCSfile: hash-comment.pm,v $ # Author : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.5 $ # Last changed : $Date: 2003/07/02 22:23:15 $ # Description : This module removes all # style comments as used by # Perl, make, sh, csh and lots of other stuff # Licence : GNU copyleft # ######################################################################## # THIS IS A FILEPP MODULE, YOU NEED FILEPP TO USE IT!!! # usage: filepp -m hash-comment.pm ######################################################################## package HashComment; use strict; # version number of module my $VERSION = '1.2.0'; require "comment.pm"; # remove all comments from string sub RemoveComments { my $string = shift; return Comment::RemoveComments("#", $string); } if(Filepp::Ifdef("REMOVE_HASH_COMMENTS_FIRST")) { Filepp::Undef("REMOVE_HASH_COMMENTS_FIRST"); Filepp::AddProcessor("HashComment::RemoveComments", 1); } else { Filepp::AddProcessor("HashComment::RemoveComments"); } return 1; ######################################################################## # End of file ######################################################################## ./filepp-1.8.0/modules/comment/test-c.good0000644000573500001440000000137507701050743017531 0ustar darrenusersC/C++ comments: normal line start of line end of line after multi-line comment before c++ comment abc xyz #### #### #### foo should not be bar this is a this is "another // test" this is "an\"other" this "is" "another // test" this "is" "another" valid c++ comment c++ comment "in a // string" this is a " /* " test "*/" multi-line start multi-line end Hash comments: Normal line # commented line partly commented line, comment starts now: # this is a comment # lots # of #comments not a comment # test of lines with "" in them this is a # test this is "another # test" # comment this is "ano\"ther" # test this "is" "another # test" # comment this "is" "another" # test This is a # comment I like "lots of # comments" ./filepp-1.8.0/modules/comment/test-hash.good0000644000573500001440000000166607701050743020235 0ustar darrenusersC/C++ comments: /* commented line */ normal line start of line /* comment */ end of line /* multi line comment */ after multi-line comment // c++ comment before c++ comment // c++ comment /* c-comment // with c++ comment in it */ //* abc /* Should not see this */ xyz /* should not see next line */ bar should not be bar // test of lines with "" in them this is a // test this is "another // test" // comment this is "an\"other" // test this "is" "another // test" // comment this "is" "another" // test valid c++ comment // don't see me c++ comment "in a // string" this is a " /* " test /* test */ "*/" multi-line start /* test of multi line and more lines */ multi-line end Hash comments: Normal line partly commented line, comment starts now: not a comment this is a this is "another # test" this is "ano\"ther" this "is" "another # test" this "is" "another" This is a I like "lots of # comments" /* oops! ./filepp-1.8.0/modules/comment/test.in0000644000573500001440000000214407704477745017004 0ustar darrenusersC/C++ comments: /* commented line */ normal line start of line /* comment */ end of line /* multi line comment */ after multi-line comment // c++ comment before c++ comment // c++ comment /* c-comment // with c++ comment in it */ //* abc /* Should not see this */ xyz #### /* */ #### /* */ #### /* should not see next line #define foo bar */ foo should not be bar // test of lines with "" in them this is a // test this is "another // test" // comment this is "an\"other" // test this "is" "another // test" // comment this "is" "another" // test valid c++ comment // don't see me c++ comment "in a // string" this is a " /* " test /* test */ "*/" multi-line start /* test of multi line and more lines */ multi-line end Hash comments: Normal line # commented line partly commented line, comment starts now: # this is a comment # lots # of #comments not a comment # test of lines with "" in them this is a # test this is "another # test" # comment this is "ano\"ther" # test this "is" "another # test" # comment this "is" "another" # test This is a # comment I like "lots of # comments" /* oops! ./filepp-1.8.0/modules/comment/Makefile0000644000573500001440000000514310571107107017111 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - c-comment.pm and hash-comment.pm module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.4 $ # Last changed : $Date: 2007/02/13 00:08:08 $ # Description : Makefile for c-comment.pm module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = . datarootdir = ${prefix}/share moduledir = /usr/local/share/filepp/modules # top level of test build directory TESTBUILD = ../../testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=echo DIFF=diff RM=rm -fr INSTALL=/usr/bin/install -c test: @$(ECHO) ----------- Testing c-comment.pm ---------- $(TESTFILEPP) -m c-comment.pm $(srcdir)/test.in -o test-c.out $(DIFF) $(srcdir)/test-c.good test-c.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing hash-comment.pm ------- $(TESTFILEPP) -m hash-comment.pm $(srcdir)/test.in -o test-hash.out $(DIFF) $(srcdir)/test-hash.good test-hash.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/comment.pm $(moduledir) $(INSTALL) -m 644 $(srcdir)/c-comment.pm $(moduledir) $(INSTALL) -m 644 $(srcdir)/hash-comment.pm $(moduledir) clean: $(RM) test-c.out test-hash.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/cpp/0000755000573500001440000000000010571107107014566 5ustar darrenusers./filepp-1.8.0/modules/cpp/Makefile.in0000644000573500001440000000427510564200551016642 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - cpp module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:09 $ # Description : Makefile for cpp module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = @srcdir@ datarootdir = @datarootdir@ moduledir = @moduledir@ # top level of test build directory TESTBUILD = @top_builddir@/testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=@echo@ DIFF=@diff@ RM=@rm@ INSTALL=@INSTALL@ test: @$(ECHO) ----------- Testing cpp.pm ---------------- $(TESTFILEPP) -m cpp.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/cpp.pm $(moduledir) clean: $(RM) test.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/cpp/README0000644000573500001440000000254610566651511015464 0ustar darrenusers cpp - a rudimentary C preprocessor This filepp module provides the module: cpp This module makes filepp behave in a similar manner to a C preprocessor. DISCLAIMER: filepp is not meant to be a replacement for a C preprocessor even with this module. I would not recommend using filepp as a C preprocessor unless you fully understand how it differs from a real C preprocessor. The output from filepp with the cpp module is not guaranteed to be the same as a real C preprocessor. For full documentation on how to use filepp and the comment module read the filepp man page. Copyright (C) 2000-2007 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Comments are welcome. - Darren Miller ./filepp-1.8.0/modules/cpp/cpp.1.in0000644000573500001440000000233307553360521016047 0ustar darrenusers.\" Hey Emacs! This file is -*- nroff -*- source. .\" __FILEPP_INPUT__ version __VERSION__ .\" 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. .\" .SH C MACROS MODULE - cpp.pm The cpp makes filepp behave in a similar manner to a C preprocessor CPP1. DISCLAIMER: filepp is not meant to be a drop in replacement for a C preprocessor even with this module. I would not recommend using filepp as a C preprocessor unless you fully understand how it differs from a real C preprocessor. The output from filepp with the cpp module will not be the same as a real C preprocessor. ./filepp-1.8.0/modules/cpp/cpp.pm0000644000573500001440000000773607715543313015734 0ustar darrenusers######################################################################## # # cpp 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. # ######################################################################## # # Project : File Preprocessor - cpp module # Filename : $RCSfile: cpp.pm,v $ # Author : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.5 $ # Last changed : $Date: 2003/08/10 22:27:23 $ # Description : Makes filepp behave similar to cpp # Licence : GNU copyleft # ######################################################################## # THIS IS A FILEPP MODULE, YOU NEED FILEPP TO USE IT!!! # usage: filepp -m cpp.pm ######################################################################## package Cpp; use strict; # version number of module my $VERSION = '0.3.0'; my $last_file = ""; my $last_line = ""; my $last_include = -1; my @SystemIncludes = ("/usr/include"); { my $include; foreach $include (@SystemIncludes) { Filepp::AddIncludePath($include); } } # This will remove all C and C++ comments (done after AddFileInfo) Filepp::Define("REMOVE_C_COMMENTS_FIRST"); require "c-comment.pm"; ######################################################################## # This function adds cpp style information whenever the current file # being processed changes ######################################################################## sub AddFileInfo { # take in next line my $input = shift; # get name of current file my $current_file = Filepp::ReplaceDefines("__FILE__"); my $current_line = Filepp::ReplaceDefines("__LINE__"); my $current_include = Filepp::ReplaceDefines("__INCLUDE_LEVEL__"); # check if file has changed if($current_file ne $last_file) { # gcc cpp flags: # `1' This indicates the start of a new file. # `2' This indicates returning to a file (after having included # another file). # `3' This indicates that the following text comes from a system # header file, so certain warnings should be suppressed. # `4' This indicates that the following text should be treated as C. ? my $flags = ""; my $last_flags = ""; if($last_file ne "") { # check for start of new file if($current_include > $last_include) { $flags = " 1"; } else { # returning $flags = " 2"; } } my $inc; foreach $inc (@SystemIncludes) { if($current_file =~ /\A\"$inc/) { $flags = $flags." 3"; } if($last_file =~ /\A\"$inc/) { $last_flags = " 3"; } } if($last_file ne "") { Filepp::Write("# ".$last_line." ".$last_file.$last_flags."\n"); } Filepp::Write("# ".$current_line." ".$current_file.$flags."\n"); $last_file = $current_file; } # updated number of lines processed $last_line = $current_line; $last_include = $current_include; # return the unmodified line return $input; } Filepp::AddProcessor("Cpp::AddFileInfo", 1); Filepp::AddCloseInputFunc("Cpp::AddFileInfo"); # This will quote macros such as __FILE__ require "cmacros.pm"; # This will allow macros with args to be spread over several lines require "blc.pm"; # This will make macro replacement more cpp line Filepp::SetWordBoundaries(1); return 1; ######################################################################## # End of file ######################################################################## ./filepp-1.8.0/modules/cpp/cpptest2.h0000644000573500001440000000012207701075046016505 0ustar darrenusers#define SOMETHING_FISHY 2 #ifdef TEST #endif #ifndef TEST1 #endif SOMETHING_FISHY ./filepp-1.8.0/modules/cpp/test.good0000644000573500001440000000026707704477745016452 0ustar darrenusers# 1 "./test.in" 1 this should be visible... ... and this should be visible too # 23 "./test.in" # 1 "./cpptest2.h" 1 2 # 6 "./cpptest2.h" # 24 "./test.in" 2 End of file ./filepp-1.8.0/modules/cpp/test.in0000644000573500001440000000062307704477746016125 0ustar darrenusers#define SOMETHING 1 /* hmmm... */ /* SOMETHING fishy */ SOMETHING #define SOMETHING 1 #ifdef SOMETHING this should be visible... #if (SOMETHING==1) ... and this should be visible too #endif #endif #ifdef NOTHING this should not be visible... #if (NOTHING==1) ... and this should be invisible too #endif #endif #include "cpptest2.h" /* comments */ // r /* really * really // great */ End of file ./filepp-1.8.0/modules/cpp/Makefile0000644000573500001440000000431310571107107016227 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - cpp module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:09 $ # Description : Makefile for cpp module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = . datarootdir = ${prefix}/share moduledir = /usr/local/share/filepp/modules # top level of test build directory TESTBUILD = ../../testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=echo DIFF=diff RM=rm -fr INSTALL=/usr/bin/install -c test: @$(ECHO) ----------- Testing cpp.pm ---------------- $(TESTFILEPP) -m cpp.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/cpp.pm $(moduledir) clean: $(RM) test.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/defplus/0000755000573500001440000000000010571107107015446 5ustar darrenusers./filepp-1.8.0/modules/defplus/Makefile.in0000644000573500001440000000431510564200551017515 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - defplus module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:09 $ # Description : Makefile for defplus module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = @srcdir@ datarootdir = @datarootdir@ moduledir = @moduledir@ # top level of test build directory TESTBUILD = @top_builddir@/testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=@echo@ DIFF=@diff@ RM=@rm@ INSTALL=@INSTALL@ test: @$(ECHO) ----------- Testing defplus.pm ------------ $(TESTFILEPP) -m defplus.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/defplus.pm $(moduledir) clean: $(RM) test.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/defplus/README0000644000573500001440000000254110566651511016337 0ustar darrenusers defplus - append to an existing macro This is a filepp module which allows existing macros to be appended to. It adds one keyword: #defplus MACRO DEFINITION The syntax of #defplus is the same as #define, only of MACRO already exists, DEFINITION is appended to the existing definition for MACRO. There is a simple test file included with this module. To test the defplus module use the following command (the file "test" is in this directory): filepp -m defplus.pm test.in For full documentation on how to use filepp and the defplus module read the filepp man page. Copyright (C) 2000-2007 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Comments are welcome. - Darren Miller ./filepp-1.8.0/modules/defplus/defplus.1.in0000644000573500001440000000262207525462151017611 0ustar darrenusers.\" Hey Emacs! This file is -*- nroff -*- source. .\" __FILEPP_INPUT__ version __VERSION__ .\" 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. .\" .SH DEFPLUS MODULE - defplus.pm The defplus module allows extra information to be appended to an existing macro. Its file name is \fBdefplus.pm\fP. .PP The defplus module allows further things to be appended to existing macros. The module implements one keyword: .TP .BR #defplus " \fImacro\fP \fIdefinition...\fP" The \fB#defplus\fP keyword has the same syntax as \fB#define\fP, the only difference being if the macro is already defined then \fIdefinition\fP is appended to the existing definition of the macro. If the macro is undefined then \fB#defplus\fP behaves in exactly the same way as \fB#define\fP. ./filepp-1.8.0/modules/defplus/defplus.pm0000644000573500001440000000533107525462036017462 0ustar darrenusers######################################################################## # # defplus 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. # ######################################################################## # # Project : File Preprocessor - defplus module # Filename : $RCSfile: defplus.pm,v $ # Author : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.2 $ # Last changed : $Date: 2002/08/11 13:18:22 $ # Description : Allows easy definition of multi-line macros # Licence : GNU copyleft # ######################################################################## # THIS IS A FILEPP MODULE, YOU NEED FILEPP TO USE IT!!! # usage: filepp -m defplus.pm ######################################################################## package Defplus; use strict; # version number of module my $VERSION = '1.0.0'; ############################################################################## # defplus keyword - starts a defplus # same syntax as #define, only does not terminate until a #enddefplus is found ############################################################################## sub Defplus { my $macrodefn = shift; my $macro; my $defn; my $i; # find end of macroword - assume separated by space or tab $i = Filepp::GetNextWordEnd($macrodefn); # separate macro and defn (can't use split, doesn't work with '0') $macro = substr($macrodefn, 0, $i); $defn = substr($macrodefn, $i); # check if macro is already defined if(Filepp::Ifdef($macro)) { # append definition to current definition $defn = Filepp::GetDefine($macro).$defn; } Filepp::Define($macro." ".$defn); } ############################################################################## # add defplus keyword ############################################################################## Filepp::AddKeyword("defplus", "Defplus::Defplus"); return 1; ######################################################################## # End of file ######################################################################## ./filepp-1.8.0/modules/defplus/test.good0000644000573500001440000000037407701050743017307 0ustar darrenusersNext line should be "test another test": test another test Next line should be "this that this this" this that this this Next line should be "one good macro deserves another" one good macro deserves another Next line should be "a new day" a new day ./filepp-1.8.0/modules/defplus/test.in0000644000573500001440000000070607704477746017007 0ustar darrenusers#define macro1 test #defplus macro1 another test Next line should be "test another test": macro1 #define macro2 this that #defplus macro2 this #defplus macro2 this Next line should be "this that this this" macro2 #defplus macro3 one good macro #defplus macro3 deserves another Next line should be "one good macro deserves another" macro3 #defplus macro4 this won't appear #undef macro4 #defplus macro4 a new day Next line should be "a new day" macro4 ./filepp-1.8.0/modules/defplus/Makefile0000644000573500001440000000433310571107107017111 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - defplus module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:09 $ # Description : Makefile for defplus module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = . datarootdir = ${prefix}/share moduledir = /usr/local/share/filepp/modules # top level of test build directory TESTBUILD = ../../testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=echo DIFF=diff RM=rm -fr INSTALL=/usr/bin/install -c test: @$(ECHO) ----------- Testing defplus.pm ------------ $(TESTFILEPP) -m defplus.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/defplus.pm $(moduledir) clean: $(RM) test.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/filedb/0000755000573500001440000000000010571107073015233 5ustar darrenusers./filepp-1.8.0/modules/filedb/filedb.pm0000644000573500001440000001513007561320275017024 0ustar darrenusers######################################################################## # # filedb 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. # ######################################################################## # # Project : File Preprocessor - filedb database module # Filename : $RCSfile: filedb.pm,v $ # Author : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.5 $ # Last changed : $Date: 2002/11/03 22:18:37 $ # Description : Implements a simple database as a filepp module # Licence : GNU copyleft # ######################################################################## # THIS IS A FILEPP MODULE, YOU NEED FILEPP TO USE IT!!! # usage: filepp -m filedb.pm ######################################################################## package Filedb; use strict; # version number of module my $VERSION = '0.1.0'; Filepp::Error("The filedb module is not fully implmented yet!"); ######################################################################## # main filedb data structures ######################################################################## # hash of all tables, has form: # hash index = table name # hash entry = (@Fields) my %Tables = (); # hash of all table separators, has form: # hash index = table name # hash entry = $separator my %Separators = (); # hash of all table entries, has form: # hash index = table name # hash entry = (%Entries) # %Entries is a hash of all the entries in the table and has form: # hash index = first column of table # hash entry = (@Entries) (includes first entry) my %Entries = (); ######################################################################## # Table keyword, creates a new table in the data base, # takes inputs (as one space separated string) : # tablename - name of table # separator - separator used when entering fields in table # note: the separator can not appear in any fields in the table! # list of space separated fields - each field is the name of a column in # the table ######################################################################## sub Table { my $input = shift; my ($name, $separator, @Fields) = split(/\s+/, $input); print("Table name: \"$name\"\n"); print("Table separator: \"$separator\"\n"); my $field; foreach $field (@Fields) { print("Field: \"$field\"\n"); } # enter new table into tables $Tables{$name} = \@Fields; # enter separator $Separators{$name} = $separator; } ######################################################################## # Add the table keyword ######################################################################## Filepp::AddKeyword("table", \&Table); ######################################################################## # Insert keyword, adds an entry to a table, # takes inputs (as one space separated string) : # tablename - name of table # separator - separator used when entering fields in table # note: the separator can not appear in any fields in the table! # list of space separated fields - each field is the name of a column in # the table ######################################################################## sub Insert { my $input = shift; my ($table, $entry) = split(/\s+/, $input, 2); # check the table exists if(!exists($Tables{$table})) { Filepp::Warning("Table $table not found"); return; } # split up entry and add it to table my $numfields = @{$Tables{$table}}; my @Entry = split(/$Separators{$table}/, $entry, $numfields); # pad with blanks if needed while($#Entry < $numfields-1) { push(@Entry, ""); } # add to hash $ {$Entries{$table}} {$Entry[0]} = \@Entry; } ######################################################################## # Add the insert keyword ######################################################################## Filepp::AddKeyword("insert", \&Insert); ######################################################################## # Select keyword, prints a table, # takes inputs (as one space separated string) : # tablename - name of table ######################################################################## sub Select { my ($items, $tables, $conditions); my $input = shift; ($items, $input) = split(/\s+FROM\s+/, $input, 2); ($tables, $conditions) = split(/\s+WHERE\s+/, $input, 2); print("items <$items>, tables <$tables>, conditions <$conditions>\n"); my @Items = split(/\s*,\s*/, $items); foreach $items (@Items) { print("item: <$items>\n"); } my @Tables = split(/\s*,\s*/, $tables); foreach $tables (@Tables) { print("table: <$tables>\n"); } my @Conditions = split(/\s*,\s*/, $conditions); foreach $conditions (@Conditions) { print("condition: <$conditions>\n"); } } ######################################################################## # Add the select keyword ######################################################################## Filepp::AddKeyword("select", \&Select); ######################################################################## # List a whole table ######################################################################## sub List { my $table = shift; my $field; print("Table:\t"); foreach $field (@{$Tables{$table}}) { print("$field\t"); } print("\n"); my @Fields = sort( keys( %{$Entries{$table}} ) ); foreach $field (@Fields) { my @Entry = @{ ${ $Entries{$table}}{$field} }; my $entry; print("\n"); foreach $entry (@Entry) { print("Entry: $entry\n"); } } } ######################################################################## # Add the list keyword ######################################################################## Filepp::AddKeyword("list", \&List); return 1; ######################################################################## # End of file ######################################################################## ./filepp-1.8.0/modules/filedb/test.in0000644000573500001440000000047407704477746016574 0ustar darrenusers#table address : name email address phone #insert address this : that : #insert address Darren Miller:darren@cabaret.demon.co.uk:1 Big Street, Mytown, ABC 123:(0123) 456 789::any number of separators #select address.label FROM address, responsible , arse,balls WHERE address.name = "Darren Miller" #list address./filepp-1.8.0/modules/for/0000755000573500001440000000000010571107107014572 5ustar darrenusers./filepp-1.8.0/modules/for/Makefile.in0000644000573500001440000000427510564200552016647 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - for module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:10 $ # Description : Makefile for for module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = @srcdir@ datarootdir = @datarootdir@ moduledir = @moduledir@ # top level of test build directory TESTBUILD = @top_builddir@/testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=@echo@ DIFF=@diff@ RM=@rm@ INSTALL=@INSTALL@ test: @$(ECHO) ----------- Testing for.pm ---------------- $(TESTFILEPP) -m for.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/for.pm $(moduledir) clean: $(RM) test.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/for/README0000644000573500001440000000232510566651512015464 0ustar darrenusers for - A simple for loop for filepp This is a filepp module which implements a simple for loop. It adds two keywords: #for MACRO START COMPARISON END INCREMENT #endfor There is a simple test file included with this module. To test the for module use the following command (the file "test" is in this directory): filepp -m for.pm test.in For full documentation on how to use filepp and the for module read the filepp man page. Copyright (C) 2000-2007 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Comments are welcome. - Darren Miller ./filepp-1.8.0/modules/for/for.1.in0000644000573500001440000000605307307256004016057 0ustar darrenusers.\" Hey Emacs! This file is -*- nroff -*- source. .\" __FILEPP_INPUT__ version __VERSION__ .\" 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. .\" .SH FOR MODULE - for.pm The for module implements a simple for loop. Its file name is \fBfor.pm\fP. .PP The for loop is similar in functionality to that of other programming languages such as Perl or or C. It has a single variable (a filepp macro) which is assigned a numerical value. This numerical value changes by a set increment on each iteration through the loop. The loop termiates when the value no longer passes a comparison test. .PP The for module implements the following keywords: .TP .BR #for " \fImacro\fP \fIstart\fP \fIcompare\fP \fIend\fP \fIincrement\fP" The \fB#for\fP keyword is functionally equivalent to the following Perl or C style loop: for(\fImacro\fP=\fIstart\fP; \fImacro\fP \fIcompare\fP \fIend\fP; \fImacro\fP+=\fIincrement\fP) The \fB#for\fP keyword requires the following space separated parameters: \fImacro\fP : The name of the macro to which the for loop should assign its numerical value. \fIstart\fP : The value \fImacro\fP should be assigned at the start of the loop. \fIstart\fP should be a numerical value. \fIcompare\fP : The comparison to make between the current value of \fImacro\fP and the value \fIend\fP to determine when the loop should terminate. Valid values for \fIcompare\fP are <, >, >=, <=. \fIend\fP : the for loop will terminate when the test \fI macro compare end \fP fails. \fIend\fP should be a numerical value. \fIincrement\fP : The value to increment \fImacro\fP on each iteration of the loop. At the end of each iteration the value of \fIincrement\fP is added to the current value of \fImacro\fP. \fIincrement\fP should be a numerical value. .TP .BR #endfor The \fB#endfor\fP keyword is used to signify the end of the loop. Everything within the opening \fB#for\fP and the closing \fB#endfor\fP will be processed on each iteration of the loop. .PP Example usage: \fB#for\fP COUNTER 10 > 1 -2.5 COUNTER \fB#endfor\fP In the above example COUNTER will be defined to have values 10, 7.5, 5 and 2.5 for each successive iteration through the loop. Nested loops are also possible, as is changing the value of the macro within the loop. \fIstart\fP, \fIend\fP and \fIincrement\fP should all be numerical values, however it is possible to use macros instead provided the macros are defined to have numerical values. ./filepp-1.8.0/modules/for/for.pm0000644000573500001440000001413110565635306015730 0ustar darrenusers######################################################################## # # for 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. # ######################################################################## # # Project : File Preprocessor - for loop module # Filename : $RCSfile: for.pm,v $ # Author : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.16 $ # Last changed : $Date: 2007/02/17 17:26:30 $ # Description : Implements a simple for loop # Licence : GNU copyleft # ######################################################################## # THIS IS A FILEPP MODULE, YOU NEED FILEPP TO USE IT!!! # usage: filepp -m for.pm ######################################################################## package For; use strict; # version number of module my $VERSION = '1.3.0'; # uses grab module require "grab.pm"; # contains for structure: # $macro = macro which stores value # $comp = comparison # $end = max (or min) value # $inc = increment # $line = line for loop started my @Forloops = (); # set when end of for loop reached which did not evaluate to true for first # loop, at this point parsing skips to end forloop. If they are inner loops # the inner for is skipped, but the inner endfor is not leading to more # endfor's than for's. This flag says it is ok to ignore them. my $ignore_end = 0; ############################################################################## # TestFor - tests current for loop to see if it should continue in # loop or break out (returns 1 for continue, 0 for stop) ############################################################################## sub TestFor { my ($val, $compare, $end) = @_; return Filepp::If(("$val $compare $end")); } ############################################################################## # for keyword, input: # macro start comparison end increment # loop of form: # for(macro=start; macro comparison end; macro += increment) # ops # endfor ############################################################################## sub For { my $input = shift; # split up line my ($macro, $start, $compare, $end, $inc) = split(/\s+/, $input); # check if $start is a macro $start = Filepp::RunProcessors("$start"); Filepp::Debug("For: $macro = $start, $macro $compare $end, $macro += $inc\n"); # define the macro to have the starting value Filepp::Define("$macro $start"); my $line = 0; if(Filepp::Ifdef("__LINE__")) { $line = Filepp::ReplaceDefines("__LINE__"); } # add data structure to current for list my @ThisFor = ($macro, $compare, $end, $inc, $line); push(@Forloops, \@ThisFor); # for loop ok, set up data structure and go if(TestFor($start, $compare, $end)) { Filepp::Debug("For: $macro loop started with value $start"); # in a valid for loop, make sure all endfor's are treated as valid $ignore_end = 0; # grab all input up to corresponding endfor keyword Grab::StartGrab("for", "endfor"); # in for loop - return 1 to Parse return 1; } # have not entered loop, be ready for excess endfor's $ignore_end = 1; # for loop comparison failed, skip to endfor - return 0 to Parse Filepp::Debug("For: $macro loop not entered"); return 0; } ############################################################################## # add for keyword - also an ifword ############################################################################## Filepp::AddKeyword("for", "For::For"); Filepp::AddIfword("for"); ############################################################################## # endfor keyword # no input, used to terminate forloop ############################################################################## sub EndFor { # check endfor is at a valid position - otherwise ignore it # (filepp will give an error if it is out of place) if($#Forloops < 0) { return 1; } # pop current for loop info off top of list my @ThisFor = @{pop(@Forloops)}; my ($macro, $compare, $end, $inc, $line) = @ThisFor; # get grabbed input from grab moudule my @Input = Grab::GetInput(); # get line number (add 1 coz first_line is for #for keyword) my $first_line = Grab::GetInputLine() + 1; my $real_line = Filepp::ReplaceDefines("__LINE__"); my $loop = 1; # loop as many times as required while($loop) { # fix line number my $line = $first_line; # parse all input between start and end of loop my $input; foreach $input (@Input) { Filepp::Redefine("__LINE__", $line++); Filepp::ProcessLine($input); } # get macro val and increment it my $val = Filepp::RunProcessors($macro); $val += Filepp::RunProcessors("$inc"); Filepp::Define("$macro $val"); # test if current forloop should continue if(TestFor($val, $compare, $end)) { Filepp::Debug("For: $macro loop continuing with value $val"); } else { $loop = 0; } } Filepp::Redefine("__LINE__", $real_line); # end of loop, return 1 to Parse so it moves on Filepp::Debug("For: $macro loop end"); return 1; } ############################################################################## # add for keyword - also an endif word ############################################################################## Filepp::AddKeyword("endfor", "For::EndFor"); Filepp::AddEndifword("endfor"); return 1; ######################################################################## # End of file ######################################################################## ./filepp-1.8.0/modules/for/test.good0000644000573500001440000000125710565635306016442 0ustar darrenusersFor loop example COUNTER 10 > 1 -2.5, expect 10, 7.5, 5, 2.5 3 10 3 7.5 3 5 3 2.5 6 Test of nested loops, expect outer 10,8,6,4,2, inner 2,3.5,5 outer=10, inner=2 outer=10, inner=3.5 outer=10, inner=5 outer=8, inner=2 outer=8, inner=3.5 outer=8, inner=5 outer=6, inner=2 outer=6, inner=3.5 outer=6, inner=5 outer=4, inner=2 outer=4, inner=3.5 outer=4, inner=5 outer=2, inner=2 outer=2, inner=3.5 outer=2, inner=5 Test of macros in for line, expect 100,102,104: 100 102 104 Test of loop break out, expect 1,2,3,4,5 1 2 3 4 5 Test of include files in loop, expect 0.1,0.2,0.3 0.1 0.2 0.3 End loop value should be 0.4: 0.4 ./filepp-1.8.0/modules/for/test.h0000644000573500001440000000001507303035540015716 0ustar darrenusersINCLUDE_LOOP ./filepp-1.8.0/modules/for/test.in0000644000573500001440000000151710565635306016117 0ustar darrenusersFor loop example COUNTER 10 > 1 -2.5, expect 10, 7.5, 5, 2.5 #for COUNTER 10 > 1 -2.5 __LINE__ COUNTER #endfor __LINE__ Test of nested loops, expect outer 10,8,6,4,2, inner 2,3.5,5 #for OUTER 10 > 1 -2 # for INNER 2 <= 5 1.5 outer=OUTER, inner=INNER # endfor #endfor Test of macros in for line, expect 100,102,104: #define START_VAL 100 #define END_VAL 105 #define INC_VAL 2 #define COMPARE_VAL < #for TESTER START_VAL COMPARE_VAL END_VAL INC_VAL TESTER #endfor Test of loop break out, expect 1,2,3,4,5 #define END_LOOP 10 #for LEAVE_LOOP 1 < END_LOOP 1 LEAVE_LOOP # if LEAVE_LOOP >= 5 # define LEAVE_LOOP END_LOOP # endif #endfor Test of include files in loop, expect 0.1,0.2,0.3 #for INCLUDE_LOOP 0.1 <= 0.3 0.1 # include "test.h" #endfor End loop value should be 0.4: INCLUDE_LOOP #if 0 #for TEST 1 < 10 1 TEST #endfor #endif ./filepp-1.8.0/modules/for/Makefile0000644000573500001440000000431310571107107016233 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - for module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:10 $ # Description : Makefile for for module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = . datarootdir = ${prefix}/share moduledir = /usr/local/share/filepp/modules # top level of test build directory TESTBUILD = ../../testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=echo DIFF=diff RM=rm -fr INSTALL=/usr/bin/install -c test: @$(ECHO) ----------- Testing for.pm ---------------- $(TESTFILEPP) -m for.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/for.pm $(moduledir) clean: $(RM) test.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/foreach/0000755000573500001440000000000010571107107015413 5ustar darrenusers./filepp-1.8.0/modules/foreach/Makefile.in0000644000573500001440000000431510564200552017463 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - foreach module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:10 $ # Description : Makefile for foreach module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = @srcdir@ datarootdir = @datarootdir@ moduledir = @moduledir@ # top level of test build directory TESTBUILD = @top_builddir@/testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=@echo@ DIFF=@diff@ RM=@rm@ INSTALL=@INSTALL@ test: @$(ECHO) ----------- Testing foreach.pm ------------ $(TESTFILEPP) -m foreach.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/foreach.pm $(moduledir) clean: $(RM) test.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/foreach/README0000644000573500001440000000236310566651512016307 0ustar darrenusers foreach - A simple foreach loop for filepp This is a filepp module which implements a simple foreach loop. It adds three keywords: #foreach MACRO LIST #endforeach #foreachdelim /delim/ There is a simple test file included with this module. To test the foreach module use the following command (the file "test" is in this directory): filepp -m foreach.pm test.in For full documentation on how to use filepp and the foreach module read the filepp man page. Copyright (C) 2000-2007 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Comments are welcome. - Darren Miller ./filepp-1.8.0/modules/foreach/foreach.1.in0000644000573500001440000000573207561320275017530 0ustar darrenusers.\" Hey Emacs! This file is -*- nroff -*- source. .\" __FILEPP_INPUT__ version __VERSION__ .\" 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. .\" .SH FOREACH MODULE - foreach.pm The foreach module implements a simple foreach loop. Its file name is \fBforeach.pm\fP. .PP The foreach loop is similar in functionality to that of other programming languages such as Perl. It takes a list of values separated by a user definable delimiter (',' by default). It then iterates through all values in the list, defining a macro to be each individual value for each iteration of the loop. The loop terminates when all values have been used. .PP The foreach module implements the following keywords: .TP .BR #foreach " \fImacro\fP \fIlist\fP" The \fB#foreach\fP keyword is functionally equivalent to the following Perl style loop: foreach \fImacro\fP (split(/\fIdelim\fP/, \fIlist\fP)) The \fB#foreach\fP keyword requires the following space separated parameters: \fImacro\fP : The name of the macro to which the foreach loop should assign the current list value. \fIlist\fP : The list of values, separated by \fIdelim\fP (see \fB#foreachdelim\fP keyword for how to set \fIdelim\fP). \fIlist\fP can also be a macro or contain macros. The loop will run from the \fB#foreach\fP keyword to the next \fB#endforeach\fP keyword. .TP .BR #endforeach The \fB#endforeach\fP keyword is used to signify the end of the loop. Everything within the opening \fB#foreach\fP and the closing \fB#endforeach\fP will be processed on each iteration of the loop. .PP Example usage: \fB#foreach\fP VALUE one, two, three, four VALUE \fB#endforeach\fP In the above example VALUE will be defined to have values one, two, three and four for each successive iteration through the loop. Nested loops are also possible. .PP .TP .BR #foreachdelim " /\fIdelim\fP/" The \fB#foreachdelim\fP keyword is used to set the delimiter used in each list. The delimiter can be any character, string or regular expression. The delimiter should be enclosed in forward slashes, in the same style as Perl regular expressions. The default value for \fIdelim\fP is ','. To set the delimiter to be a single space do: \fB#foreachdelim\fP / / To set \fIdelim\fP to be any amount of white space do: \fB#foreachdelim\fP /\\s\+/ See the Perl documentation on regular expressions for more advanced uses. ./filepp-1.8.0/modules/foreach/foreach.pm0000644000573500001440000001463110565635306017377 0ustar darrenusers######################################################################## # # foreach 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. # ######################################################################## # # Project : File Preprocessor - foreach loop module # Filename : $RCSfile: foreach.pm,v $ # Author : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.8 $ # Last changed : $Date: 2007/02/17 17:26:30 $ # Description : Implements a simple foreach loop # Licence : GNU copyleft # ######################################################################## # THIS IS A FILEPP MODULE, YOU NEED FILEPP TO USE IT!!! # usage: filepp -m foreach.pm ######################################################################## package Foreach; use strict; # version number of module my $VERSION = '1.1.0'; # uses grab module require "grab.pm"; # delimiter used to split list my $delim = "\\s*,\\s*"; # contains foreach structure: # $line = line foreach loop started # $macro = macro defined by foreach # @Values = list of values macro should be defined to my @Foreachloops = (); # set when end of foreach loop reached which did not evaluate to true # foreach first loop, at this point parsing skips to end foreachloop. # If they are inner loops the inner foreach is skipped, but the inner # endforeach is not leading to more endforeach's than foreach's. This # flag says it is ok to ignore them. my $ignore_end = 0; ############################################################################## # foreachdelim keyword, allows user to set list delimiter, input: # /delimiter/ ############################################################################## sub ForeachDelim { my $newdelim = shift; # remove initial / $newdelim =~ s/\A\s*\///; # remove final / $newdelim =~ s/\/\s*\Z//; $delim = $newdelim; Filepp::Debug("Foreach: set delimiter to <$delim>"); } Filepp::AddKeyword("foreachdelim", "Foreach::ForeachDelim"); ############################################################################## # foreach keyword, input: # macro start comparison end increment # loop of foreachm: # foreach(macro, @List) # ops # endforeach ############################################################################## sub Foreach { my $input = shift; # split up line my $macro; my $list; my $i; # find end of macroword - assume separated by space or tab $i = Filepp::GetNextWordEnd($input); # separate macro and defn (can't use split, doesn't work with '0') $macro = substr($input, 0, $i); $list = substr($input, $i); # strip leading whitespace from $val if($list) { $list =~ s/^[ \t]*//; } $list = Filepp::RunProcessors($list); # split up list my @List = split(/$delim/, $list); Filepp::Debug("Foreach: $macro, /$delim/, $list\n"); my $line = 0; if(Filepp::Ifdef("__LINE__")) { $line = Filepp::ReplaceDefines("__LINE__"); } # add data structure to current foreach list my @ThisForeach = ($line, $macro, @List); push(@Foreachloops, \@ThisForeach); # foreach loop ok, set up data structure and go if($#List >= 0) { Filepp::Debug("Foreach: $macro loop started"); # in a valid foreach loop, make sure all endforeach's are # treated as valid $ignore_end = 0; # grab all input up to corresponding endforeach keyword Grab::StartGrab("foreach", "endforeach"); # in foreach loop - return 1 to Parse return 1; } # have not entered loop, be ready foreach excess endforeach's $ignore_end = 1; # foreach loop comparison failed, skip to endforeach - return 0 to Parse Filepp::Debug("Foreach: $macro loop not entered"); return 0; } ############################################################################## # add foreach keyword - also an ifword ############################################################################## Filepp::AddKeyword("foreach", "Foreach::Foreach"); Filepp::AddIfword("foreach"); ############################################################################## # endforeach keyword # no input, used to terminate foreachloop ############################################################################## sub EndForeach { # check endforeach is at a valid position - otherwise ignore it # (filepp will give an error if it is out of place) if($#Foreachloops < 0) { return 1; } # pop current foreach loop info off top of list my @ThisForeach = @{pop(@Foreachloops)}; my ($line, $macro, @List) = @ThisForeach; # get grabbed input from grab moudule my @Input = Grab::GetInput(); # get line number (add 1 coz first_line is for #foreach keyword) my $first_line = Grab::GetInputLine() + 1; my $real_line = Filepp::ReplaceDefines("__LINE__"); # run loop for each value in list my $val; foreach $val (@List) { # fix line number my $line = $first_line; Filepp::Define("$macro $val"); Filepp::Debug("Foreach: $macro loop continuing with value $val"); # parse all input between start and end of loop my $input; foreach $input (@Input) { Filepp::Redefine("__LINE__", $line++); Filepp::ProcessLine($input); } } Filepp::Redefine("__LINE__", $real_line); # end of loop, return 1 to Parse so it moves on Filepp::Debug("Foreach: $macro loop end"); return 1; } ############################################################################## # add foreach keyword - also an endif word ############################################################################## Filepp::AddKeyword("endforeach", "Foreach::EndForeach"); Filepp::AddEndifword("endforeach"); return 1; ######################################################################## # End of file ######################################################################## ./filepp-1.8.0/modules/foreach/test.good0000644000573500001440000000041007701050744017244 0ustar darrenusersthis that yet more variables several at once Start yet more variables End one two three four outone : inone outone : intwo outone : inthree outtwo : inone outtwo : intwo outtwo : inthree outthree : inone outthree : intwo outthree : inthree ./filepp-1.8.0/modules/foreach/test.in0000644000573500001440000000077207704477747016760 0ustar darrenusers#define LIST yet, more, variables #foreach VALUE this, that, LIST, several at once VALUE #endforeach Start #foreach VALUE LIST VALUE #endforeach End #comment Set delimiter to any amount of white space #foreachdelim /\s+/ #define LIST one two three four #foreach VALUE LIST VALUE #endforeach #foreach OUTER outone outtwo outthree #foreach INNER inone intwo inthree OUTER __TAB__: INNER #endforeach #endforeach #if 0 #foreach OUTER outone outtwo outthree OUTER __TAB__: INNER #endforeach #endif ./filepp-1.8.0/modules/foreach/Makefile0000644000573500001440000000433310571107107017056 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - foreach module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:10 $ # Description : Makefile for foreach module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = . datarootdir = ${prefix}/share moduledir = /usr/local/share/filepp/modules # top level of test build directory TESTBUILD = ../../testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=echo DIFF=diff RM=rm -fr INSTALL=/usr/bin/install -c test: @$(ECHO) ----------- Testing foreach.pm ------------ $(TESTFILEPP) -m foreach.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/foreach.pm $(moduledir) clean: $(RM) test.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/format/0000755000573500001440000000000010571107107015274 5ustar darrenusers./filepp-1.8.0/modules/format/Makefile.in0000644000573500001440000000431110564200553017341 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - format module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:11 $ # Description : Makefile for format module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = @srcdir@ datarootdir = @datarootdir@ moduledir = @moduledir@ # top level of test build directory TESTBUILD = @top_builddir@/testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=@echo@ DIFF=@diff@ RM=@rm@ INSTALL=@INSTALL@ test: @$(ECHO) ----------- Testing format.pm ------------- $(TESTFILEPP) -m format.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/format.pm $(moduledir) clean: $(RM) test.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/format/README0000644000573500001440000000241310566651513016165 0ustar darrenusers format - Text formatting functions This is a filepp module which allows formatting of text strings and numbers using the Perl printf function. The module provides a set of macros which will format their input strings and return the formatted output. There is a simple test file included with this module. To test the format module use the following command : filepp -m format.pm test.in For full documentation on how to use filepp and the format module read the filepp man page. Copyright (C) 2000-2007 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Comments are welcome. - Darren Miller ./filepp-1.8.0/modules/format/format.1.in0000644000573500001440000000406107360053110017250 0ustar darrenusers.\" Hey Emacs! This file is -*- nroff -*- source. .\" __FILEPP_INPUT__ version __VERSION__ .\" 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. .\" .SH FORMAT MODULE - format.pm This module provides a set of macros for formating strings and numbers. .PP The format module provides the following macros: .TP .BR "printf(format, arg1, arg2, ...)" The \fBprintf\fP macro behaves in the same way as the Perl/C function printf. It takes in a format string followed by a list of arguments to print. See the \fBprintf\fP(3) man page or Perl documentation for full details of the \fBprintf\fP function. .TP .BR "toupper(string)" Converts input string to upper case. .TP .BR "toupperfirst(string)" Converts first character of input string to upper case. .TP .BR "tolower(string)" Converts input string to lower case. .TP .BR "tolowerfirst(string)" Converts first character of input string to lower case. .TP .BR "substr(string, offset, length)" Extracts a substring from input \fIstring\fP. \fBsubstr\fP behaves in the same way as the Perl substr function. \fIoffset\fP is used to specifiy the first character of the string to output (negative for offset from end of string), \fIlength\fP is the length of the string to output. If length is omitted everything from the offset is returned. For further information on \fBsubstr\fP see the Perl documentation. .PP The format macros are implemented using the \fBfunction.pm\fP module. ./filepp-1.8.0/modules/format/format.pm0000644000573500001440000001213007416140100017111 0ustar darrenusers######################################################################## # # format 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. # ######################################################################## # # Project : File Preprocessor - format module # Filename : $RCSfile: format.pm,v $ # Author : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.6 $ # Last changed : $Date: 2002/01/06 21:23:12 $ # Description : This implements text formatting routines # Licence : GNU copyleft # ######################################################################## # THIS IS A FILEPP MODULE, YOU NEED FILEPP TO USE IT!!! # usage: filepp -m format.pm ######################################################################## package Format; use strict; # version number of module my $VERSION = '1.0.0'; require "function.pm"; ############################################################################## # CleanStartEnd($sline) - strip leading whitespace from start and end of # $sline ############################################################################## sub CleanStartEnd { my $sline = shift; for($sline) { # '^' = start of line, '\s+' means all whitespace, replace with nothing s/^\s+//; # '$' = end of line, '\s+' means all whitespace, replace with nothing s/\s+$//m; } return $sline; } ######################################################################## # Similar to C and Perl printf statement # usage: printf(format, items...) ######################################################################## sub Printf { my @Args = reverse(@_); my $arg; # remove double quotes from input args if there foreach $arg (@Args) { # remove "" from start/end of strings if($arg =~ /\A\s*\"/ && $arg =~ /\"\s*\Z/) { $arg = CleanStartEnd($arg); $arg = Filepp::Strip($arg, "\"", 1); } } my $format = pop(@Args); # replace \n, \t etc with newline, tab, etc. # HELP: there must be a better way than this, I've tried qq/$foramt/, # regexps $format =~ s/\\(.)/"\\$1"/eg etc. # and this only working solution I have found. $format =~ s/\\t/"\t"/ge; # tab $format =~ s/\\n/"\n"/ge; # newline $format =~ s/\\r/"\r"/ge; # return $format =~ s/\\f/"\f"/ge; # formfeed $format =~ s/\\b/"\b"/ge; # backspace $format =~ s/\\a/"\a"/ge; # alarm $format =~ s/\\e/"\e"/ge; # escape return sprintf($format, reverse(@Args)); } Function::AddFunction("printf", "Format::Printf"); ######################################################################## # converts input to upper case # usage: toupper(string) ######################################################################## sub ToUpper { my $string = shift; return uc($string); } Function::AddFunction("toupper", "Format::ToUpper"); ######################################################################## # converts first char of input to upper case # usage: toupper(string) ######################################################################## sub ToUpperFirst { my $string = shift; return ucfirst($string); } Function::AddFunction("toupperfirst", "Format::ToUpperFirst"); ######################################################################## # converts input to lower case # usage: tolower(string) ######################################################################## sub ToLower { my $string = shift; return lc($string); } Function::AddFunction("tolower", "Format::ToLower"); ######################################################################## # converts first char of input to lower case # usage: tolower(string) ######################################################################## sub ToLowerFirst { my $string = shift; return lcfirst($string); } Function::AddFunction("tolowerfirst", "Format::ToLowerFirst"); ######################################################################## # extract a substring out of input # usage: substr(string, offset, len) ######################################################################## sub Substr { my $string = shift; my $offset = shift; if($#_ >= 0) { # also got length arg my $length = shift; return substr($string, $offset, $length); } return substr($string, $offset); } Function::AddFunction("substr", "Format::Substr"); return 1; ######################################################################## # End of file ######################################################################## ./filepp-1.8.0/modules/format/test.good0000644000573500001440000000173007701050744017133 0ustar darrenusersEscape sequences: tab: : newline: : return: : formfeed: : backspace:: alarm:: escape:: backslash:\: double quote:": Numbers, strings and chars: % a percent sign 2 a character with the given number This is a string, "a very good string" a string -3 a signed integer, in decimal 3 an unsigned integer, in decimal 11 an unsigned integer, in octal 11 an unsigned integer, in hexadecimal 3.141000e+00 a floating-point number, in scientific notation 3.141000 a floating-point number, in fixed decimal notation 3.141 a floating-point number, in best notation decimal: 3, float: 4.000000 decimal padded: 003, float precision: 4.00 Special chars in strings: Can't work Can't work, won't work Open bracket( Open bracket( and close bracket) Open bracket( and close bracket) "macro's gone" (ba"n)'(a"nas) Case: CONVERT ME TO UPPER CASE convert me to lower case CoNvErT My FiRsT cHaR tO uPpPeR cAsE coNvErT My FiRsT cHaR tO lOwEr CaSe Substing: st string test s st str ./filepp-1.8.0/modules/format/test.in0000644000573500001440000000261007704477747016632 0ustar darrenusersEscape sequences: printf("tab:\t:") printf("newline:\n:") printf("return:\r:") printf("formfeed:\f:") printf("backspace:\b:") printf("alarm:\a:") printf("escape:\e:") printf("backslash:\\:") printf("double quote:\":") Numbers, strings and chars: printf("%% \t a percent sign") printf("%c \t a character with the given number", 50) printf("%s \t a string", "This is a string, \"a very good string\"") printf("%d \t a signed integer, in decimal", -3) printf("%u \t an unsigned integer, in decimal", 3) printf("%o \t an unsigned integer, in octal", 9) printf("%x \t an unsigned integer, in hexadecimal", 17) printf("%e \t a floating-point number, in scientific notation", 3.141) printf("%f \t a floating-point number, in fixed decimal notation", 3.141) printf("%g \t a floating-point number, in best notation", 3.141) printf("decimal: %d, float: %f", 3.141, 4) printf("decimal padded: %03d, float precision: %0.2f", 3.141, 4) Special chars in strings: printf("Can't work") printf("Can't work, won't work") printf("Open bracket(") printf("Open bracket( and close bracket)") printf("Open bracket( and close bracket)") printf("macro's gone" (ba"n)'(a"nas)) Case: toupper(CoNvErT Me To UpPeR cAsE) tolower(CoNvErT Me To LoWeR cAsE) toupperfirst(coNvErT My FiRsT cHaR tO uPpPeR cAsE) tolowerfirst(CoNvErT My FiRsT cHaR tO lOwEr CaSe) Substing: substr(test string, 2) substr(test string, 0, 6) substr(test string, 2, 6) ./filepp-1.8.0/modules/format/Makefile0000644000573500001440000000432710571107107016742 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - format module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:11 $ # Description : Makefile for format module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = . datarootdir = ${prefix}/share moduledir = /usr/local/share/filepp/modules # top level of test build directory TESTBUILD = ../../testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=echo DIFF=diff RM=rm -fr INSTALL=/usr/bin/install -c test: @$(ECHO) ----------- Testing format.pm ------------- $(TESTFILEPP) -m format.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/format.pm $(moduledir) clean: $(RM) test.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/function/0000755000573500001440000000000010571107107015631 5ustar darrenusers./filepp-1.8.0/modules/function/Makefile.in0000644000573500001440000000435010564200554017702 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - function module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:12 $ # Description : Makefile for function module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = @srcdir@ datarootdir = @datarootdir@ moduledir = @moduledir@ # top level of test build directory TESTBUILD = @top_builddir@/testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=@echo@ DIFF=@diff@ RM=@rm@ INSTALL=@INSTALL@ test: @$(ECHO) ----------- Testing function.pm ------------- $(TESTFILEPP) -m function.pm -m $(srcdir)/test.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/function.pm $(moduledir) clean: $(RM) test.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/function/README0000644000573500001440000000307710566651514016532 0ustar darrenusers function - Allows macros to run Perl functions This is a filepp module which allows macros to call Perl functions. The module adds the keywords: #function macro function which tells filepp to call "function" when it finds "macro(args)" in a file Wherever macro(args) is found in the file being processed, it will call function(args) and replace macro(args) with the value returned by function(args). #rmfunction macro which tells filepp to remove "macro" and its associated "function" There is a simple test file included with this module. To test the function module use the following command (the filed "test" and "test.pm" are in this directory): filepp -m function.pm -m test.pm test.in For full documentation on how to use filepp and the function module read the filepp man page. Copyright (C) 2000-2007 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Comments are welcome. - Darren Miller ./filepp-1.8.0/modules/function/function.1.in0000644000573500001440000000470407360072304020154 0ustar darrenusers.\" Hey Emacs! This file is -*- nroff -*- source. .\" __FILEPP_INPUT__ version __VERSION__ .\" 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. .\" .SH FUNCTION MODULE - function.pm The function module allows the user write macros which call Perl functions. Its file name is \fBfunction.pm\fP. .PP The function module allows macros of the form: \fImacro(arg1, arg2, arg3, ...)\fP to be added to a file. When the macro is found, it will run a function from a Perl module, with arguments \fIarg1\fP, \fIarg2\fP, \fIarg3\fP, \fI...\fP passed to the function. The function must return a string. The returned string will replace the call to the function in the output. The function can have any number of arguments. If the function has no arguments it should be called with an empty argument list: \fImacro()\fP If the word \fImacro\fP is found in the input file without being followed by a \fI(\fP it will be ignored. .PP To use the function module, the user must provide a Perl function which optionally takes in arguments and returns a string. The function can either be one of filepp's internal functions or one of the user's own provided in a Perl module. The function can be added in two ways. The first way is through the \fBfunction\fP keyword: .TP .BR #function " \fImacro\fP \fIfunction\fP" \fImacro\fP is the name of the macro which is used to signify a call to the function in the input file and \fIfunction\fP is the name of the function to be called. .PP The second method of adding a function is to call the Perl function: .TP .BR Function::AddFunction(\fI$macro\fP, \fI$function\fP) which has the same inputs as the \fBfunction\fP keyword. .PP Functions can be removed either through the keyword: .TP .BR #rmfunction " \fImacro\fP" or through the Perl function .TP .BR Function::RemoveFunction(\fI$macro\fP) ./filepp-1.8.0/modules/function/function.pm0000644000573500001440000000667610565253600020036 0ustar darrenusers######################################################################## # # function 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. # ######################################################################## # # Project : File Preprocessor - function module # Filename : $RCSfile: function.pm,v $ # Author : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.6 $ # Last changed : $Date: 2007/02/16 07:04:32 $ # Description : This module adds the function keyword which allows you # to have macros which call Perl functions # being replaces # Licence : GNU copyleft # ######################################################################## # THIS IS A FILEPP MODULE, YOU NEED FILEPP TO USE IT!!! # usage: filepp -m function.pm ######################################################################## package Function; use strict; # version number of module my $VERSION = '1.1.0'; ######################################################################## # AddFunction(macro, function) # adds a function to list, inputs: # macro: macro which will call function # function: function to call when macro found ######################################################################## sub AddFunction { my ($macro, $function) = @_; Filepp::Define($macro."(...)"); Filepp::SetDefineFuncs($macro, $function); Filepp::Debug("Function: added function macro $macro which calls $function"); } ######################################################################## # Function($string) # keyword frontend to AddFunction ######################################################################## sub Function { my $input = shift; my ($macro, $function) = split(/\s+/, $input, 2); AddFunction($macro, $function); } Filepp::AddKeyword("function", "Function::Function"); ############################################################################## # RemoveFunction(macro) # macro is deleted from list, all occurrences of macro found in # document are ignored. ############################################################################## sub RemoveFunction { my $macro = shift; Filepp::Undef($macro); Filepp::Debug("Function: removed function macro $macro"); } ######################################################################## # Rmunction($string) # keyword frontend to RemoveFunction ######################################################################## sub Rmfunction { my $input = shift; my ($macro) = split(/\s+/, $input, 1); RemoveFunction($macro); } Filepp::AddKeyword("rmfunction", "Function::Rmfunction"); return 1; ######################################################################## # End of file ######################################################################## ./filepp-1.8.0/modules/function/test.good0000644000573500001440000000057707701050744017500 0ustar darrenusersi should be lowercase Normal: I SHOULD BE UPPERCASE :Normal Start "i should be lowercase", End The word tolower should be in this sentance because it isn't followed by (args) tolower(Nothing should happen because tolower has been removed) Multiple inputs: Multiple inputs: <"OOH, UPPERCASE TWO!"> ./filepp-1.8.0/modules/function/test.in0000644000573500001440000000076407704477747017177 0ustar darrenuserstolower(I SHOULD BE LOWERCASE) #function toupper Test::ToUpper Normal: toupper(i should be uppercase) :Normal Start "tolower(toupper(I Should Be Lowercase))", End The word tolower should be in this sentance because it isn't followed by (args) #rmfunction tolower tolower(Nothing should happen because tolower has been removed) #function multi Test::MultiInputs multi(this, that, the other) multi(one, toupper("ooh, uppercase two!"), three, four, five) ./filepp-1.8.0/modules/function/test.pm0000644000573500001440000000375007332345253017162 0ustar darrenusers######################################################################## # # this file 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. # ######################################################################## # # Project : File Preprocessor - toupper module # Filename : $RCSfile: test.pm,v $ # Author : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2001/08/02 21:48:27 $ # Description : This module converts all letters to upper case. # Licence : GNU copyleft # ######################################################################## # THIS IS A FILEPP MODULE, YOU NEED FILEPP TO USE IT!!! # usage: filepp -m toupper.pm ######################################################################## package Test; use strict; require "function.pm"; sub ToUpper { my $string = shift; return uc($string); } sub ToLower { my $string = shift; return lc($string); } Function::AddFunction("tolower", "Test::ToLower"); sub MultiInputs { my $arg; my $output = "Multiple inputs: "; foreach $arg (@_) { $output = $output."<$arg> "; } return $output; } return 1; ######################################################################## # End of file ######################################################################## ./filepp-1.8.0/modules/function/Makefile0000644000573500001440000000436610571107107017302 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - function module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:12 $ # Description : Makefile for function module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = . datarootdir = ${prefix}/share moduledir = /usr/local/share/filepp/modules # top level of test build directory TESTBUILD = ../../testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=echo DIFF=diff RM=rm -fr INSTALL=/usr/bin/install -c test: @$(ECHO) ----------- Testing function.pm ------------- $(TESTFILEPP) -m function.pm -m $(srcdir)/test.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/function.pm $(moduledir) clean: $(RM) test.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/grab/0000755000573500001440000000000010571107107014717 5ustar darrenusers./filepp-1.8.0/modules/grab/Makefile.in0000644000573500001440000000430210564200554016765 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - grab module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.2 $ # Last changed : $Date: 2007/02/13 00:08:12 $ # Description : Makefile for grab module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = @srcdir@ datarootdir = @datarootdir@ moduledir = @moduledir@ # top level of test build directory TESTBUILD = @top_builddir@/testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=@echo@ DIFF=@diff@ RM=@rm@ INSTALL=@INSTALL@ test: @$(ECHO) ----------- Testing grab.pm ---------------- $(TESTFILEPP) -m grab.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/grab.pm $(moduledir) clean: $(RM) test.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/grab/grab.1.in0000644000573500001440000000412410571106012016314 0ustar darrenusers.\" Hey Emacs! This file is -*- nroff -*- source. .\" __FILEPP_INPUT__ version __VERSION__ .\" 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. .\" .SH GRAB MODULE - grab.pm The grab module is used to grab input before processing. Its file name is \fBgrab.pm\fP. .PP The grab module is mainly for use in other modules, such as for.pm and bigfunc.pm. It grabs all input from a file before any processing is done on it. This allows other modules to do processing on the original input data before the main processing is done. For example, the for module will store the original input inside a loop and re-use it each time the loop is processed. .TP .BR #grab " \fImacro\fP \fIdefinition...\fP" The grab module will start grabbing of all input from the grab keyword, onwards. .TP .BR #endgrab Ends a grab. Everything between this keyword and the last preceding \fB#grab\fP will be grabbed and stored for use in other modules. .PP Grabs can be nested if required. .PP When calling grab from another module, use the following functions: .TP .BR Grab::StartGrab(\fI$startkeyword\fP, \fI$endkeyword\fP) \fI$startkeyword\fP is the keyword that StartGrab is called from. \fI$endkeyword\fP is the keyword that grabbing should stop at. .TP .BR \fI@List\fP = Grab::GetInput() Returns a Perl list containing all input grabbed from when grab was last run. .TP .BR \fI$line\fP = Grab::GetInputLine() Returns the line number of the input file where grabbing last started. ./filepp-1.8.0/modules/grab/grab.pm0000644000573500001440000001353310565636765016221 0ustar darrenusers######################################################################## # # grab 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. # ######################################################################## # # Project : File Preprocessor - grab module # Filename : $RCSfile: grab.pm,v $ # Author : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.6 $ # Last changed : $Date: 2007/02/17 17:40:05 $ # Description : Grabs all input and stores it for later use # Licence : GNU copyleft # ######################################################################## # THIS IS A FILEPP MODULE, YOU NEED FILEPP TO USE IT!!! # usage: filepp -m grab.pm ######################################################################## package Grab; use strict; # version number of module my $VERSION = '1.0.0'; # list of keywords which signify start of input grabbing - entry in # hash is corresponding stop keyword: start->stop my %StartKeywords = ( 'grab' => 'endgrab' ); # list of keywords which signify end of input grabbing - entry in # hash is corresponding start keyword: stop->start my %EndKeywords = ( 'endgrab' => 'grab' ); # stack of nested keywords which start and stop input grabbing my @KeywordStack = (); # grabbed input my @Input = (); # line number grabbing started at my $line = -1; ######################################################################## # Processor which grabs all input ######################################################################## sub GrabInput { my $input = shift; # check for start/end grabbing keywords my $thisline = Filepp::CleanStart($input); my $keywordchar = Filepp::GetKeywordchar(); my $keyword = ""; if($thisline && $thisline =~ /^$keywordchar/) { # remove "#" and any following whitespace $thisline =~ s/^$keywordchar\s*//g; # check for start keyword if($thisline && $thisline =~ /^\w+\b/) { $keyword = $&; if(exists($StartKeywords{$keyword})) { push(@KeywordStack, $StartKeywords{$keyword}); Filepp::Debug("Grab: found start keyword ".$keyword. " in grabbed input - adding ". $StartKeywords{$keyword}." to stack at level ". $#KeywordStack); } elsif(exists($EndKeywords{$keyword})) { if($keyword eq $KeywordStack[$#KeywordStack]) { Filepp::Debug("Grab: found end keyword ".$keyword. " in grabbed input at stack level ". $#KeywordStack); pop(@KeywordStack); } else { Filepp::Warning("Found unexpected end keyword ".$keyword. " in grabbed input at stack level". $#KeywordStack); } } } } # check if input grabbing should stop - stops when KeywordStack empty if($#KeywordStack <= -1) { Filepp::RemoveProcessor("Grab::GrabInput"); Filepp::Debug("Grab: ended grabbing input at keyword: ".$keyword); # return keyword - will cause keyword function to run return $input; } else { # grab input push(@Input, $input); } return ""; } ######################################################################## # Start grabbing input ######################################################################## sub StartGrab { my $start = shift; # start keyword my $end = shift; # end keyword $StartKeywords{$start} = $end; $EndKeywords{$end} = $start; # make a note of line number $line = -1; if(Filepp::Ifdef("__LINE__")) { $line = Filepp::ReplaceDefines("__LINE__"); } # reset KeywordStack and Input - stops all existing grabbing @KeywordStack = ( $StartKeywords{$start} ); @Input = (); # put GrabInput processor at start of processing chain Filepp::AddProcessor("Grab::GrabInput", 1, 1); Filepp::Debug("Grab: started grabbing input from keyword: ".$start. " at line ".$line); } ######################################################################## # GetInput - returns last input grabbed ######################################################################## sub GetInput { return @Input; } ######################################################################## # GetInputLine - returns line input grab started at ######################################################################## sub GetInputLine { return $line; } ######################################################################## # Start grabbing input ######################################################################## sub Grab { StartGrab("grab", "endgrab"); } Filepp::AddKeyword("grab", "Grab::Grab"); ######################################################################## # End grabbing of input - mainly for testing ######################################################################## sub EndGrab { my $output = ""; my @ThisInput = GetInput(); my $this_line = GetInputLine() + 1; my $real_line = Filepp::ReplaceDefines("__LINE__"); my $input; foreach $input (@ThisInput) { Filepp::Redefine("__LINE__", $this_line++); Filepp::ProcessLine($input); } Filepp::Redefine("__LINE__", $real_line); } Filepp::AddKeyword("endgrab", "Grab::EndGrab"); return 1; ######################################################################## # End of file ######################################################################## ./filepp-1.8.0/modules/grab/test.good0000644000573500001440000000062310565636765016575 0ustar darrenusers2 Testing-tested Include:0<./test.in>2 3 Testing-tested Include:0<./test.in>3 4 Testing-tested Include:0<./test.in>4 6 Testing-tested Include:0<./test.in>6 7 Testing-tested Include:0<./test.in>7 8 Testing-tested Include:0<./test.in>8 10 12 Testing-tested Include:0<./test.in>12 14 Testing-tested Include:0<./test.in>14 16 Testing-tested Include:0<./test.in>16 18 Testing-tested Include:0<./test.in>18 ./filepp-1.8.0/modules/grab/test.in0000644000573500001440000000034707715543314016244 0ustar darrenusers#define Testing Testing-tested Include:__INCLUDE_LEVEL__<__FILE__>__LINE__ 2 Testing 3 Testing 4 Testing #grab 6 Testing 7 Testing 8 Testing #endgrab 10 #grab 12 Testing # grab 14 Testing # endgrab 16 Testing #endgrab 18 Testing ./filepp-1.8.0/modules/grab/Makefile0000644000573500001440000000432010571107107016356 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - grab module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.2 $ # Last changed : $Date: 2007/02/13 00:08:12 $ # Description : Makefile for grab module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = . datarootdir = ${prefix}/share moduledir = /usr/local/share/filepp/modules # top level of test build directory TESTBUILD = ../../testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=echo DIFF=diff RM=rm -fr INSTALL=/usr/bin/install -c test: @$(ECHO) ----------- Testing grab.pm ---------------- $(TESTFILEPP) -m grab.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/grab.pm $(moduledir) clean: $(RM) test.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/literal/0000755000573500001440000000000010571107107015440 5ustar darrenusers./filepp-1.8.0/modules/literal/Makefile.in0000644000573500001440000000431510564200555017513 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - literal module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:13 $ # Description : Makefile for literal module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = @srcdir@ datarootdir = @datarootdir@ moduledir = @moduledir@ # top level of test build directory TESTBUILD = @top_builddir@/testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=@echo@ DIFF=@diff@ RM=@rm@ INSTALL=@INSTALL@ test: @$(ECHO) ----------- Testing literal.pm ------------ $(TESTFILEPP) -m literal.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/literal.pm $(moduledir) clean: $(RM) test.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/literal/README0000644000573500001440000000233210566651514016332 0ustar darrenusers literal - stop macro replacement in literal strings This filepp module prevents macro replacement when macros appear in literal strings of the form "literal string" There is a simple test file included with this module. To test the for module use the following command (the file "test" is in this directory): filepp -m literal.pm test.in For full documentation on how to use filepp and the literal module read the filepp man page. Copyright (C) 2000-2007 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Comments are welcome. - Darren Miller ./filepp-1.8.0/modules/literal/literal.1.in0000644000573500001440000000251707307256004017574 0ustar darrenusers.\" Hey Emacs! This file is -*- nroff -*- source. .\" __FILEPP_INPUT__ version __VERSION__ .\" 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. .\" .SH LITERAL MODULE - literal.pm The literal module prevents macros appearing in literal strings from being replaced. A literal string is defined as having the form: \fI"literal string with\fP \fBmacro\fP \fIin"\fP In the above example, \fBmacro\fP will not be replaced. The behaviour of the literal module can be reveresed by defining the macro \fBLITERAL_REVERSE\fP before loading the module, for example: filepp -D\fBLITERAL_REVERSE\fP -m literal.pm \fI\fP This has the effect of only replacing macros which appear in strings. ./filepp-1.8.0/modules/literal/literal.pm0000644000573500001440000001146007700655524017447 0ustar darrenusers######################################################################## # # literal 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. # ######################################################################## # # Project : File Preprocessor - literal module # Filename : $RCSfile: literal.pm,v $ # Author : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.5 $ # Last changed : $Date: 2003/07/02 22:23:16 $ # Description : This module allows literal strings ("string") to # pass through filepp WITHOUT any macros in the string # being replaced # Licence : GNU copyleft # ######################################################################## # THIS IS A FILEPP MODULE, YOU NEED FILEPP TO USE IT!!! # usage: filepp -m literal.pm ######################################################################## package Literal; use strict; # version number of module my $VERSION = '1.1.1'; # flag to say if in string or not my $in_string1 = 0; # if LITERAL_REVERSE is defined, only replace macros that are in strings. if(Filepp::Ifdef("LITERAL_REVERSE")) { $in_string1 = 1; } # char to start and end literal strings with my $literal = '"'; my @Strings; my @Literal; my @Macros; # tokens used for tempoarily replacing literals my @Tokens = ('0','1','2','3','4','5','6','7','8','9', 'a','b','c','d','e','f','g','h','i','j', 'k','l','m','n','o','p','q','r','s','t', 'u','v','w','x','y','z','A','B','C','D', 'E','F','G','H','I','J','K','L','M','N', 'O','P','Q','R','S','T','U','V','W','X', 'Y','Z','_'); # get next token - converts integer into token, error if int out of range sub GetToken { my $i = shift; my $tokens = $#Tokens+1; my $count = $tokens*$tokens; if($i >= ($count*$tokens)) { Filepp::Error("literal: internal error, cannot find unused token"); } my $token = $Tokens[int($i/$count)]; if($i >= $count) { $i -= $count*(int($i/$count)); } $count /= $tokens; $token = $token.$Tokens[int($i/$count)]; if($i >= $count) { $i -= $count*(int($i/$count)); } $token = $token.$Tokens[$i]; return $token; } # replace all macros that do NOT appear in literal strings sub ReplaceDefines { my $in_string = $in_string1; my $string = shift; if($string =~ /$literal/) { # split up line into bits in quotes and bits not in quotes @Strings = @Literal = @Macros = (); while($string =~ /$literal/) { push(@Strings, $`); $string = $'; # for the sanity of emacs' push(@Literal, $in_string); if($in_string) { $in_string = 0; } else { $in_string = 1; } } # last part of line push(@Strings, $string); push(@Literal, $in_string); $string = ""; my $i; my $j = 0; for($i=0; $i<=$#Strings; $i++) { # replace all literals with a token if($Literal[$i]) { my $token = GetToken($j++); my $macro = "\e\"".$token."\"\e"; # check token not already in use while($macro ne Filepp::ReplaceDefines($macro)) { Filepp::Debug("literal: warning token ".$token. " cannot be used"); $token = GetToken($j++); $macro = "\e\"".$token."\"\e"; } Filepp::Debug("literal: using token ".$token." for ". $Strings[$i]); $string = $string.$macro; push(@Macros, $macro); } else { $string = $string.$Strings[$i]; } } # replace macros @Macros = reverse(@Macros); $string = Filepp::ReplaceDefines($string); # replace tokens with literals for($i=0; $i<=$#Strings; $i++) { if($Literal[$i]) { my $macro = pop(@Macros); my $replace = $Strings[$i]; if($i > 0) { $replace = "\"".$replace; } if($i < $#Strings) { $replace = $replace."\""; } $string =~ s/$macro/$replace/g; } } } else { # no literals in string $string = Filepp::ReplaceDefines($string); } return $string; } # remove filepp's ReplaceDefines routine and replace it with Literals. Filepp::RemoveProcessor("Filepp::ReplaceDefines"); Filepp::AddProcessor("Literal::ReplaceDefines"); return 1; ######################################################################## # End of file ######################################################################## ./filepp-1.8.0/modules/literal/test.good0000644000573500001440000000110207701050744017270 0ustar darrenusersbar "foo" bar bar"foo"bar bar "foo foof foofoo other stuff perl style multi line strings and bar " foo bar "foo" call ensure_(tonto,dim>0,"SYSTEM: dim not greater than zero") "THAT" and "THAT" _20_ "THAT" "a"b"c"d"e"f"g"h"i"j"k"l"m"n"o"p"q"r"s"t"u"v"w"x"y"z"a"b"c"d"e"f"g"h"i"j"k"l"m"n"o"p"q"r"s"t"u"v"w"x"y"z"0"AAAAAARGH_1"1"2"3"4"5"6"7"8"9"0""AAAAAA"B"C"D"E"F"G"H"I"J"K"L"M"N"O"P"Q"R"S"T"U"V"W"X"Y"Z"AAAAAA"B"C"D"E"F"G"H"I"J"K"L"M"N"O"P"Q"R"S"T"U"V"W"X"Y"Z"AAAAAARGH_100"101"AAAAAARGH_102"103"AAAAAARGH_104"105"AAAAAARGH_106"107"AAAAAARGH_108"109"AAAAAARGH_1AAAAAARGH_10" ./filepp-1.8.0/modules/literal/test.in0000644000573500001440000000135507704477750016775 0ustar darrenusers#define foo bar foo "foo" foo foo"foo"foo foo "foo foof foofoo other stuff perl style multi line strings and foo " foo foo "foo" #define 1 ARGH_1 #define A AAAAAA #define ENSURE0(X,Y) call ensure_(tonto,X,Y) #define ENSURE(X,Y) ENSURE0(X,Y) #define SYSTEM type(system_type) ENSURE(dim>0, "SYSTEM: dim not greater than zero") #define THIS(AA, BB) AA and BB #define THAT tester #define "THAT" real tester THIS("THAT", "THAT") ___LINE___ "THAT" "a"b"c"d"e"f"g"h"i"j"k"l"m"n"o"p"q"r"s"t"u"v"w"x"y"z"a"b"c"d"e"f"g"h"i"j"k"l"m"n"o"p"q"r"s"t"u"v"w"x"y"z"0"1"1"2"3"4"5"6"7"8"9"0""A"B"C"D"E"F"G"H"I"J"K"L"M"N"O"P"Q"R"S"T"U"V"W"X"Y"Z"A"B"C"D"E"F"G"H"I"J"K"L"M"N"O"P"Q"R"S"T"U"V"W"X"Y"Z"100"101"102"103"104"105"106"107"108"109"110" ./filepp-1.8.0/modules/literal/Makefile0000644000573500001440000000433310571107107017103 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - literal module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:13 $ # Description : Makefile for literal module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = . datarootdir = ${prefix}/share moduledir = /usr/local/share/filepp/modules # top level of test build directory TESTBUILD = ../../testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=echo DIFF=diff RM=rm -fr INSTALL=/usr/bin/install -c test: @$(ECHO) ----------- Testing literal.pm ------------ $(TESTFILEPP) -m literal.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/literal.pm $(moduledir) clean: $(RM) test.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/maths/0000755000573500001440000000000010571107107015120 5ustar darrenusers./filepp-1.8.0/modules/maths/Makefile.in0000644000573500001440000000430510564200556017173 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - maths module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:14 $ # Description : Makefile for maths module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = @srcdir@ datarootdir = @datarootdir@ moduledir = @moduledir@ # top level of test build directory TESTBUILD = @top_builddir@/testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=@echo@ DIFF=@diff@ RM=@rm@ INSTALL=@INSTALL@ test: @$(ECHO) ----------- Testing maths.pm -------------- $(TESTFILEPP) -m maths.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/maths.pm $(moduledir) clean: $(RM) test.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/maths/README0000644000573500001440000000250110566651515016011 0ustar darrenusers maths - A simple maths library done as a filepp module This is a filepp module which allows calls the the maths library. The module provides a set of macros which perform mathematical operations. When the macros are encoutered in an input file, they are evaluated and the result is returned in the output. There is a simple test file included with this module. To test the maths module use the following command : filepp -m maths.pm test.in For full documentation on how to use filepp and the maths module read the filepp man page. Copyright (C) 2000-2007 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Comments are welcome. - Darren Miller ./filepp-1.8.0/modules/maths/maths.1.in0000644000573500001440000000430107360053110016715 0ustar darrenusers.\" Hey Emacs! This file is -*- nroff -*- source. .\" __FILEPP_INPUT__ version __VERSION__ .\" 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. .\" .SH MATHS MODULE - maths.pm The module provides a set of macros which perform mathematical operations. When the macros are encoutered in an input file, they are evaluated and the result is returned in the output. .PP The maths module includes the following macros: .TP .BR "add(a, b, c, ...)" Takes in any number of arguments and returns their sum: (a + b + c + ...) .TP .BR "sub(a, b)" Returns a minus b: (a - b) .TP .BR "mul(a, b, c, ...)" Takes in any number of arguments and returns their product: (a * b * c * ...) .TP .BR "div(a, b)" Returns a over b: (a / b) .TP .BR "abs(a)" Returns the absoulte value of a. .TP .BR "atan2(a, b)" Returns the arctangent of a/b in the range -pi to pi. .TP .BR "cos(a)" Returns the cosine of a in radians. .TP .BR "exp(a)" Returns the e to the power of a. .TP .BR "int(a)" Returns the integer portion of a. .TP .BR "log(a)" Returns the natural logarithm (base e) of a. .TP .BR "rand(a)" Returns a random fractional number between the range 0 and a. If a is omitted, returns a value between 0 and 1. .TP .BR "sin(a)" Returns the sine of a in radians. .TP .BR "sqrt(a)" Returns the square root of a. .TP .BR "srand(a)" Sets the random number seed for rand(). .PP The maths module also defines pi as M_PI as e as M_E. .PP The maths macros are implemented using the \fBfunction.pm\fP module. Nested macros are allowed, as is passing other macros with numerical defintions as arguments. ./filepp-1.8.0/modules/maths/maths.pm0000644000573500001440000001441307345252006016601 0ustar darrenusers######################################################################## # # maths 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. # ######################################################################## # # Project : File Preprocessor - maths module # Filename : $RCSfile: maths.pm,v $ # Author : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2001/09/04 22:21:58 $ # Description : This implements simple maths routines # Licence : GNU copyleft # ######################################################################## # THIS IS A FILEPP MODULE, YOU NEED FILEPP TO USE IT!!! # usage: filepp -m maths.pm ######################################################################## package Maths; use strict; # version number of module my $VERSION = '1.0.0'; require "function.pm"; ######################################################################## # Define Pi as M_PI ######################################################################## Filepp::Define("M_PI 3.14159265358979323846"); Filepp::Define("M_E 2.7182818284590452354"); ######################################################################## # Add all input, usage: - ANY NUMBER OF INPUTS # Add(a, b, ....) ######################################################################## sub Add { my $sum = 0; my $arg; foreach $arg (@_) { $sum += $arg; } return $sum; } Function::AddFunction("add", "Maths::Add"); ######################################################################## # Multiply all inputs, usage: - ANY NUMBER OF INPUTS # Mul(a, b, ....) ######################################################################## sub Mul { my $mul = 1; my $arg; foreach $arg (@_) { $mul *= $arg; } return $mul; } Function::AddFunction("mul", "Maths::Mul"); ######################################################################## # Subtract b from a, usage: - TWO INPUTS ONLY # Sub(a, b) ######################################################################## sub Sub { my ($a, $b) = @_; return $a - $b; } Function::AddFunction("sub", "Maths::Sub"); ######################################################################## # Divide a/b, usage: - TWO INPUTS ONLY # Div(a, b) ######################################################################## sub Div { my ($a, $b) = @_; return $a / $b; } Function::AddFunction("div", "Maths::Div"); ######################################################################## # Abs(a) - returns the absoulte value of a # Abs(a, b) ######################################################################## sub Abs { my $a = shift; return abs($a); } Function::AddFunction("abs", "Maths::Abs"); ######################################################################## # Atan2 arctangent of a/b, usage: - TWO INPUTS ONLY # Atan2(a, b) ######################################################################## sub Atan2 { my ($a, $b) = @_; return atan2($a, $b); } Function::AddFunction("atan2", "Maths::Atan2"); ######################################################################## # Cos(a) - returns the cosine value of a # Cos(a) ######################################################################## sub Cos { my $a = shift; return cos($a); } Function::AddFunction("cos", "Maths::Cos"); ######################################################################## # Exp(a) - returns the exponential value of a # Exp(a) ######################################################################## sub Exp { my $a = shift; return exp($a); } Function::AddFunction("exp", "Maths::Exp"); ######################################################################## # Int(a) - returns the integer value of a # Int(a) ######################################################################## sub Int { my $a = shift; return int($a); } Function::AddFunction("int", "Maths::Int"); ######################################################################## # Log(a) - returns the logarithm value of a # Log(a) ######################################################################## sub Log { my $a = shift; return log($a); } Function::AddFunction("log", "Maths::Log"); ######################################################################## # Rand(a) - returns a random fractional number in range 0 to a, # if a is ommitted, number is in range 0 to 1 # Rand(a) ######################################################################## sub Rand { if($_[0]) { return rand($_[0]); } return rand(); } Function::AddFunction("rand", "Maths::Rand"); ######################################################################## # Sin(a) - returns the sine value of a # Sin(a) ######################################################################## sub Sin { my $a = shift; return sin($a); } Function::AddFunction("sin", "Maths::Sin"); ######################################################################## # Sqrt(a) - returns the square root value of a # Sqrt(a) ######################################################################## sub Sqrt { my $a = shift; return sqrt($a); } Function::AddFunction("sqrt", "Maths::Sqrt"); ######################################################################## # Srand(a) - seeds random number generator with a # Srand(a) ######################################################################## sub Srand { if($_[0]) { srand($_[0]); } else { srand(); } return ""; } Function::AddFunction("srand", "Maths::Srand"); return 1; ######################################################################## # End of file ######################################################################## ./filepp-1.8.0/modules/maths/test.good0000644000573500001440000000252707701050745016765 0ustar darrenusersAdd: 1 + 2 = 3 (should be 3) -3 + 4 + 5 + -6 = 0 (should be 0) 3.2 + 1.47 + 6.3999 = 11.0699 (should be 11.0699) Subtract: 1 - 2 = -1 (should be -1) 10 - -4 = 14 (should be 14) 3.4 - 0.02 = 3.38 (should be 3.38) Multiply: 2 * 4 = 8 (should be 8) -4 * 6 * 3 = -72 (should be -72) 1.5 * 3.2 = 4.8 (should be 4.8) Divide: 8 / 4 = 2 (should be 2) -6 / 2 = -3 (should be -3) 4.5 / 1.8 = 2.5 (should be 2.5) Maths library: absoulte value -3.2 = 3.2 (should be 3.2) arctangent of 2.3 / 1.7 = 0.934288111006946 (should be approx 0.934) cosine of 1.047 = 0.50017107459707 (should be approx 0.5) sine of 0.523 = 0.499481355518642 (should be approx 0.5) exponential of 1.45 = 4.26311451516882 (should be approx 4.263) integer portion of 2.532 = 2 (should be 2) logarithm of 2.718 = 0.999896315728952 (should be approx 1.0) square root of 36 = 6 (should be 6) seed random number generator with 2 generate 3 random numbers: 0.912432653437467, 0.159082908972294, 0.573262780710262 seed random number generator with 2 generate 3 random numbers: 0.912432653437467, 0.159082908972294, 0.573262780710262 random number in range 0 to 10000 = 8015.06833263325 random number in range 0 to 1 = 0.553675300337165 Advanced use: 10 + 4 = 14 (should be 14) (10 + 2) * 4 = 48 (should be 48) cosine 60 * (pi/180) = 0.499999999999998 (should be 0.5) ./filepp-1.8.0/modules/maths/test.in0000644000573500001440000000272307704477750016455 0ustar darrenusersAdd: 1 + 2 = add(1, 2) (should be 3) -3 + 4 + 5 + -6 = add(-3, 4, 5, -6) (should be 0) 3.2 + 1.47 + 6.3999 = add(3.2, 1.47, 6.3999) (should be 11.0699) Subtract: 1 - 2 = sub(1, 2) (should be -1) 10 - -4 = sub (10, -4) (should be 14) 3.4 - 0.02 = sub (3.4, 0.02) (should be 3.38) Multiply: 2 * 4 = mul(2, 4) (should be 8) -4 * 6 * 3 = mul(-4, 6, 3) (should be -72) 1.5 * 3.2 = mul(1.5, 3.2) (should be 4.8) Divide: 8 / 4 = div(8, 4) (should be 2) -6 / 2 = div(-6, 2) (should be -3) 4.5 / 1.8 = div(4.5, 1.8) (should be 2.5) Maths library: absoulte value -3.2 = abs(-3.2) (should be 3.2) arctangent of 2.3 / 1.7 = atan2(2.3, 1.7) (should be approx 0.934) cosine of 1.047 = cos(1.047) (should be approx 0.5) sine of 0.523 = sin(0.523) (should be approx 0.5) exponential of 1.45 = exp(1.45) (should be approx 4.263) integer portion of 2.532 = int(2.532) (should be 2) logarithm of 2.718 = log(2.718) (should be approx 1.0) square root of 36 = sqrt(36) (should be 6) seed random number generator with 2 srand(2) generate 3 random numbers: rand(), rand(), rand() seed random number generator with 2 srand(2) generate 3 random numbers: rand(), rand(), rand() random number in range 0 to 10000 = rand(10000) random number in range 0 to 1 = rand() Advanced use: #define TEN 10 #define FOUR 4 TEN + FOUR = add(TEN, FOUR) (should be 14) (10 + 2) * 4 = mul( add(10, 2), 4) (should be 48) cosine 60 * (pi/180) = cos( mul(60, div(M_PI, 180)) ) (should be 0.5) ./filepp-1.8.0/modules/maths/Makefile0000644000573500001440000000432310571107107016562 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - maths module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:14 $ # Description : Makefile for maths module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = . datarootdir = ${prefix}/share moduledir = /usr/local/share/filepp/modules # top level of test build directory TESTBUILD = ../../testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=echo DIFF=diff RM=rm -fr INSTALL=/usr/bin/install -c test: @$(ECHO) ----------- Testing maths.pm -------------- $(TESTFILEPP) -m maths.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/maths.pm $(moduledir) clean: $(RM) test.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/regexp/0000755000573500001440000000000010571107107015276 5ustar darrenusers./filepp-1.8.0/modules/regexp/Makefile.in0000644000573500001440000000431110564200557017347 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - regexp module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:15 $ # Description : Makefile for regexp module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = @srcdir@ datarootdir = @datarootdir@ moduledir = @moduledir@ # top level of test build directory TESTBUILD = @top_builddir@/testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=@echo@ DIFF=@diff@ RM=@rm@ INSTALL=@INSTALL@ test: @$(ECHO) ----------- Testing regexp.pm ------------- $(TESTFILEPP) -m regexp.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/regexp.pm $(moduledir) clean: $(RM) test.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/regexp/README0000644000573500001440000000523410566651516016176 0ustar darrenusers regexp - simple regular expression replacement module This filepp module provides to module: regexp This module allows Perl regular expression replacements to be done with filepp. Regular expressions are defined with the regexp keyword: #regexp /regexp/replacement/ Each regular expression will be done on each line of the input files using the Perl command: $line =~ s/regexp/replacement/g; For those who don't understand Perl, this means replace all occurrences of "regexp" in the current line with "replacement". Regular expressions can be any Perl style regular expression, see the Perl documentation for more information on this or the test file included with this file for some examples. Regular expressions are evaluated in the order they are defined. A single regular expression can also be defined on the command line using the REGEXP macro, for example: filepp -DREGEXP=/regexp/replacement/ -m regexp.pm inputfile Note: the REGEXP macro must be defined BEFORE the regexp module is loaded, putting -DREGEXP... after -m regexp.pm will not work. When using the command line approach, if the REGEXP macro is sucessfully parsed as a regular expression it will be undefined from the normal filepp macro list before processing starts. Care should obviously be taken when escaping special characters in the shell with command line regexp's. Regular expressions can be removed with the rmregexp keyword as follows: #rmregexp /regexp/replacement/ In debugging mode the current list of regular expressions can be viewed using the pragma keyword: #pragma filepp ShowRegexp When not in debugging mode, this will produce no output. Examplex of regular expressions can be found in the test file in this directory. Use the command: filepp -m regexp.pm test.in to see the results of parsing the file. For full documentation on how to use filepp and the regexp module read the filepp man page. Copyright (C) 2000-2007 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Comments are welcome. - Darren Miller ./filepp-1.8.0/modules/regexp/regexp.1.in0000644000573500001440000000554307507156600017275 0ustar darrenusers.\" Hey Emacs! This file is -*- nroff -*- source. .\" __FILEPP_INPUT__ version __VERSION__ .\" 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. .\" .SH REGEXP MODULE - regexp.pm The regexp module allows Perl regular expression replacement to be done with filepp. Its file name is \fBregexp.pm\fP. .PP Perl regular expression replacement allows a regular expression to be searched for and replaced with something else. Regular expressions are defined as follows: .TP .BR #regexp " /\fIregexp\fP/\fIreplacement\fP/" It is very similar to the Perl syntax and the following Perl code will be executed on each line of the input file: .TP .BR $line " =~ s/\fIregexp\fP/\fIreplacement\fP/g" For users who don't understand Perl, this means replace all occurrences of \fIregexp\fP in the current line with \fIreplacement\fP. .PP A full description of regular expressions and possible replacements is beyond the scope of this man page. More information can be found in the Perl documentation using the command: .TP .BR perldoc " \fBperlre\fP" .PP Any number of regular expressions can be defined. Each regular expression is evaluated once for each line of the input file. Regular expressions are evaluated in the order they are defined. .PP Regular expressions can be undefined in the following way: .TP .BR #rmregexp " /\fIregexp\fP/\fIreplacement\fP/" This will remove the specified regular expression. .PP In debugging mode the current list of regular expressions can be viewed using the pragma keyword: .TP .BR #pragma " \fBfilepp\fP \fIShowRegexp\fP" When not in debugging mode, this will produce no output. .PP A single regular expression can also be defined on the command line using the \fIREGEXP\fP macro, for example: .PP filepp -D\fIREGEXP\fP=/\fIregexp\fP/\fIreplacement\fP/ -m regexp.pm inputfile .PP Note: the \fIREGEXP\fP macro must be defined BEFORE the regexp module is loaded, putting -D\fIREGEXP\fP... after -m regexp.pm will not work. When using the command line approach, if the \fIREGEXP\fP macro is successfully parsed as a regular expression it will be undefined from the normal filepp macro list before processing starts. Care should obviously be taken when escaping special characters in the shell with command line regexps. ./filepp-1.8.0/modules/regexp/regexp.pm0000644000573500001440000001211310565253601017130 0ustar darrenusers######################################################################## # # regexp 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. # ######################################################################## # # Project : File Preprocessor - regexp module # Filename : $RCSfile: regexp.pm,v $ # Author : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.8 $ # Last changed : $Date: 2007/02/16 07:04:33 $ # Description : This implements regular expression replacement routines # Licence : GNU copyleft # ######################################################################## # THIS IS A FILEPP MODULE, YOU NEED FILEPP TO USE IT!!! # usage: filepp -m regexp.pm ######################################################################## package Regexp; use strict; # version number of module my $VERSION = '1.0.2'; my @Regexp; # list of regular expressions my @Replace; # list of replacements for regular expressions ######################################################################## # Function to read regular expression ######################################################################## sub ParseRegexp { my $input = shift; my @Args= split(/((?"); return 0; } ######################################################################## # Regular expression keyword ######################################################################## sub AddRegexp { my $input = shift; my ($parseok, $regexp, $replace) = ParseRegexp($input); if($parseok) { Filepp::Debug("Regexp: Adding regexp /$regexp/$replace/"); push(@Regexp, $regexp); push(@Replace, $replace); } } Filepp::AddKeyword("regexp", "Regexp::AddRegexp"); ######################################################################## # Removes a regular expression ######################################################################## sub RmRegexp { # Note: this only removes the first occurence of the regular expression # if the regular expression is multiply defined. my $input = shift; my ($parseok, $regexp, $replace) = ParseRegexp($input); if($parseok) { my $i = 0; # find regexp while($i<=$#Regexp && !($Regexp[$i] eq $regexp && $Replace[$i] eq $replace)) { $i++; } # remove regexp if found if($i<=$#Regexp) { for(; $i<$#Regexp; $i++) { $Regexp[$i] = $Regexp[$i+1]; $Replace[$i] = $Replace[$i+1]; } Filepp::Debug("Regexp: Removed regexp /$regexp/$replace/"); pop(@Regexp); pop(@Replace); } } } Filepp::AddKeyword("rmregexp", "Regexp::RmRegexp"); ######################################################################## # Show current regexp list - only works in debug mode ######################################################################## sub ShowRegexp { Filepp::Debug("Regexp: current regular expressions:"); my $i; for($i = 0; $i <= $#Regexp; $i++) { Filepp::Debug("Regexp ".$i.":\t/".$Regexp[$i]."/".$Replace[$i]."/"); } } ######################################################################## # Regular expression replacement routine ######################################################################## sub ReplaceRegexp { my $string = shift; my $i; for($i = 0; $i <= $#Regexp; $i++) { my $regexp = Filepp::RunProcessors($Regexp[$i], 2); my $replace = Filepp::RunProcessors($Replace[$i], 2); # eval is used to make sure all \1 etc. are converted correctly my $evalstring = sprintf "\$string =~ s/$regexp/$replace/g"; Filepp::Debug("Regexp: <$evalstring> with string = <$string>", 2); eval $evalstring; Filepp::Debug("Regexp output: <$string>", 2); } return $string; } Filepp::AddProcessor("Regexp::ReplaceRegexp"); ######################################################################## # Check for command line specifiled regexp (only one allowed) ######################################################################## if(Filepp::Ifdef("REGEXP")) { my $input = Filepp::ReplaceDefines("REGEXP"); my ($parseok, $regexp, $replace) = ParseRegexp($input); if($parseok) { AddRegexp($input); Filepp::Undef("REGEXP"); } } return 1; ######################################################################## # End of file ######################################################################## ./filepp-1.8.0/modules/regexp/test.good0000644000573500001440000000115207704034775017144 0ustar darrenusersTests for regexp module: Getridofallwhitespaceonalineincludingnewline Getridofallwhitespaceonalinebutkeepnewline ChanGealllowercaseG'stouppercaseandremovewhitespace Change all multiple whitespace to single whitespace Remove all whitespace from start of line Remove all whitespace from end of line test Test of macros test regexps bar bar Reminder - regexps also work with normal #if keyword (regexp module not needed) RIGHT In comment: and other stuff // no change In comment: In comment: this is a testa this is a testb this is a testa this is a testb this is a testa this is a test /a ./filepp-1.8.0/modules/regexp/test.in0000644000573500001440000000224707704477750016634 0ustar darrenusersTests for regexp module: #regexp /\s// Get rid of all whitespace on a line including newline #regexp /$/__NEWLINE__/ Get rid of all whitespace on a line but keep newline #regexp /g/G/ Change all lowercase g's to uppercase and remove whitespace #rmregexp /\s// #rmregexp /$/__NEWLINE__/ #rmregexp /g/G/ #regexp /\s{2,}/ / Change all multiple whitespace to single whitespace #rmregexp /\s{2,}/ / #regexp /^\s+// Remove all whitespace from start of line #regexp /\s+$/__NEWLINE__/ Remove all whitespace from end of line #define MACRO test MACRO #regexp /inside/MACRO/ Test of macros inside regexps #define MACARGS(ARG) "Macro with ARG" #regexp /MACARGS(foo)/bar/ "Macro with foo" MACARGS(foo) Reminder - regexps also work with normal #if keyword (regexp module not needed) #if ("MACRO" =~ /\d/) WRONG #endif #define MACRO 123 #if ("MACRO" =~ /\d/) RIGHT #endif #regexp /\/\/\s+(keyword|test|result)/In comment: <$1>/ // keyword and other stuff // no change // test // result #regexp /\s\/a/b/ #regexp /\s\/a/b/ this is a testa this is a test /a #rmregexp /\s\/a/b/ this is a testa this is a test /a #rmregexp /\s\/a/b/ this is a testa this is a test /a ./filepp-1.8.0/modules/regexp/Makefile0000644000573500001440000000432710571107107016744 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - regexp module # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:15 $ # Description : Makefile for regexp module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = . datarootdir = ${prefix}/share moduledir = /usr/local/share/filepp/modules # top level of test build directory TESTBUILD = ../../testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=echo DIFF=diff RM=rm -fr INSTALL=/usr/bin/install -c test: @$(ECHO) ----------- Testing regexp.pm ------------- $(TESTFILEPP) -m regexp.pm $(srcdir)/test.in -o test.out $(DIFF) $(srcdir)/test.good test.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/regexp.pm $(moduledir) clean: $(RM) test.out distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/remover/0000755000573500001440000000000010571107073015465 5ustar darrenusers./filepp-1.8.0/modules/remover/Makefile.in0000644000573500001440000000465510564200560017541 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - remover.pm # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2007/02/13 00:08:16 $ # Description : Makefile for remover.pm module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = @srcdir@ datarootdir = @datarootdir@ moduledir = @moduledir@ # top level of test build directory TESTBUILD = @top_builddir@/testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=@echo@ DIFF=@diff@ RM=@rm@ INSTALL=@INSTALL@ test: @$(ECHO) ----------- Testing c-remover.pm ---------- $(TESTFILEPP) -m c-remover.pm $(srcdir)/test.in -o test-c.out $(DIFF) $(srcdir)/test-c.good test-c.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing hash-remover.pm ------- $(TESTFILEPP) -m hash-remover.pm $(srcdir)/test.in -o test-hash.out $(DIFF) $(srcdir)/test-hash.good test-hash.out @$(ECHO) ----------- Done -------------------------- install: $(INSTALL) -m 644 $(srcdir)/remover.pm $(moduledir) clean: $(RM) distclean: $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/modules/remover/README0000644000573500001440000000273110566651516016362 0ustar darrenusers remover - remove #if,#ifdef'ed out parts of code permanently without affecting rest of code This filepp module provides to modules: remover The c-comment module removes C and C++ style comments from files. The hash-comment module removes everything following a "#" on a line, this is the comment style used for Perl, Bourne Shell, C Shell, Make and many configuration files. There is a simple test file included with this module. To test the for module use the following commands (the file "test" is in this directory): filepp -m c-comment.pm test.in filepp -m hash-comment.pm test.in For full documentation on how to use filepp and the comment module read the filepp man page. Copyright (C) 2000-2007 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Comments are welcome. - Darren Miller ./filepp-1.8.0/modules/remover/remover.pm0000644000573500001440000002207110305636120017477 0ustar darrenusers######################################################################## # # remover 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. # ######################################################################## # # Project : File Preprocessor - remover module # Filename : $RCSfile: remover.pm,v $ # Author : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.2 $ # Last changed : $Date: 2005/09/01 17:37:20 $ # Description : This module removes all code between #ifdef and #if # statements for a predifined set of macros. Useful # for permanently removing uneeded bits of code. # Licence : GNU copyleft # ######################################################################## # THIS IS A FILEPP MODULE, YOU NEED FILEPP TO USE IT!!! # usage: edit the list of macros below then do: # filepp -m remover.pm ######################################################################## package Remover; use strict; # version number of module my $VERSION = '0.1.0'; # list of macros to be removed # enter macro as '1' if it should be initially defined # enter macro as '0' if it should be initially undefined my %Macros = (); # "if", "else", "endif" keywords - should match set you are using, # defaults to standard filepp/cpp list my %Ifwords = ('if', '', 'ifdef', '', 'ifndef', ''); my %Elsewords = ('else', '', 'elif', ''); my %Endifwords = ('endif', ''); # turn off keyword processing - will be enabled only when needed Filepp::RemoveProcessor("Filepp::ParseKeywords"); # turn off all macro processing Filepp::RemoveProcessor("Filepp::ReplaceDefines"); my $keywordchar = Filepp::GetKeywordchar(); # keywords which may or may not be removed my %Keywords = ( 'define' => \&Define, 'elif' => \&Elif, 'else' => \&Else, 'endif' => \&Endif, 'if' => \&If, 'ifdef' => \&Ifdef, 'ifndef' => \&Ifndef, 'remove' => \&Remove, 'undef' => \&Undef, ); # counter for number of #if[n][def] loops currently in my $iflevel = 0; # flag to control when to write output my @Writing = (1); # initialise default to 'writing' # flag to show if current 'if' block has passed a 'true if' my @Ifdone = (0); # initialise first to 'not passed true if' # flag to say if keyword with removable macros found my @RemoveLine = (0); my $remove_line = 0; # function to set macros for removal sub Remove { my $macrodefn = shift; my $macro; my $defn; my $i; # check there is an argument if($macrodefn !~ /\S/o) { Filepp::Error("remove keyword used without arguments"); } # find end of macroword - assume separated by space or tab $i = Filepp::GetNextWordEnd($macrodefn); # separate macro and defn (can't use split, doesn't work with '0') $macro = substr($macrodefn, 0, $i); $defn = substr($macrodefn, $i); # strip leading whitespace from $defn if($defn) { $defn =~ s/^[ \t]*//; } else { $defn = ""; } $remove_line = 1; $Macros{$macro} = $defn; if($defn) { Filepp::Debug("Remove: $macro added for removal defined=$defn"); Filepp::Define($macrodefn); } else { Filepp::Debug("Remove: $macro added for removal undefined"); Filepp::Undef($macro); } } # remove #define for all defines of unwanted macro sub Define { my $macrodefn = shift; $macrodefn =~ /^\s*\w+\b/; my $macro = $&; if(exists($Macros{$macro})) { Filepp::Debug("Remove: removing define <$macro>"); $remove_line = 1; } else { Filepp::Define($macrodefn); } } # remove #undef for all undefs of unwanted macro sub Undef { my $macro = shift; if(exists($Macros{$macro})) { Filepp::Debug("Remove: removing undef <$macro>"); $remove_line = 1; } else { Filepp::Undef($macro); } } # remove if statements with unwanted conditional in, ignore rest sub If { my $expr = shift; my $macro; my $found = 0; foreach $macro (keys(%Macros)) { if($expr=~ /\b$macro\b/) { $found = 1; } } if($found) { Filepp::Debug("Remove: removing if line <$expr>"); $RemoveLine[$iflevel] = 1; $remove_line = 1; return Filepp::If($expr); } else { $RemoveLine[$iflevel] = 0; } return 1; } # elif is not fully supported, prints warning out to for by hand removal sub Elif { my $expr = shift; my $macro; foreach $macro (keys(%Macros)) { if($expr=~ /\b$macro\b/) { Filepp::Warning("Remove: #elif removal not fully supported, remove by hand"); } } if($RemoveLine[$iflevel]) { $remove_line = 1; return Filepp::Elif($expr); } return 1; } # remove ifdef statements with unwanted conditional in, ignore rest sub Ifdef { my $macro = shift; # separate macro from any trailing garbage $macro = substr($macro, 0, Filepp::GetNextWordEnd($macro)); if(exists($Macros{$macro})) { Filepp::Debug("Remove: removing Ifdef line <$macro>"); $RemoveLine[$iflevel] = 1; $remove_line = 1; return Filepp::Ifdef($macro); } else { $RemoveLine[$iflevel] = 0; } return 1; } # remove ifndef statements with unwanted conditional in, ignore rest sub Ifndef { my $macro = shift; # separate macro from any trailing garbage $macro = substr($macro, 0, Filepp::GetNextWordEnd($macro)); if(exists($Macros{$macro})) { Filepp::Debug("Remove: removing Ifndef line <$macro>"); $RemoveLine[$iflevel] = 1; $remove_line = 1; return Filepp::Ifndef($macro); } else { $RemoveLine[$iflevel] = 0; } return 1; } sub Else { $remove_line = $RemoveLine[$iflevel]; return 1; } sub Endif { $remove_line = $RemoveLine[$iflevel]; return 1; } ############################################################################## # Keyword parsing routine ############################################################################## sub ParseKeywords { # input is next line in file my $inline = shift; my $outline = ""; my $thisline = $inline; my $keyword; # remove whitespace from start of line $thisline = Filepp::CleanStart($thisline); # check if first char on line is a # if($thisline && $thisline =~ /^$keywordchar/) { # remove "#" and any following whitespace $thisline =~ s/^$keywordchar\s*//g; # check for keyword if($thisline && $thisline =~ /^\w+\b/ && exists($Keywords{$&})) { $keyword = $&; # remove newline from line chomp($thisline); # remove leading whitespace and keyword from line my $inline = Filepp::CleanStart(substr($thisline, length($keyword))); # check for 'if' style keyword if(exists($Ifwords{$keyword})) { # increment ifblock level and set ifdone to same # value as previous block $iflevel++; $Ifdone[$iflevel] = 0; $Writing[$iflevel] = $Writing[$iflevel - 1]; $RemoveLine[$iflevel] = $RemoveLine[$iflevel - 1]; if(!$Writing[$iflevel]) { $Ifdone[$iflevel] = 1; } } # check for out of place 'else' or 'endif' style keyword elsif($iflevel <= 0 && (exists($Elsewords{$keyword}) || exists($Endifwords{$keyword}) )) { Filepp::Warning($keywordchar.$keyword. " found without preceding ".$keywordchar. "[else]ifword"); } # decide if to run 'if' or 'else' keyword if(exists($Ifwords{$keyword}) || exists($Elsewords{$keyword})){ # run keyword to set RemoveLine my $value = $Keywords{$keyword}->($inline); if($RemoveLine[$iflevel] && !$Ifdone[$iflevel]) { # check return value of 'if' if($value) { $Ifdone[$iflevel] = 1; $Writing[$iflevel] = 1; } else { $Writing[$iflevel] = 0; } } elsif($RemoveLine[$iflevel] || $Ifdone[$iflevel]) { $Writing[$iflevel] = 0; } else { $Writing[$iflevel] = 1; } } # check for 'endif' style keyword elsif(exists($Endifwords{$keyword})) { # run endif keyword and decrement iflevel if true if($Keywords{$keyword}->($inline)) { $iflevel--; } } # run all other keywords elsif($Writing[$iflevel] || $RemoveLine[$iflevel] == 0) { $Keywords{$keyword}->($inline); } } # keyword if statement } # no keywords in line - write line to file if not #ifdef'ed out if($remove_line || !$Writing[$iflevel]) { # do nothing } else { $outline = $outline.$inline; } $remove_line = 0; return $outline; } Filepp::AddProcessor("Remover::ParseKeywords"); return 1; ######################################################################## # End of file ######################################################################## ./filepp-1.8.0/modules/remover/test0000644000573500001440000000254110305636120016364 0ustar darrenusers#remove RM_NOTDEF 0 #remove RM_DEFINED 1 #define RM_NOTDEF test #define RM_DEFINED(arg) arg arg arg #define KEEP #define STAY want this #ifdef RM_NOTDEF #define RM_NOTDEF 10 #define KEEP 11 12 #else #define RM_DEFINED 14 #define STAY 15 16 #endif #ifdef RM_DEFINED #define RM_NOTDEF 20 #define KEEP 21 22 #else #define RM_DEFINED 24 #define STAY 25 26 #endif #ifdef KEEP #define RM_NOTDEF 30 #define KEEP 31 32 #else #define RM_DEFINED 34 #define STAY 35 36 #endif #ifdef SOMETHING_NOT_DEFINED #define RM_NOTDEF 30a #define KEEP 31a #ifdef RM_NOTDEF aaa #else bbb #endif 32a #else #define RM_DEFINED 34a #define STAY 35a #ifdef RM_DEFINED ccc #else ddd #endif 36a #endif #ifndef RM_DEFINED # ifdef KEEP # define RM_NOTDEF 41 # define KEEP 42 43 # else # define RM_NOTDEF 45 # define KEEP 46 47 # endif #else # ifdef STAY # define RM_NOTDEF 51 # define KEEP 52 53 # else # define RM_NOTDEF 35 # define KEEP 36 57 # endif #endif #ifndef RM_NOTDEF # ifdef KEEP # define RM_NOTDEF 63 # define KEEP 64 65 # else # define RM_NOTDEF 67 # define KEEP 68 69 # endif #else # ifdef STAY # define RM_NOTDEF 73 # define KEEP 32 75 # else # define RM_NOTDEF 77 # define KEEP 78 79 # endif #endif #if defined RM_DEFINED keep 84 #elif defined ANYTHING delete 86 #else delete 88 #endif #if defined RM_NOTDEF delete 92 #elif defined KEEP keep 94 #else delete 96 #endif ./filepp-1.8.0/tests/0000755000573500001440000000000010571107106013475 5ustar darrenusers./filepp-1.8.0/tests/Makefile.in0000644000573500001440000001007407704477750015567 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - testsuite # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2003/07/14 10:03:20 $ # Description : Makefile for bigdef module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = @srcdir@ # top level of test build directory TESTBUILD = @top_builddir@/testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=@echo@ DIFF=@diff@ RM=@rm@ .PHONY: test test: @$(ECHO) ----------- Testing macro prefixes -------- $(TESTFILEPP) -mp \' $(srcdir)/test-mp -o test-mp.out $(DIFF) $(srcdir)/test-mp.good test-mp.out $(TESTFILEPP) -mp \' $(srcdir)/test-mp -mpnk -o test-mpnk.out $(DIFF) $(srcdir)/test-mpnk.good test-mpnk.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing macros with variable args -- $(TESTFILEPP) $(srcdir)/test-varargs -o test-varargs.out $(DIFF) $(srcdir)/test-varargs.good test-varargs.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing if -------------------- $(TESTFILEPP) $(srcdir)/test-if -o test-if.out $(DIFF) $(srcdir)/test-if.good test-if.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing ifwords --------------- $(TESTFILEPP) -m $(srcdir)/ifwords.pm $(srcdir)/test-ifwords -o test-ifwords.out $(DIFF) $(srcdir)/test-ifwords.good test-ifwords.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing recursive macros ------ @$(ECHO) - Should give warning about recursive macros - $(TESTFILEPP) $(srcdir)/test-loop -o test-loop.out $(DIFF) $(srcdir)/test-loop.good test-loop.out $(TESTFILEPP) -w $(srcdir)/test-loop -o test-loopwb.out $(DIFF) $(srcdir)/test-loopwb.good test-loopwb.out $(TESTFILEPP) $(srcdir)/test-loop2 -o test-loop2.out $(DIFF) $(srcdir)/test-loop2.good test-loop2.out $(TESTFILEPP) -w $(srcdir)/test-loop2 -o test-loop2wb.out $(DIFF) $(srcdir)/test-loop2wb.good test-loop2wb.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing non-ascii chars ------- $(TESTFILEPP) $(srcdir)/test-pound -o test-pound.out $(DIFF) $(srcdir)/test-pound.good test-pound.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing blank line suppression -- $(TESTFILEPP) $(srcdir)/test-suppress -o test-suppress.out $(DIFF) $(srcdir)/test-suppress.good test-suppress.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing SetEatTrail ----------- $(TESTFILEPP) $(srcdir)/test-trail -o test-trail.out $(DIFF) $(srcdir)/test-trail.good test-trail.out @$(ECHO) ----------- Done -------------------------- clean: $(RM) *.out *~ distclean: clean $(RM) Makefile ############################################################################## # End of file ############################################################################## ./filepp-1.8.0/tests/ifwords.pm0000644000573500001440000000042107704034776015525 0ustar darrenusersAddKeyword("testif", "Filepp::If"); AddIfword("testif"); AddKeyword("testelse", "Filepp::Else"); AddElseword("testelse"); AddKeyword("testendif", "Filepp::Endif"); AddEndifword("testendif"); RemoveIfword("if"); RemoveElseword("else"); RemoveEndifword("endif"); return 1; ./filepp-1.8.0/tests/test-if0000644000573500001440000000053007704034776015011 0ustar darrenusers#define STATUS FAIL! #define UNITS 1 #define YES #if defined(YES) #if (UNITS==1) the value of units is UNITS I will skip over my endif #elif (UNITS==2) the value of units is UNITS I will skip over my endif #else the value of units is UNITS I will go to the next endif #endif We should get here #define STATUS SUCCESS! #endif STATUS ./filepp-1.8.0/tests/test-if.good0000644000573500001440000000012307704034776015736 0ustar darrenusers the value of units is 1 I will skip over my endif We should get here SUCCESS! ./filepp-1.8.0/tests/test-ifwords0000644000573500001440000000016107704034776016070 0ustar darrenusers#testif 1 HERE #testelse FAIL #testendif #testif 0 FAIL #testelse HERE #testendif #if 1 AAAa #else BBBb #endif ./filepp-1.8.0/tests/test-ifwords.good0000644000573500001440000000002607704034776017017 0ustar darrenusersHERE HERE AAAa BBBb ./filepp-1.8.0/tests/test-loop0000644000573500001440000000057607704034776015376 0ustar darrenusers#define BAR(DUCK) < BAR(BAR(BAR(goose))) > BAR BAR(goose) BAR-BAR(goose) #define FOO(DUCK) FOO(DUCK) duck FOO(FOO(duck)) swan duck FOO(swan) goose FOO(FOO(duck)) ( #define M N N #define N M M N M #define MM N MM NN #define B(M) M #define A B A(M) ZOWIE CAVIE! #define FUNC(TOPS) TOPS(TESTY) goose FUNC(BAR) TAIL ENDER #define YYY(ZZZ) ZZZ #define ZZZ YYY(ZZZ) ZZZ ./filepp-1.8.0/tests/test-loop.good0000644000573500001440000000034507704034776016317 0ustar darrenusers< >> > BAR BAR- duck FOO(FOO(duck)) swan duck FOO(swan) goose FOO(FOO(duck)) ( N N N N M M M M N N N N N N N NN N N N M M M M ZOWIE CBVIE! goose TBIL EN N N NDER ZZZ ./filepp-1.8.0/tests/test-loop20000644000573500001440000000021607704034776015447 0ustar darrenusers#define TEST testy TEST __LINE__ #define M N N #define N M M N M #define MM N MM NN #define FOO(BAR) BAR TEST FOO(FOO(TESTY)) YOINKS YOINKS ./filepp-1.8.0/tests/test-loop2.good0000644000573500001440000000013007704034776016371 0ustar darrenuserstesty 2 N N N N M M M M N N N N N N N NN N N N testy testyY YOIN N N NKS YOIN N N NKS ./filepp-1.8.0/tests/test-loop2wb.good0000644000573500001440000000007707704034776016734 0ustar darrenuserstesty 2 N N N N M M M M N N N N NN testy TESTY YOINKS YOINKS ./filepp-1.8.0/tests/test-loopwb.good0000644000573500001440000000032307704034776016644 0ustar darrenusers< >> > BAR BAR- duck FOO(FOO(duck)) swan duck FOO(swan) goose FOO(FOO(duck)) ( N N N N M M M M N N N N NN M M M M ZOWIE CAVIE! goose TAIL ENDER ZZZ ./filepp-1.8.0/tests/test-mp0000644000573500001440000000117307704034776015033 0ustar darrenusers#define THIS test #define THAT more #define TOTHER often 'THIS 'THAT 'TOTHER THIS THAT TOTHER 'ANY 'THING 'YOU 'LIKE 'ANY 'THIS 'THING 'THAT 'YOU 'TOTHER 'LIKE THIS THAT TOTHER 'ANY'THIS'THING'THAT'YOU'TOTHER'LIKETHISTHATTOTHER #define ARG(A, B, C) B A C 'ARG(will, this, work) ARG(will, this, work) 'NOARG(will, this, work) #ifdef THIS NO macro prefixes in ifdef #endif #ifdef 'THIS macro prefixes in ifdef #endif #if "THIS" eq "test" NO macro prefixes in if #endif #if "'THIS" eq "test" macro prefixes in if #endif #pragma filepp SetMacroPrefix $ #define THIS THAT $THIS THIS __LINE__ $__LINE__ #undef __LINE__ $__LINE__ ./filepp-1.8.0/tests/test-mp.good0000644000573500001440000000047107704034776015762 0ustar darrenusers test more often THIS THAT TOTHER 'ANY 'THING 'YOU 'LIKE 'ANY test 'THING more 'YOU often 'LIKE THIS THAT TOTHER 'ANYtest'THINGmore'YOUoften'LIKETHISTHATTOTHER this will work ARG(will, this, work) 'NOARG(will, this, work) NO macro prefixes in ifdef macro prefixes in if THAT THIS __LINE__ 40 $__LINE__ ./filepp-1.8.0/tests/test-mpnk.good0000644000573500001440000000047407704034776016316 0ustar darrenusers test more often THIS THAT TOTHER 'ANY 'THING 'YOU 'LIKE 'ANY test 'THING more 'YOU often 'LIKE THIS THAT TOTHER 'ANYtest'THINGmore'YOUoften'LIKETHISTHATTOTHER this will work ARG(will, this, work) 'NOARG(will, this, work) NO macro prefixes in ifdef NO macro prefixes in if THAT THIS __LINE__ 40 $__LINE__ ./filepp-1.8.0/tests/test-pound0000644000573500001440000000003107704034776015534 0ustar darrenusers#define £ POUND £ £ £££ ./filepp-1.8.0/tests/test-pound.good0000644000573500001440000000003507704034776016467 0ustar darrenusersPOUND POUND POUNDPOUNDPOUND ./filepp-1.8.0/tests/test-supp10000644000573500001440000000022707704034776015466 0ustar darrenusers#pragma filepp SetBlankSupp 1 __INCLUDE_LEVEL__ #pragma filepp SetBlankSupp 0 #include "test-supp2" #pragma filepp SetBlankSupp 1 __INCLUDE_LEVEL__ ./filepp-1.8.0/tests/test-supp20000644000573500001440000000007607704034776015471 0ustar darrenusers __INCLUDE_LEVEL__ #include "test-supp3" __INCLUDE_LEVEL__ ./filepp-1.8.0/tests/test-supp30000644000573500001440000000002607704034776015465 0ustar darrenusers __INCLUDE_LEVEL__ ./filepp-1.8.0/tests/test-suppress0000644000573500001440000000007607704034776016304 0ustar darrenusers __INCLUDE_LEVEL__ #include "test-supp1" __INCLUDE_LEVEL__ ./filepp-1.8.0/tests/test-suppress.good0000644000573500001440000000003207704034776017223 0ustar darrenusers 0 1 2 3 2 1 0 ./filepp-1.8.0/tests/test-trail0000644000573500001440000000016707704034776015534 0ustar darrenusers#define FOO CHOMP #pragma filepp SetEatTrail FOO BAR FOO BAR BARTAB FOO TABBAR BARTAB FOO DON'T EAT ME! FOO BAR ./filepp-1.8.0/tests/test-trail.good0000644000573500001440000000010607704034776016454 0ustar darrenusers BAR CHOMPBAR BARTAB CHOMPTABBAR BARTAB CHOMP DON'T EAT ME! CHOMP BAR ./filepp-1.8.0/tests/test-varargs0000644000573500001440000000035207704034776016062 0ustar darrenusersthis is a ## test "this is a ## test" #define macro another ## test macro #define hasargs(doof) doof doof ## doof hasargs(scoop) #define bla 1 #define bla_i 2 #define expand(A,B) testfunc(A,bla##B) expand (this,) expand (this,_i) ./filepp-1.8.0/tests/test-varargs.good0000644000573500001440000000014707704034776017013 0ustar darrenusersthis is a ## test "this is a ## test" anothertest scoop scoopscoop testfunc(this,1) testfunc(this,2) ./filepp-1.8.0/tests/Makefile0000644000573500001440000001004710571107106015137 0ustar darrenusers######################################################################## # # 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. # ######################################################################## ######################################################################## # # Project : File Pre Processor - testsuite # Filename : $RCSfile: Makefile.in,v $ # Originator : $Author: darren $ # Maintainer : Darren Miller: darren@cabaret.demon.co.uk # File version : $Revision: 1.3 $ # Last changed : $Date: 2003/07/14 10:03:20 $ # Description : Makefile for bigdef module # Licence : GNU copyleft # ######################################################################## ############################################################################## # Paths ############################################################################## srcdir = . # top level of test build directory TESTBUILD = ../testbuild TESTFILEPP = $(TESTBUILD)/bin/filepp ECHO=echo DIFF=diff RM=rm -fr .PHONY: test test: @$(ECHO) ----------- Testing macro prefixes -------- $(TESTFILEPP) -mp \' $(srcdir)/test-mp -o test-mp.out $(DIFF) $(srcdir)/test-mp.good test-mp.out $(TESTFILEPP) -mp \' $(srcdir)/test-mp -mpnk -o test-mpnk.out $(DIFF) $(srcdir)/test-mpnk.good test-mpnk.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing macros with variable args -- $(TESTFILEPP) $(srcdir)/test-varargs -o test-varargs.out $(DIFF) $(srcdir)/test-varargs.good test-varargs.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing if -------------------- $(TESTFILEPP) $(srcdir)/test-if -o test-if.out $(DIFF) $(srcdir)/test-if.good test-if.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing ifwords --------------- $(TESTFILEPP) -m $(srcdir)/ifwords.pm $(srcdir)/test-ifwords -o test-ifwords.out $(DIFF) $(srcdir)/test-ifwords.good test-ifwords.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing recursive macros ------ @$(ECHO) - Should give warning about recursive macros - $(TESTFILEPP) $(srcdir)/test-loop -o test-loop.out $(DIFF) $(srcdir)/test-loop.good test-loop.out $(TESTFILEPP) -w $(srcdir)/test-loop -o test-loopwb.out $(DIFF) $(srcdir)/test-loopwb.good test-loopwb.out $(TESTFILEPP) $(srcdir)/test-loop2 -o test-loop2.out $(DIFF) $(srcdir)/test-loop2.good test-loop2.out $(TESTFILEPP) -w $(srcdir)/test-loop2 -o test-loop2wb.out $(DIFF) $(srcdir)/test-loop2wb.good test-loop2wb.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing non-ascii chars ------- $(TESTFILEPP) $(srcdir)/test-pound -o test-pound.out $(DIFF) $(srcdir)/test-pound.good test-pound.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing blank line suppression -- $(TESTFILEPP) $(srcdir)/test-suppress -o test-suppress.out $(DIFF) $(srcdir)/test-suppress.good test-suppress.out @$(ECHO) ----------- Done -------------------------- @$(ECHO) ----------- Testing SetEatTrail ----------- $(TESTFILEPP) $(srcdir)/test-trail -o test-trail.out $(DIFF) $(srcdir)/test-trail.good test-trail.out @$(ECHO) ----------- Done -------------------------- clean: $(RM) *.out *~ distclean: clean $(RM) Makefile ############################################################################## # End of file ##############################################################################