AIDE:Data/src/m4/functions.m4

From Tom
Jump to: navigation, search

The functions.m4 file defines the basic m4 functions used by AIDE configuration builder. This is one file. The Contents label before each function was added to simplify reading this via the web.

Header

divert(-1)
#
# Comments
#
divert(2)dnl
VERSIONID(`$Id: functions.m4 1651 2016-01-20 20:56:33Z aa0026 $')
divert(-1)

forloop

define(`forloop', `pushdef(`$1', `$2')_forloop($@)popdef(`$1')')
define(`_forloop',
`$4`'ifelse($1, `$3', `', `define(`$1', incr($1))$0($@)')')

push_output

define(`push_output',dnl
`ifdef(`_$1',dnl
`define(`_$1', defn(`_$1')
`$2')',dnl
`define(`_$1', `$2')'dnl
)'dnl
)dnl

pop_output

define(`pop_output',dnl
`ifdef(`_$1',dnl
defn(`_$1') `undefine(`_$1')'dnl
)'dnl
)'dnl

entry

define(`entry',dnl
`define(`_entry_type',    `$1')'dnl
`define(`_entry_string',  `$2')'dnl
`define(`_entry_rule',    `$3')'dnl
`ifelse(dnl
_entry_type, `ignore', `push_output(_entry_type, format(`!%-174s', _entry_string))',dnl
_entry_type, `match',  `push_output(_entry_type, format(`%-175s %s', _entry_string`$', _entry_rule))',dnl
_entry_type, `search', `push_output(_entry_type, format(`%-175s %s', _entry_string, _entry_rule))'dnl
)'dnl
)dnl

pop_entries

define(`pop_entries',dnl
`define(`_pop_entries_type', `$1')'dnl
`define(`_pop_entries_out', `pop_output(_pop_entries_type)')'dnl
`ifelse(_pop_entries_type, `search', dnl
`esyscmd(`LC_COLLATE="C" sort -u -r <<< "'_pop_entries_out`"')',dnl
`esyscmd(`LC_COLLATE="C" sort -u    <<< "'_pop_entries_out`"')'dnl
)'dnl
)dnl

--Tom Stevenson (talk) 12:27, 4 February 2016 (EST)

Help contents:

Reading: Go | Search | URL | Namespace | Page name | Section | Link | Backlinks | Piped link | Interwiki link | Redirect | Variable | Category | Special page
Tracking changes: Recent | (enhanced) | Related | Watching pages | Page history | Diff | User contributions | Edit summary | Minor edit | Patrolled edit
Logging in and preferences: Logging in | Preferences | User style
Editing: Overview | Wikitext | New page | List | Images/files | Image page | Special characters | Formula | Table | EasyTimeline | Inputbox | Template | (p. 2) | Renaming (moving) a page | Editing shortcuts | Talk page | Testing | Export | Import | rlc |