NAME ^

builtin.imc - builtin and user defined macros

DESCRIPTION ^

Copyright: 2004 Bernhard Schmalhofer. All Rights Reserved. CVS Info: $Id$ History: Ported from GNU m4 1.4 References: http://www.gnu.org/software/m4/m4.html

Code for all builtin macros, initialisation of symbol table, and expansion of user defined macros.

SUBROUTINES ^

void builtin_tab_init( Hash state ) ^

Initialise all builtin and predefined macros.

void builtin_init( Hash state ) ^

Initialise all builtin and predefined macros.

void define_builtin( Hash state, string name, string bp ) ^

Install a builtin macro with name 'name', bound to the function 'bp'.

void define_user_macro( Hash state, string name, string text ) ^

Define a predefined or user-defined macro, with name 'name', and expansion 'text'. This function is also called from main().

define_macro ^

The function define_macro is common for the builtins "define", "undefine", "pushdef" and "popdef". ARGC and ARGV is as for the caller, and MODE argument determines how the macro name is entered into the symbol table.

m4___file__ ^

Mostly for debugging. TODO: This is broken for multiple input files. TODO: This is broken when the path seperator is not '/'

m4_decr ^

Decrease a number.

m4_define ^

Define a user defined macro.

m4_errprint ^

Print to standard error. The individual arguments are seperated by a blank.

m4_eval ^

Integer arithmetics.

m4_format ^

Frontend for printf like formatting.

m4_ifdef ^

A conditional. Check whether a macro is defined.

m4_ifelse ^

A conditional. Can also be used a block comment or as a switch statement.

m4_incr ^

Increase a number.

m4_index ^

The macro expands to the first index of the second argument in the first argument.

m4_len ^

Expand to the length of the first argument.

m4_substr ^

The macro "substr" extracts substrings from the first argument, starting from the index given by the second argument, extending for a length given by the third argument. If the third argument is missing, the substring extends to the end of the first argument.

m4_syscmd ^

Execute a shell command and don't return the return code.

m4_sysval ^

Return the exit status of the last syscmd.

m4_undefine ^

Define a user defined macro.

m4_not_implemented ^

A placeholder for unimplemented functions.


parrot