What does dnl stand for in the m4




















For a macro call to have no arguments, the parentheses must be left out. The macro call name is a macro call with one argument, which is the empty string, not a call with no arguments. While generally useful, this feature might sometimes be the source of spurious, unwanted macro calls.

So, GNU m4 offers several mechanisms or techniques for inhibiting the recognition of names as macro calls. First of all, many builtin macros cannot meaningfully be called without arguments. For any of these macros, whenever an opening parenthesis does not immediately follow their name, the builtin macro call is not triggered. The option has no effect whatsoever on user defined macros. It also has no effect on whether a macro requires parameters. Another alternative is to redefine problematic macros to a name less likely to cause conflicts, See Definitions.

If your version of GNU m4 has the changeword feature compiled in, it offers far more flexibility in specifying the syntax of macro names, both builtin or user-defined.

See Changeword , for more information on this experimental feature. Of course, the simplest way to prevent a name from being interpreted as a call to an existing macro is to quote it. The remainder of this section studies a little more deeply how quoting affects macro invocation, and how quoting can be used to inhibit macro invocation.

Even if quoting is usually done over the whole macro name, it can also be done over only a few characters of this name provided, of course, that the unquoted portions are not also a macro. It is also possible to quote the empty string, but this works only inside the name. The output of macro evaluations is always rescanned.

When the quotes were removed, the divert builtin was called instead. If the name is followed by an opening parenthesis, the arguments will be collected before the macro is called. If too few arguments are supplied, the missing arguments are taken to be the empty string. However, some builtins are documented to behave differently for a missing optional argument than for an explicit empty string.

If there are too many arguments, the excess arguments are ignored. Unquoted leading whitespace is stripped off all arguments. Normally m4 will issue warnings if a builtin macro is called with an inappropriate number of arguments, but it can be suppressed with the --quiet command line option or --silent , or -Q , see Invoking m4.

For user defined macros, there is no check of the number of arguments given. Macros are expanded normally during argument collection, and whatever commas, quotes and parentheses that might show up in the resulting expanded text will serve to define the arguments as well. To understand why the first argument contains whitespace, remember that leading unquoted whitespace is never part of an argument, but trailing whitespace always is.

Within each argument, all unquoted parentheses must match. Commas separate arguments, except when they occur inside quotes, comments, or unquoted parentheses, See Pseudo Arguments , for examples. It is common practice to quote all arguments to macros, unless you are sure you want the arguments expanded.

It just makes life a bit harder, if you are not careful. For consistency, this manual follows the rule of thumb that each layer of parentheses introduces another layer of single quoting, except when showing the consequences of quoting rules.

This is done even when the quoted string cannot be a macro, such as with integers when you have not changed the syntax via changeword see Changeword. Previous: Quoting Arguments , Up: Macros 3. The expansion text from one macro call might therefore result in more macros being called, if the calls are included, completely or partially, in the first macro calls' expansion.

Next: Conditionals , Previous: Macros , Up: Top 4 How to define new macros Macros can be defined, redefined and deleted in several different ways. Also, it is possible to redefine a macro without losing a previous value, and bring back the original value at a later time.

If expansion is not given, it is taken to be empty. The expansion of define is void. The macro define is recognized only with parameters. The empty line in the output is there because the newline is not a part of the macro definition, and it is consequently copied to the output. This can be avoided by use of the macro dnl. See Dnl , for details. The first argument to define should be quoted; otherwise, if the macro is already defined, you will be defining a different macro.

Some other implementations of m4 replace all definitions of a macro with define. See Incompatibilities , for more details. As a GNU extension, the first argument to define does not have to be a simple word. It can be any text string, even the empty string. A macro with a non-standard name cannot be invoked in the normal way, as the name is not recognized. It can only be referenced by the builtins Indir and Defn.

Arrays and associative arrays can be simulated by using this trick. Replacement of arguments happens before rescanning, regardless of how many nesting levels of quoting appear in the expansion.

