|
NAMEgenerate - Generate files from scriptSYNOPSISgenerate [-D macro=definition] [-i directory] [-q] [-v] [-s] [script ...]The 'D' option adds the macro definition to the list. If the '=' is not present then 'macro' is defined to the null string. The 'i' option changes the include directory. Default is /usr/package under Unix and C:\PACKAGE under MSDOS. The 'q' option causes the program to work quietly. The 'v' option reverses this. The 's' option causes leading spaces on each line to be stripped before processing. It also strips off the '!' character if it is the first non-space character on the line. If the file name on the command line is a directory then a file in that directory called script is used. DESCRIPTIONGenerate reads the named files (or stdin if no files named) and provisionally outputs each line with macro substitution. If the first character is '@' then it is taken to be a directive and various actions are taken as described below. An unescaped hash (#) in the input stream causes all input from that character to the end of the current line to be ignored. Blank lines are also ignored. The sequence "\<newline>" is converted to a space.A dollar sign signifies the start of a macro unless escaped by a backslash. If it is followed by an open parentheses then everything up to the closing parentheses is the macro. If not followed by an open parentheses then the single character following the dollar sign is the macro. A macro is replaced by its definition as in the following example: @DEFINE hello goodbye This defines hello such that instances in the text of "$(hello)" are replaced by "goodbye". See below for more information on defining macros. If there is a colon embedded in the macro then it separates the name of the macro from arguments to it. Arguments are separated by commas. The arguments are numbered from 0 to 9. In the definition of the macro positional parameters which consist of a dollar sign followed by a digit are replaced by the argument from the macro call. For example: @DEFINE foo bar $0 zap $1
Defaults are allowed: @DEFINE foo bar $0 zap $(1:gun)
Note that "\$" is treated as a single "$". Macro processing
is not performed within quotes unless the quotes are escaped.
... $(foo:none) --> same result as above It is an error to define a macro that already exists. Four special macros are defined, '@', '=', '%' and '?'. The first is a strlen operator, the second is a calc operator. The third generates a series of numbers. The fourth evaluates to its second argument if the first is not blank and to its third argument otherwise. Naturally this will normally be used with a variable in the first argument. $(@:Hello) ----> 5
Predefined macros:
Predefined macros cannot be cleared. A sample script file is included in driver.pck. This is designed to create a skeleton device driver for SVR4 systems. DIRECTIVES@DEFINEThis defines a new macro, for example: @DEFINE hello goodbye This defines hello such that instances in the text of "$(hello)" are replaced by "goodbye". See above for more details on macro substitution. @UNDEF
@DEFAULT
@IFNDEF foo @DEFINE foo bar
@ENDIF@REDEFINE
@DEFAULT foo x y z
@REDEFINE foo $(foo) $(bar)
@END
@CLEAR bar @PRINT $(foo) # Should print "x y z a b c" Note: Due to the nature of this command, the redefinition is evaluated for macro processing before assignment to avoid recursive definitions. This means that parameter passing cannot be use in these definitions. @GETENV
@READLINE
@IFDEF
@ELIFDEF
Note: The IFDEF family evaluates the macro before testing as well as evaluating the macro definition. This makes testing of macros with positional parameters a little tricky. Example: @DEFINE X Y
PASSED
@ENDIF This passes but note the double space between foo and bar. @ELSE
@ENDIF
@FOR
@END
@INCLUDE
@FILE
@APPEND
@PRINT
@ERROR
@RETURN
@SHOW
@CLEAR
@QUOTE
ENVIRONMENTIf an environment variable exists with the base name of the program, the string so defined is stuffed into the argument stream as if it followed the file name on the command line but preceded any actual command line arguments. See getarg(3) for more details.WISH LISTI want to add some sort of virtual file mechanism. This means that there will be new directives VFILE, VINCLUDE and VAPPEND. These do the same as the similarly named directives except the file is a virtual one and does not actually happen in the file system. There are a number of ways to deal with this concept but the best ones are Unix specific or at least would work best with a flat address system and virtual memory.AUTHORD´Arcy J.M. CainToronto, Ontario Email: darcy@druid.net
Visit the GSP FreeBSD Man Page Interface. |