divert(-1)

dnl comment symbol
changecom(`####')

dnl change quote symbols
changequote(`{',`}')
changequote(\`,`\)

dnl just switching on/off OUTPUT
define(\`M4_ON`\,\`divert(0)dnl`\)
define(\`M4_OFF`\,\`divert(-1)dnl`\)

define(\`M4_RENAME`\,\`define(\`$2`\,\`$1`\)`\)

dnl renaming standart m4 commands
M4_RENAME(\`define`\,\`M4_DEFINE`\)

dnl local macroses
define(\`M4_1`\,\`1`\)
define(\`M4_2`\,\`2`\)
define(\`M4_3`\,\`3`\)
define(\`M4_4`\,\`4`\)
define(\`M4_5`\,\`5`\)
define(\`M4_6`\,\`6`\)
define(\`M4_7`\,\`7`\)
define(\`M4_8`\,\`8`\)
define(\`M4_9`\,\`9`\)

define(\`M4_SET`\,\`define(\`M4_$1`\,\`$2`\)`\)
define(\`M4_VAR`\,\`define(\`M4_SET_$1`\,\`M4_SET(\`$1`\,`\$M4_1\`)`\)M4_SET_$1(\`$2`\)`\)

dnl M4_ENUMERATOR(name,start) ->
dnl   M4_ADD_name(enum) -> M4_enum
dnl   M4_name = next enum value
define(\`M4_ENUMERATOR`\,\`M4_VAR(\`$1`\,\`$2`\)define(\`M4_ADD_$1`\,\`define(`\M4_$M4_1\`,M4_$1)M4_SET_$1(incr(M4_$1))`\)`\)

define(\`M4_IFFIRST`\,\`ifelse($1,\``\,$3,$2)`\)