Here is an example of a macro with two arguments. It simply exchanges the order of the two arguments. You should try and improve this example so that clients of exch do not have to double quote. This is not so in UNIX implementations of m4 , which only recognize one digit.

Of course, they were eaten, when the expanded text were reread by m4. As another example of the difference, remember that comments encountered in arguments are passed untouched to the macro, and that quoting disables comments. For each argument, remove the macro name.

The macro names must necessarily be quoted, since they will be expanded otherwise. The expansion of undefine is void. The macro undefine is recognized only with parameters. In that case, undefine does nothing. To do this, you need the builtin defn : — Builtin: defn name Expands to the quoted definition of name.

If the argument is not a defined macro, the expansion is void. If name is a user-defined macro, the quoted definition is simply the quoted expansion text. If, instead, name is a builtin, the expansion is a special token, which points to the builtin's internal definition. This token is only meaningful as the second argument to define and pushdef , and is silently converted to an empty string in most other contexts. The macro defn is recognized only with parameters.

Even if the original macro is removed, the other name can still be used to access the definition. If an unbalanced end-quote string occurs in a macro definition, the rescan will see that embedded quote as the termination of the quoted string, and the remainder of the macro's definition will be rescanned unquoted.

Thus it is a good idea to avoid unbalanced end-quotes in macro definitions or arguments to macros. But most of the time, such tokens are silently converted to the empty string. This is done with the builtins pushdef and popdef : — Builtin: pushdef name, [ expansion ] — Builtin: popdef name Analogous to define and undefine.

These macros work in a stack-like fashion. A macro is temporarily redefined with pushdef , which replaces an existing definition of name , while saving the previous definition, before the new one is installed.

If there is no previous definition, pushdef behaves exactly like define. If a macro has several definitions of which only one is accessible , the topmost definition can be removed with popdef. If there is no previous definition, popdef behaves like undefine. The expansion of both pushdef and popdef is void.

The macros pushdef and popdef are recognized only with parameters. If a macro with several definitions is redefined with define , the topmost definition is replaced with the new definition.

If it is removed with undefine , all the definitions are removed, and not only the topmost one. At the start of the macro a new definition is pushed, within the macro it is manipulated and at the end it is popped, revealing the former definition. It is possible to temporarily redefine a builtin with pushdef and defn. Results in a call to the macro name , which is passed the rest of the arguments.

If name is not defined, an error message is printed, and the expansion is void. The macro indir is recognized only with parameters. They can only be called through the builtin indir. One other point to observe is that argument collection occurs before indir invokes name , so if argument collection changes the value of name , that will be reflected in the final expansion.

This is different than the behavior when invoking macros directly, where the definition that was in effect before argument collection is used. Results in a call to the builtin name , which is passed the rest of the arguments. If name does not name a builtin, an error message is printed, and the expansion is void.

The macro builtin is recognized only with parameters. This can be used even if name has been given another definition that has covered the original, or been undefined so that no macro maps to the builtin. This is different from indir , which only tracks current macro names. Note that indir and builtin can be used to invoke builtins without arguments, even when they normally require parameters to be recognized; but it will provoke a warning, and result in a void expansion.

We would like to have macros expand to different things, based on decisions taken at run-time. For that, we need some kind of conditionals. Also, we would like to have some kind of loop construct, so we could do something a number of times, or while some condition is true. The first is ifdef : — Builtin: ifdef name, string-1, [ string-2 ] If name is defined as a macro, ifdef expands to string-1 , otherwise to string If string-2 is omitted, it is taken to be the empty string according to the normal rules.

The macro ifdef is recognized only with parameters. It can be used as a way to introduce a long comment, as an if-else construct, or as a multibranch, depending on the number of arguments supplied: — Builtin: ifelse comment — Builtin: ifelse string-1, string-2, equal, [ not-equal ] — Builtin: ifelse string-1, string-2, equal-1, string-3, string-4, equal-2, Used with only one argument, the ifelse simply discards it and produces no output.

