Next: , Previous: , Up: FWEB macros   [Contents][Index]


7.2.3 Built-in functions

Built-in functions behave in most ways like macros. In some cases they actually are macros, but other times they implement functions that a user could not define. They all begin with a dollar sign and are in upper case.

In using these built-ins, confusion may arise regarding the order of expansion of various arguments. When they are implemented as macros, they are subject to the same ANSI-C preprocessor rules as other FWEB macros, which is that all arguments are fully expanded before generating the replacement text of the macro. When they are directly implemented as a primitive function, however, that rule may not apply. For example, $IF expands only its first argument during its first pass of processing; depending on the results of that expansion, it then expands either its second or third argument, but not both.

The built-in function $DUMPDEF can be used to understand and debug the action of the built-in functions. See $DUMPDEF.

In the original FWEB design, built-in functions began with an underscore. This usage conflicts with the conventions for reserved words in ANSI C, and has been eliminated. All FWEB built-ins now begin with a dollar sign.

No user-defined macro should begin with a dollar sign! It might interfere with the functioning of some internal built-in function.


Next: , Previous: , Up: FWEB macros   [Contents][Index]