If called with three or four arguments, ifelse expands into equal , if string-1 and string-2 are equal character for character , otherwise it expands to not-equal. A final fifth argument is ignored, after triggering a warning.

If called with six or more arguments, and string-1 and string-2 are equal, ifelse expands into equal-1 , otherwise the first three arguments are discarded and the processing starts again. The macro ifelse is recognized only with parameters. Using only one argument is a common m4 idiom for introducing a block comment, as an alternative to repeatedly using dnl. This special usage is recognized by GNU m4 , so that in this case, the warning about missing arguments is never triggered.

With this macro, you can now reproduce the behavior of many of the builtins, where the macro is recognized only with arguments. If given more than four arguments, ifelse works like a case or switch statement in traditional programming languages. If string-1 and string-2 are equal, ifelse expands into equal-1 , otherwise the procedure is repeated with the first three arguments discarded. A common use of ifelse is in macros implementing loops of various kinds. Previous: Ifelse , Up: Conditionals 5.

There is no limit on the number of recursion levels, other than those enforced by your hardware and operating system. Loops can be programmed using recursion and the conditionals described previously. There is a builtin macro, shift , which can, among other things, be used for iterating through the actual arguments to a macro: — Builtin: shift arg1, Takes any number of arguments, and expands to all its arguments except arg1 , separated by commas, with each argument quoted.

The macro shift is recognized only with parameters. An example of the use of shift is this macro: — Composite: reverse Takes any number of arguments, and reverse their order. Here is an example of a loop macro that implements a simple for loop. For each assignment to iterator , append text to the expansion of the forloop. Any definition of iterator prior to this invocation is restored. If it has not finished, it increments the iteration variable using the predefined macro incr , see Incr , and recurses.

Only three macro arguments are unquoted, each for its own reason. Try to find out why these three arguments are left unquoted, and see what happens if they are quoted. Now, even though these two macros are useful, they are still not robust enough for general use. They lack even basic error handling of cases like start value less than final value, and the first argument not being a name.

Correcting these errors are left as an exercise to the reader. Next: Input Control , Previous: Conditionals , Up: Top 6 How to debug macros and input When writing macros for m4 , they often do not work as intended on the first try as is the case with most programming languages.

Fortunately, there is support for macro debugging in m4. Accepts any number of arguments. If called without any arguments, it displays the definitions of all known names, otherwise it displays the definitions of the names given. The output is printed to the current debug file usually standard error , and is sorted by name. If an unknown name is encountered, a warning is printed. The expansion of dumpdef is void.

The last example shows how builtin macros definitions are displayed. The definition that is dumped corresponds to what would occur if the macro were to be called at that point, even if other definitions are still live due to redefining a macro during argument collection. When called without any arguments, traceon and traceoff will turn tracing on and off, respectively, for all defined macros.

When called with arguments, only the named macros are affected, whether or not they are currently defined. The expansion of traceon and traceoff is void. Whenever a traced macro is called and the arguments have been collected, the call is displayed.

If the expansion of the macro call is not void, the expansion can be displayed after the call. The output is printed to the current debug file usually standard error. It is one most of the time, signifying an expansion at the outermost level, but it increases when macro arguments contain unquoted macro calls.

The maximum number that will appear between dashes is controlled by the option --nesting-limit see Invoking m4. Tracing by name is an attribute that is preserved whether the macro is defined or not. This allows the -t option to select macros to trace before those macros are defined.

However, defn see Defn does not transfer tracing status. The flags following the option can be one or more of the following: a Show the actual arguments in each macro call.

A line is shown when the macro is seen, but before the arguments are collected; a second line when the arguments have been collected and a third line after the call has completed. V A shorthand for all of the above flags. The examples throughout this manual assume the default flags. There is a builtin macro debugmode , which allows on-the-fly control of the debugging output format: — Builtin: debugmode [ flags ] The argument flags should be a subset of the letters listed above.

The expansion of debugmode is void. Previous: Debug Levels , Up: Debugging 6. If file is empty, debug and trace output are discarded. If debugfile is called without any arguments, debug and trace output are sent to standard error.

This does not affect warnings, error messages, or errprint output, which are always sent to standard error. If file cannot be opened, the current debug file is unchanged. The expansion of debugfile is void. Dnl : Deleting whitespace in input Changequote : Changing the quote characters Changecom : Changing the comment delimiters Changeword : Changing the lexical structure of words M4wrap : Saving text until end of input Next: Changequote , Up: Input Control 7. The expansion of dnl is void.

It is often used in connection with define , to remove the newline that follows the call to define. The input up to and including the next newline is discarded, as opposed to the way comments are treated see Comments. Usually, dnl is immediately followed by an end of line or some other whitespace. GNU m4 will produce a warning diagnostic if dnl is followed by an open parenthesis.

In this case, dnl will collect and process all arguments, looking for a matching close parenthesis. All predictable side effects resulting from this collection will take place. The input following the matching close parenthesis up to and including the next newline, on whatever line containing it, will still be discarded.

If the end of file is encountered without a newline character, a warning is issued and dnl stops consuming input. The expansion of changequote is void. The quotation strings can safely contain eight-bit characters. If no single character is appropriate, start and end can be of any length.

Changing the quotes to the empty strings will effectively disable the quoting mechanism, leaving no way to quote text. To achieve this, two calls of changequote must be made, one for the temporary quotes and one for the new quotes. Macros are recognized in preference to the begin-quote string, so if a prefix of start can be recognized as a potential macro name, the quoting mechanism is effectively disabled. In particular, changing the quotes to have the same string for start and end disables nesting of quotes.

Neither one is inherently better. It all depends on which language was used when they were trained. I think you mean a "macro". A macro is a set of commands used to automate repetitive steps. Now whenever you want to perform those steps you just click the icon and the toolbar and the steps are performed automatically.

To retrieve or modify data in the database query are used. There are four types of commands in SQL. Select command is data retrieval language command and is used to retrieve data from a database.

In database there Four types of languages which contains various commands. Select command is the only command that is used for retrieval of data. Update statement is used to update existing records in a database. Alter SQL command is used to modify, delete or add a column to an existing table in a database.

Commands that are used to define the structure of a database database schema are called DDL statements. A macro is used in the C programming language, and it's something that the C preprocessor reads before reading the actual code. The devices which are used to give messages or commands to the computer in computer's language. The lp and lpr commands are the traditional commands used to print jobs on UNIX.

PHP programming is a scripting language. This scripting language can be used in web page development. PHP software is available at no cost. The MLA style is used in the field of humanities, linguistics, and literature.

Log in. Study now. See Answer. Best Answer. Study guides. Computer Networking 20 cards. What are advantages of Database Approach. What is a network that covers a large geographical area such as a city country or world. What is the worlds largest wan. What is a network server.

Computers 21 cards. What is an decimal numbering system. Exercising m4 typically consists in running it on some files. Of course, the contents have to be properly quoted between square brackets to protect against included commas or spurious m4 expansion; no shell expansion of any sort is performed.

The contents ought to end with an end of line. Yet another zealous useful feature: autom4te makes sure there are no suspicious tokens in the output which could result from improper quotation, or typing errors. But in this test suite we really want to refer to dnl. There are two means to explain this to autom4te. This is not ]] But autom4te still complains, this time, being unable to find the source of the guilty dnl in dnl. The culprit is no less than the filename!

Therefore we have no other choice than using the second solution except renaming the file : completely disabling the checking of dnl in the output. The first solution is definitely the safest, because you tagged exactly the occurrences of dnl which are meant to be output.



0コメント

  • 1000 / 1000