aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2018-10-10 16:18:43 +0300
committerSergey Poznyakoff <gray@gnu.org>2018-10-10 17:08:38 +0300
commit3b8a6bad61f2a9ac9d30367a06ca410210f55fca (patch)
tree4537fe576a2e11f893dbe2be4321ada989954cd4
parent52d4beddcf90c6b71ce0ac5b78194bbcca2a099f (diff)
downloadm4kwargs-3b8a6bad61f2a9ac9d30367a06ca410210f55fca.tar.gz
m4kwargs-3b8a6bad61f2a9ac9d30367a06ca410210f55fca.tar.bz2
Rename project to m4kwargs
Macros prefixed with | operate on -----------------------+---------------------------- KWARG_ | single keyword argument KWARGS_ | list of keyword arguments
-rw-r--r--m4/kwargs.m4200
-rw-r--r--m4/opt.m4198
-rw-r--r--t/asgn.t12
-rw-r--r--t/asgnopts.t12
-rw-r--r--t/clear.t32
-rw-r--r--t/dump.t12
-rw-r--r--t/dumpval.t16
-rw-r--r--t/foreach.t8
-rw-r--r--t/ifempty.t8
-rw-r--r--t/listrem00.t14
-rw-r--r--t/listrem01.t14
-rw-r--r--t/mangle.t12
-rw-r--r--t/namelist.t8
-rw-r--r--t/null.t10
-rw-r--r--t/ovr.t12
-rw-r--r--t/ovropts.t16
-rw-r--r--t/popopts.t20
-rw-r--r--t/pushopts.t16
-rwxr-xr-xt/runtest.sh14
-rw-r--r--t/set.t14
-rw-r--r--t/setup.m42
-rw-r--r--t/switchset.t32
-rw-r--r--t/switchval.t24
-rw-r--r--t/unasgn.t16
-rw-r--r--t/unasgnopts.t16
-rw-r--r--t/val.t22
-rw-r--r--t/withopts.t12
27 files changed, 387 insertions, 385 deletions
diff --git a/m4/kwargs.m4 b/m4/kwargs.m4
new file mode 100644
index 0000000..3cfb814
--- /dev/null
+++ b/m4/kwargs.m4
@@ -0,0 +1,200 @@
+# This file is part of M4KWARGS
+# Copyright (C) 2011-2018 Sergey Poznyakoff
+#
+# M4KWARGS is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# M4KWARGS is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with M4KWARGS. If not, see <http://www.gnu.org/licenses/>.
+
+m4_include(composite.m4)
+
+# m4_argc(...)
+# ------------
+# Expands to the number of arguments supplied.
+#
+m4_define(`m4_argc',`$#')
+
+# m4_ifempty(LIST, IF-TRUE [, IF-FALSE])
+# --------------------------------------
+# Expands to IF-TRUE if LIST is not empty, otherwise to IF-FALSE.
+#
+m4_define(`m4_ifempty', `m4_ifelse(`$1',`',`$2',`$3')')
+
+# m4_quote_names(LIST)
+# --------------------
+# Produce a quoted comma-delimited list of doubly-quoted names from LIST.
+# The result is suitable for use as second argument to m4_foreach, so that
+# none of its elements are expanded while processing.
+m4_define(`m4_quote_names', `m4_quote(m4_dquote(m4_dquote_elt($@)))')
+
+# m4_kwargs_list_if_member(LIST, ELT, IF-TRUE [, IF-FALSE])
+# ---------------------------------------------------------
+# Expands to IF-TRUE if ELT is contained in the comma-delimited LIST of
+# elements. Otherwise, expands to IF-FALSE.
+m4_define(`m4_kwargs_list_if_member',`_m4_kwargs_list_if_member__(`$3',`$4',`$2',$1)')
+# _m4_kwargs_list_if_member(IF-TRUE, IF-FALSE, ELT, ...)
+# ------------------------------------------------------
+# Auxiliary function for m4_kwargs_list_if_member. Recursively scans the list
+# of arguments beginning with $4 and stops when ELT is found, or end of
+# the list is reached. Expands to IF-TRUE or IF-FALSE, depending on
+# whether ELT is found.
+#
+m4_define(`_m4_kwargs_list_if_member__',
+`m4_ifelse(`$4',`',`$2',
+`$3',`$4',`$1',`_m4_kwargs_list_if_member__(`$1',`$2',`$3',m4_shift(m4_shift(m4_shift(m4_shift($@)))))')')
+
+# m4_kwargs_list_remove(LIST, ELT)
+# --------------------------------
+# Removes ELT from the comma-delimited LIST.
+#
+m4_define(`m4_kwargs_list_remove',
+`m4_pushdef(`__L__',m4_dquote($1))m4_dnl
+m4_popdef(`$1')m4_dnl
+m4_pushdef(`$1',m4_quote(m4_shift(m4_dquote_elt(m4_kwargs_list_remove_(`$2',__L__)))))m4_dnl
+m4_popdef(`__L__')')
+
+# m4_kwargs_list_remove_(elt, ...)
+m4_define(`m4_kwargs_list_remove_',
+`m4_ifelse(`$#',1,`',
+`$#',2,`m4_ifelse(`$1',`$2',,`,m4_quote(`$2')')',
+`m4_ifelse(`$1',`$2',,`,m4_quote(`$2')')m4_kwargs_list_remove_(`$1',m4_shift(m4_shift($@)))')')
+
+# m4_kwargs_mangle_name(NAME)
+# ---------------------------
+# Converts NAME to a keyword name by prefixing it with double-dash.
+m4_define(`m4_kwargs_mangle_name',`--`$1'')
+
+# _m4_kwargs_list - a list of defined keyword names
+# ---------------------------------------------
+#
+m4_define(`_m4_kwargs_list')
+
+# KWARG_SET(NAME [, VALUE])
+# -------------------------
+# Sets argument NAME to VALUE
+m4_define(`KWARG_SET',
+`m4_pushdef(`__opt_name__',m4_dquote(m4_kwargs_mangle_name(`$1')))m4_dnl
+m4_kwargs_list_if_member(`_m4_kwargs_list',`$1',`m4_popdef(__opt_name__)',
+`m4_define(`_m4_kwargs_list',m4_ifempty(m4_quote(_m4_kwargs_list),
+m4_dquote(m4_dquote(`$1')),`m4_quote(m4_dquote(_m4_kwargs_list), m4_dquote(`$1'))'))')m4_dnl
+m4_pushdef(__opt_name__,`$2')m4_dnl
+m4_popdef(`__opt_name__')')
+
+# KWARG_CLR(NAME)
+# ---------------
+# Clears the keyword argument NAME.
+m4_define(`KWARG_CLR',
+`m4_kwargs_list_if_member(`_m4_kwargs_list',`$1',
+`m4_popdef(m4_kwargs_mangle_name(`$1'))m4_dnl
+m4_kwargs_list_remove(`_m4_kwargs_list',`$1')')')
+
+# KWARG_ASGN(NAME[=VAL])
+# ----------------------
+# Assigns VAL to NAME. If VAL is absent, equivalent to KWARG_SET(NAME).
+m4_define(`KWARG_ASGN',
+`KWARG_SET(m4_ifelse(m4_index(`$1',`='),-1,``$1'',`m4_patsubst(`$1',`\([^=]*\)=\(.*\)',``\1',`\2'')'))')
+
+# KWARG_UNASGN(NAME[=VAL])
+# ------------------------
+# Unassign argument. Optional VAL is ignored.
+m4_define(`KWARG_UNASGN',
+`KWARG_CLR(m4_patsubst(`$1',`\([^=]*\)=\(.*\)',``\1''))')
+
+# KWARG_IFSET(NAME,IF-SET,IF-NOT-SET)
+# -----------------------------------
+# If the argument NAME is set, expands to IF-SET, otherwise expands
+# to IF-NOT-SET.
+m4_define(`KWARG_IFSET',
+`m4_kwargs_list_if_member(`_m4_kwargs_list',`$1',`$2',`$3')')
+
+# KWARG_VALUE(NAME[,DFLT])
+# ------------------------
+# If the argument NAME is defined, return its value. Otherwise, return DFLT.
+m4_define(`KWARG_VALUE',
+`m4_kwargs_list_if_member(`_m4_kwargs_list',`$1',`m4_defn(m4_kwargs_mangle_name(`$1'))',`$2')')
+
+# KWARGS_SWITCH_VALUE(NAME, VAL1, CASE1, VAL2, CASE2,..., OTHERWISE)
+# ------------------------------------------------------------------
+m4_define(`KWARGS_SWITCH_VALUE',
+`m4_kwargs_switch_val(KWARG_VALUE(`$1'),m4_shift($@))')
+m4_define(`m4_kwargs_switch_val',
+`m4_ifelse(`$#',2,`$2',
+`$#',1,`',
+`$1',`$2',`$3',`$0(`$1',m4_shift(m4_shift(m4_shift($@))))')')')
+
+# KWARGS_SWITCH(NAME1,IF-SET1,NAME2,IF-SET2,...,IF-NOT-SET)
+# ---------------------------------------------------------
+# If NAME1 is set, run IF-SET1. Otherwise, if NAME2 is set, run IF-SET2.
+# Continue the process for all name-if-set pairs within `...'. If none
+# of the options is set, run IF-NOT-SET.
+m4_define(`KWARGS_SWITCH',
+`m4_ifelse(`$4',,`KWARG_IFSET($@)',m4_dnl
+`$3',,`KWARG_IFSET($@)',m4_dnl
+`KWARG_IFSET(`$1',`$2',`KWARGS_SWITCH(m4_shift(m4_shift($@)))')')')
+
+# KWARGS_ASGN(ARGS...)
+# --------------------
+# Assign arguments.
+# ARGS is a comma-separated list of keyword[=value] pairs.
+m4_define(`KWARGS_ASGN',
+`m4_foreach(`_GR_Arg', m4_quote_names($@),
+ `KWARG_ASGN(m4_quote(_GR_Arg))')')
+
+# KWARGS_UNASGN(ARGS...])
+# -----------------------
+# Unassign options.
+m4_define(`KWARGS_UNASGN',
+`m4_foreach(`_GR_Arg', m4_quote_names($@),
+ `KWARG_UNASGN(m4_quote(_GR_Arg))')')
+
+# KWARGS_WITH(CODE,ARGS...)
+# ------------------------
+# Expand to CODE with the keyword arguments from ARGS... set.
+m4_define(`KWARGS_WITH',
+`KWARGS_PUSH(m4_shift($@))m4_dnl
+$1
+KWARGS_POP(m4_shift($@))')
+
+# KWARGS_PUSH()
+# -------------
+m4_define(`KWARGS_PUSH',
+`m4_pushdef(`_m4_kwargs_list')m4_dnl
+KWARGS_ASGN($@)')
+
+# KWARGS_POP()
+# ------------
+m4_define(`KWARGS_POP',
+`KWARGS_FOREACH(`opt',`m4_popdef(m4_kwargs_mangle_name(opt))')m4_dnl
+m4_popdef(`_m4_kwargs_list')')
+
+# KWARGS_FOREACH(ITERATOR, TEXT)
+# ------------------------------
+# Takes the name in ITERATOR, which must be a valid identifier, and
+# successively assigns it each keyword name, in the same order they were
+# created. For each assignment to ITERATOR, TEXT is appended to the expansion
+# of KWARGS_FOREACH. TEXT may refer to ITERATOR. Any definition of ITERATOR
+# prior to this invocation is restored.
+#
+m4_define(`KWARGS_FOREACH',
+ `m4_foreach(`$1',m4_quote_names(_m4_kwargs_list),`$2')')
+
+# KWARGS_DUMP([PREFIX])
+# ---------------------
+# Dump all keyword arguments to stdout, each on a separate line, prefixed
+# with PREFIX.
+#
+m4_define(`KWARGS_DUMP',
+`m4_pushdef(`__dump_newline__')m4_dnl
+KWARGS_FOREACH(`_GR_Arg',`m4_ifelse(__dump_newline__,,,`
+')m4_define(`__dump_newline__',1)m4_dnl
+`$1'_GR_Arg=KWARG_VALUE(_GR_Arg)')m4_dnl
+m4_popdef(`__dump_newline__')')
+
diff --git a/m4/opt.m4 b/m4/opt.m4
deleted file mode 100644
index 8704001..0000000
--- a/m4/opt.m4
+++ /dev/null
@@ -1,198 +0,0 @@
-# This file is part of M4OPT
-# Copyright (C) 2011-2015 Sergey Poznyakoff
-#
-# M4OPT is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# M4OPT is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with M4OPT. If not, see <http://www.gnu.org/licenses/>.
-
-m4_include(composite.m4)
-
-# m4_argc(...)
-# ------------
-# Expands to the number of arguments supplied.
-#
-m4_define(`m4_argc',`$#')
-
-# m4_ifempty(LIST, IF-TRUE [, IF-FALSE])
-# --------------------------------------
-# Expands to IF-TRUE if LIST is not empty, otherwise to IF-FALSE.
-#
-m4_define(`m4_ifempty', `m4_ifelse(`$1',`',`$2',`$3')')
-
-# m4_quote_names(LIST)
-# --------------------
-# Produce a quoted comma-delimited list of doubly-quoted names from LIST.
-# The result is suitable for use as second argument to m4_foreach, so that
-# none of its elements are expanded while processing.
-m4_define(`m4_quote_names', `m4_quote(m4_dquote(m4_dquote_elt($@)))')
-
-# m4opt_list_if_member(LIST, ELT, IF-TRUE [, IF-FALSE])
-# -----------------------------------------------------
-# Expands to IF-TRUE if ELT is contained in the comma-delimited LIST of
-# elements. Otherwise, expands to IF-FALSE.
-m4_define(`m4opt_list_if_member',`_m4opt_list_if_member__(`$3',`$4',`$2',$1)')
-# _m4opt_list_if_member(IF-TRUE, IF-FALSE, ELT, ...)
-# --------------------------------------------------
-# Auxiliary function for m4opt_list_if_member. Recursively scans the list
-# of arguments beginning with $4 and stops when ELT is found, or end of
-# the list is reached. Expands to IF-TRUE or IF-FALSE, depending on
-# whether ELT is found.
-#
-m4_define(`_m4opt_list_if_member__',
-`m4_ifelse(`$4',`',`$2',
-`$3',`$4',`$1',`_m4opt_list_if_member__(`$1',`$2',`$3',m4_shift(m4_shift(m4_shift(m4_shift($@)))))')')
-
-# m4opt_list_remove(LIST, ELT)
-# ----------------------------
-# Removes ELT from the comma-delimited LIST.
-#
-m4_define(`m4opt_list_remove',
-`m4_pushdef(`__L__',m4_dquote($1))m4_dnl
-m4_popdef(`$1')m4_dnl
-m4_pushdef(`$1',m4_quote(m4_shift(m4_dquote_elt(m4opt_list_remove_(`$2',__L__)))))m4_dnl
-m4_popdef(`__L__')')
-
-# m4opt_list_remove_(elt, ...)
-m4_define(`m4opt_list_remove_',
-`m4_ifelse(`$#',1,`',
-`$#',2,`m4_ifelse(`$1',`$2',,`,m4_quote(`$2')')',
-`m4_ifelse(`$1',`$2',,`,m4_quote(`$2')')m4opt_list_remove_(`$1',m4_shift(m4_shift($@)))')')
-
-# m4opt_mangle_option(NAME)
-# -------------------------
-# Converts NAME to a option name by prefixing it with double-dash.
-m4_define(`m4opt_mangle_option',`--`$1'')
-
-# _m4opt_list - a list of defined option names
-# --------------------------------------------
-#
-m4_define(`_m4opt_list')
-
-# M4OPT_SET_OPTION(NAME [, VALUE])
-# --------------------------------
-# Sets option NAME to VALUE
-m4_define(`M4OPT_SET_OPTION',
-`m4_pushdef(`__opt_name__',m4_dquote(m4opt_mangle_option(`$1')))m4_dnl
-m4opt_list_if_member(`_m4opt_list',`$1',`m4_popdef(__opt_name__)',
-`m4_define(`_m4opt_list',m4_ifempty(m4_quote(_m4opt_list),
-m4_dquote(m4_dquote(`$1')),`m4_quote(m4_dquote(_m4opt_list), m4_dquote(`$1'))'))')m4_dnl
-m4_pushdef(__opt_name__,`$2')m4_dnl
-m4_popdef(`__opt_name__')')
-
-# M4OPT_CLR_OPTION(NAME)
-# ----------------------
-# Clears the option NAME.
-m4_define(`M4OPT_CLR_OPTION',
-`m4opt_list_if_member(`_m4opt_list',`$1',
-`m4_popdef(m4opt_mangle_option(`$1'))m4_dnl
-m4opt_list_remove(`_m4opt_list',`$1')')')
-
-# M4OPT_ASGN_OPTION(NAME[=VAL])
-# -----------------------------
-# Assigns VAL to NAME. If VAL is absent, equivalent to M4OPT_SET_OPTION(NAME).
-m4_define(`M4OPT_ASGN_OPTION',
-`M4OPT_SET_OPTION(m4_ifelse(m4_index(`$1',`='),-1,``$1'',`m4_patsubst(`$1',`\([^=]*\)=\(.*\)',``\1',`\2'')'))')
-
-# M4OPT_UNASGN_OPTION(NAME[=VAL])
-# -------------------------------
-# Unassing option NAME. Optional VAL is ignored.
-m4_define(`M4OPT_UNASGN_OPTION',
-`M4OPT_CLR_OPTION(m4_patsubst(`$1',`\([^=]*\)=\(.*\)',``\1''))')
-
-# M4OPT_IFSET(NAME,IF-SET,IF-NOT-SET)
-# -----------------------------------
-# If option NAME is set, expands to IF-SET, otherwise expands to IF-NOT-SET.
-m4_define(`M4OPT_IFSET',
-`m4opt_list_if_member(`_m4opt_list',`$1',`$2',`$3')')
-
-# M4OPT_VAL(NAME[,DFLT])
-# ----------------------
-# If option NAME is defined, return its value. Otherwise, return DFLT.
-m4_define(`M4OPT_VAL',
-`m4opt_list_if_member(`_m4opt_list',`$1',`m4_defn(m4opt_mangle_option(`$1'))',`$2')')
-
-# M4OPT_SWITCH_VAL(NAME, VAL1, CASE1, VAL2, CASE2,..., OTHERWISE)
-# ---------------------------------------------------------------
-m4_define(`M4OPT_SWITCH_VAL',
-`m4opt_switch_val(M4OPT_VAL(`$1'),m4_shift($@))')
-m4_define(`m4opt_switch_val',
-`m4_ifelse(`$#',2,`$2',
-`$#',1,`',
-`$1',`$2',`$3',`$0(`$1',m4_shift(m4_shift(m4_shift($@))))')')')
-
-# M4OPT_SWITCH_OPT_SET(NAME1,IF-SET1,NAME2,IF-SET2,...,IF-NOT-SET)
-# -----------------------------------------------------------------
-# If NAME1 is set, run IF-SET1. Otherwise, if NAME2 is set, run IF-SET2.
-# Continue the process for all name-if-set pairs within `...'. If none
-# of the options is set, run IF-NOT-SET.
-m4_define(`M4OPT_SWITCH_OPT_SET',
-`m4_ifelse(`$4',,`M4OPT_IFSET($@)',m4_dnl
-`$3',,`M4OPT_IFSET($@)',m4_dnl
-`M4OPT_IFSET(`$1',`$2',`M4OPT_SWITCH_OPT_SET(m4_shift(m4_shift($@)))')')')
-
-# M4OPT_ASGN_OPTIONS(OPTION[,OPTION...])
-# ---------------------------------------
-# Assign options.
-# OPTIONS is a comma-separated list of option[=value] pairs.
-m4_define(`M4OPT_ASGN_OPTIONS',
-`m4_foreach(`_GR_Option', m4_quote_names($@),
- `M4OPT_ASGN_OPTION(m4_quote(_GR_Option))')')
-
-# M4OPT_UNASGN_OPTIONS(OPTION[,OPTION...])
-# -----------------------------------------
-# Unassign options.
-m4_define(`M4OPT_UNASGN_OPTIONS',
-`m4_foreach(`_GR_Option', m4_quote_names($@),
- `M4OPT_UNASGN_OPTION(m4_quote(_GR_Option))')')
-
-# M4OPT_WITH_OPTIONS(CODE,OPT...)
-# --------------------------------
-# Expand to CODE with the options from OPTS... set.
-m4_define(`M4OPT_WITH_OPTIONS',
-`M4OPT_PUSH_OPTIONS(m4_shift($@))m4_dnl
-$1
-M4OPT_POP_OPTIONS(m4_shift($@))')
-
-# M4OPT_PUSH_OPTIONS()
-# --------------------
-m4_define(`M4OPT_PUSH_OPTIONS',
-`m4_pushdef(`_m4opt_list')m4_dnl
-M4OPT_ASGN_OPTIONS($@)')
-
-# M4OPT_POP_OPTIONS()
-# -------------------
-m4_define(`M4OPT_POP_OPTIONS',
-`M4OPT_FOREACH(`opt',`m4_popdef(m4opt_mangle_option(opt))')m4_dnl
-m4_popdef(`_m4opt_list')')
-
-# M4OPT_FOREACH(ITERATOR, TEXT)
-# -----------------------------
-# Takes the name in ITERATOR, which must be a valid option name, and
-# successively assigns it each option name, in the same order they were
-# created. For each assignment to ITERATOR, TEXT is appended to the expansion
-# of M4OPT_FOREACH. TEXT may refer to ITERATOR. Any definition of ITERATOR
-# prior to this invocation is restored.
-#
-m4_define(`M4OPT_FOREACH',
- `m4_foreach(`$1',m4_quote_names(_m4opt_list),`$2')')
-
-# M4OPT_DUMP([PREFIX])
-# --------------------
-# Dump all option definitions to stdout, each on a separate line, prefixed
-# with PREFIX.
-#
-m4_define(`M4OPT_DUMP',
-`m4_pushdef(`__dump_newline__')m4_dnl
-M4OPT_FOREACH(`opt',`m4_ifelse(__dump_newline__,,,`
-')m4_define(`__dump_newline__',1)m4_dnl
-`$1'opt=M4OPT_VAL(opt)')m4_dnl
-m4_popdef(`__dump_newline__')')
diff --git a/t/asgn.t b/t/asgn.t
index e7fdd90..5c599fc 100644
--- a/t/asgn.t
+++ b/t/asgn.t
@@ -1,22 +1,22 @@
-!C This file is part of M4OPT
+!C This file is part of M4KWARGS
!C Copyright (C) 2015 Sergey Poznyakoff
!C
-!C M4OPT is free software; you can redistribute it and/or modify
+!C M4KWARGS is free software; you can redistribute it and/or modify
!C it under the terms of the GNU General Public License as published by
!C the Free Software Foundation; either version 3, or (at your option)
!C any later version.
!C
-!C M4OPT is distributed in the hope that it will be useful,
+!C M4KWARGS is distributed in the hope that it will be useful,
!C but WITHOUT ANY WARRANTY; without even the implied warranty of
!C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
!C GNU General Public License for more details.
!C
!C You should have received a copy of the GNU General Public License
-!C along with M4OPT. If not, see <http://www.gnu.org/licenses/>.
+!C along with M4KWARGS. If not, see <http://www.gnu.org/licenses/>.
!IN
# BEGIN
-M4OPT_ASGN_OPTION(`bar=baz')m4_dnl
-M4OPT_VAL(`bar')
+KWARG_ASGN(`bar=baz')m4_dnl
+KWARG_VALUE(`bar')
# END
!OUT
# BEGIN
diff --git a/t/asgnopts.t b/t/asgnopts.t
index 9eab0cf..170524e 100644
--- a/t/asgnopts.t
+++ b/t/asgnopts.t
@@ -1,27 +1,27 @@
-!C This file is part of M4OPT
+!C This file is part of M4KWARGS
!C Copyright (C) 2015 Sergey Poznyakoff
!C
-!C M4OPT is free software; you can redistribute it and/or modify
+!C M4KWARGS is free software; you can redistribute it and/or modify
!C it under the terms of the GNU General Public License as published by
!C the Free Software Foundation; either version 3, or (at your option)
!C any later version.
!C
-!C M4OPT is distributed in the hope that it will be useful,
+!C M4KWARGS is distributed in the hope that it will be useful,
!C but WITHOUT ANY WARRANTY; without even the implied warranty of
!C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
!C GNU General Public License for more details.
!C
!C You should have received a copy of the GNU General Public License
-!C along with M4OPT. If not, see <http://www.gnu.org/licenses/>.
+!C along with M4KWARGS. If not, see <http://www.gnu.org/licenses/>.
!IN
# BEGIN
-M4OPT_ASGN_OPTIONS(`foo=qux',`bar=baz',`baz=foo,bar')m4_dnl
+KWARGS_ASGN(`foo=qux',`bar=baz',`baz=foo,bar')m4_dnl
# RAW
m4_defn(`--foo')
m4_defn(`--bar')
m4_defn(`--baz')
# DUMP
-M4OPT_DUMP()
+KWARGS_DUMP()
# END
!OUT
# BEGIN
diff --git a/t/clear.t b/t/clear.t
index e06b8c2..0457370 100644
--- a/t/clear.t
+++ b/t/clear.t
@@ -1,37 +1,37 @@
-!C This file is part of M4OPT
+!C This file is part of M4KWARGS
!C Copyright (C) 2015 Sergey Poznyakoff
!C
-!C M4OPT is free software; you can redistribute it and/or modify
+!C M4KWARGS is free software; you can redistribute it and/or modify
!C it under the terms of the GNU General Public License as published by
!C the Free Software Foundation; either version 3, or (at your option)
!C any later version.
!C
-!C M4OPT is distributed in the hope that it will be useful,
+!C M4KWARGS is distributed in the hope that it will be useful,
!C but WITHOUT ANY WARRANTY; without even the implied warranty of
!C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
!C GNU General Public License for more details.
!C
!C You should have received a copy of the GNU General Public License
-!C along with M4OPT. If not, see <http://www.gnu.org/licenses/>.
+!C along with M4KWARGS. If not, see <http://www.gnu.org/licenses/>.
!IN
# BEGIN
-M4OPT_SET_OPTION(`foo',314)
-M4OPT_SET_OPTION(`bar',`q1')
-M4OPT_SET_OPTION(`baz-bar',`shmeer')
+KWARG_SET(`foo',314)
+KWARG_SET(`bar',`q1')
+KWARG_SET(`baz-bar',`shmeer')
# DUMP
-M4OPT_DUMP()
+KWARGS_DUMP()
# CLEAR bar
-M4OPT_CLR_OPTION(`bar')m4_dnl
-M4OPT_DUMP()
+KWARG_CLR(`bar')m4_dnl
+KWARGS_DUMP()
# CLEAR bar 2
-M4OPT_CLR_OPTION(`bar')m4_dnl
-M4OPT_DUMP()
+KWARG_CLR(`bar')m4_dnl
+KWARGS_DUMP()
# CLEAR baz-bar
-M4OPT_CLR_OPTION(`baz-bar')m4_dnl
-M4OPT_DUMP()
+KWARG_CLR(`baz-bar')m4_dnl
+KWARGS_DUMP()
# CLEAR foo
-M4OPT_CLR_OPTION(`foo')m4_dnl
-M4OPT_DUMP()
+KWARG_CLR(`foo')m4_dnl
+KWARGS_DUMP()
# END
!OUT
# BEGIN
diff --git a/t/dump.t b/t/dump.t
index a931b54..82492fe 100644
--- a/t/dump.t
+++ b/t/dump.t
@@ -1,27 +1,27 @@
-!C This file is part of M4OPT
+!C This file is part of M4KWARGS
!C Copyright (C) 2015 Sergey Poznyakoff
!C
-!C M4OPT is free software; you can redistribute it and/or modify
+!C M4KWARGS is free software; you can redistribute it and/or modify
!C it under the terms of the GNU General Public License as published by
!C the Free Software Foundation; either version 3, or (at your option)
!C any later version.
!C
-!C M4OPT is distributed in the hope that it will be useful,
+!C M4KWARGS is distributed in the hope that it will be useful,
!C but WITHOUT ANY WARRANTY; without even the implied warranty of
!C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
!C GNU General Public License for more details.
!C
!C You should have received a copy of the GNU General Public License
-!C along with M4OPT. If not, see <http://www.gnu.org/licenses/>.
+!C along with M4KWARGS. If not, see <http://www.gnu.org/licenses/>.
!IN
m4_divert(-1)
-m4_define(`_m4opt_list',``foo',`bar',`baz'')m4_dnl
+m4_define(`_m4_kwargs_list',``foo',`bar',`baz'')m4_dnl
m4_pushdef(`--foo',`1')
m4_pushdef(`--bar',`Bar')
m4_pushdef(`--baz',`Baz qux')
m4_divert(0)m4_dnl
// BEGIN
-M4OPT_DUMP(`// ')
+KWARGS_DUMP(`// ')
// END
!OUT
// BEGIN
diff --git a/t/dumpval.t b/t/dumpval.t
index d8b90e2..96e8974 100644
--- a/t/dumpval.t
+++ b/t/dumpval.t
@@ -1,25 +1,25 @@
-!C This file is part of M4OPT
+!C This file is part of M4KWARGS
!C Copyright (C) 2015 Sergey Poznyakoff
!C
-!C M4OPT is free software; you can redistribute it and/or modify
+!C M4KWARGS is free software; you can redistribute it and/or modify
!C it under the terms of the GNU General Public License as published by
!C the Free Software Foundation; either version 3, or (at your option)
!C any later version.
!C
-!C M4OPT is distributed in the hope that it will be useful,
+!C M4KWARGS is distributed in the hope that it will be useful,
!C but WITHOUT ANY WARRANTY; without even the implied warranty of
!C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
!C GNU General Public License for more details.
!C
!C You should have received a copy of the GNU General Public License
-!C along with M4OPT. If not, see <http://www.gnu.org/licenses/>.
+!C along with M4KWARGS. If not, see <http://www.gnu.org/licenses/>.
!IN
# BEGIN
-M4OPT_SET_OPTION(`foo',314)
-M4OPT_SET_OPTION(`bar',`q1')
-M4OPT_SET_OPTION(`baz-bar',`shmeer')
+KWARG_SET(`foo',314)
+KWARG_SET(`bar',`q1')
+KWARG_SET(`baz-bar',`shmeer')
# DUMP
-M4OPT_DUMP()
+KWARGS_DUMP()
# END
!OUT
# BEGIN
diff --git a/t/foreach.t b/t/foreach.t
index 15fe8ec..4f9a8e2 100644
--- a/t/foreach.t
+++ b/t/foreach.t
@@ -1,18 +1,18 @@
-!C This file is part of M4OPT
+!C This file is part of M4KWARGS
!C Copyright (C) 2015 Sergey Poznyakoff
!C
-!C M4OPT is free software; you can redistribute it and/or modify
+!C M4KWARGS is free software; you can redistribute it and/or modify
!C it under the terms of the GNU General Public License as published by
!C the Free Software Foundation; either version 3, or (at your option)
!C any later version.
!C
-!C M4OPT is distributed in the hope that it will be useful,
+!C M4KWARGS is distributed in the hope that it will be useful,
!C but WITHOUT ANY WARRANTY; without even the implied warranty of
!C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
!C GNU General Public License for more details.
!C
!C You should have received a copy of the GNU General Public License
-!C along with M4OPT. If not, see <http://www.gnu.org/licenses/>.
+!C along with M4KWARGS. If not, see <http://www.gnu.org/licenses/>.
!IN
m4_divert(-1)
m4_define(`list',``foo',`bar',`baz'')
diff --git a/t/ifempty.t b/t/ifempty.t
index 6a0a8aa..11edd2b 100644
--- a/t/ifempty.t
+++ b/t/ifempty.t
@@ -1,18 +1,18 @@
-!C This file is part of M4OPT
+!C This file is part of M4KWARGS
!C Copyright (C) 2015 Sergey Poznyakoff
!C
-!C M4OPT is free software; you can redistribute it and/or modify
+!C M4KWARGS is free software; you can redistribute it and/or modify
!C it under the terms of the GNU General Public License as published by
!C the Free Software Foundation; either version 3, or (at your option)
!C any later version.
!C
-!C M4OPT is distributed in the hope that it will be useful,
+!C M4KWARGS is distributed in the hope that it will be useful,
!C but WITHOUT ANY WARRANTY; without even the implied warranty of
!C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
!C GNU General Public License for more details.
!C
!C You should have received a copy of the GNU General Public License
-!C along with M4OPT. If not, see <http://www.gnu.org/licenses/>.
+!C along with M4KWARGS. If not, see <http://www.gnu.org/licenses/>.
!IN
m4_divert(-1)
m4_define(`null')
diff --git a/t/listrem00.t b/t/listrem00.t
index 55abc30..9620862 100644
--- a/t/listrem00.t
+++ b/t/listrem00.t
@@ -1,24 +1,24 @@
-!C This file is part of M4OPT
+!C This file is part of M4KWARGS
!C Copyright (C) 2015 Sergey Poznyakoff
!C
-!C M4OPT is free software; you can redistribute it and/or modify
+!C M4KWARGS is free software; you can redistribute it and/or modify
!C it under the terms of the GNU General Public License as published by
!C the Free Software Foundation; either version 3, or (at your option)
!C any later version.
!C
-!C M4OPT is distributed in the hope that it will be useful,
+!C M4KWARGS is distributed in the hope that it will be useful,
!C but WITHOUT ANY WARRANTY; without even the implied warranty of
!C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
!C GNU General Public License for more details.
!C
!C You should have received a copy of the GNU General Public License
-!C along with M4OPT. If not, see <http://www.gnu.org/licenses/>.
+!C along with M4KWARGS. If not, see <http://www.gnu.org/licenses/>.
!IN
m4_define(`list',``foo',`bar',`baz'')m4_dnl
# BEGIN
-m4opt_list_remove_(`foo',list)
-m4opt_list_remove_(`bar',list)
-m4opt_list_remove_(`baz',list)
+m4_kwargs_list_remove_(`foo',list)
+m4_kwargs_list_remove_(`bar',list)
+m4_kwargs_list_remove_(`baz',list)
# END
!OUT
# BEGIN
diff --git a/t/listrem01.t b/t/listrem01.t
index 55db39f..50ff856 100644
--- a/t/listrem01.t
+++ b/t/listrem01.t
@@ -1,28 +1,28 @@
-!C This file is part of M4OPT
+!C This file is part of M4KWARGS
!C Copyright (C) 2015 Sergey Poznyakoff
!C
-!C M4OPT is free software; you can redistribute it and/or modify
+!C M4KWARGS is free software; you can redistribute it and/or modify
!C it under the terms of the GNU General Public License as published by
!C the Free Software Foundation; either version 3, or (at your option)
!C any later version.
!C
-!C M4OPT is distributed in the hope that it will be useful,
+!C M4KWARGS is distributed in the hope that it will be useful,
!C but WITHOUT ANY WARRANTY; without even the implied warranty of
!C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
!C GNU General Public License for more details.
!C
!C You should have received a copy of the GNU General Public License
-!C along with M4OPT. If not, see <http://www.gnu.org/licenses/>.
+!C along with M4KWARGS. If not, see <http://www.gnu.org/licenses/>.
!IN
# BEGIN
m4_define(`list',``foo',`bar',`baz'')m4_dnl
-m4opt_list_remove(`list',`foo')m4_dnl
+m4_kwargs_list_remove(`list',`foo')m4_dnl
: list
m4_define(`list',``foo',`bar',`baz'')m4_dnl
-m4opt_list_remove(`list',`bar')m4_dnl
+m4_kwargs_list_remove(`list',`bar')m4_dnl
: list
m4_define(`list',``foo',`bar',`baz'')m4_dnl
-m4opt_list_remove(`list',`baz')m4_dnl
+m4_kwargs_list_remove(`list',`baz')m4_dnl
: list
# END
!OUT
diff --git a/t/mangle.t b/t/mangle.t
index 7e3de92..de2c93c 100644
--- a/t/mangle.t
+++ b/t/mangle.t
@@ -1,22 +1,22 @@
-!C This file is part of M4OPT
+!C This file is part of M4KWARGS
!C Copyright (C) 2015 Sergey Poznyakoff
!C
-!C M4OPT is free software; you can redistribute it and/or modify
+!C M4KWARGS is free software; you can redistribute it and/or modify
!C it under the terms of the GNU General Public License as published by
!C the Free Software Foundation; either version 3, or (at your option)
!C any later version.
!C
-!C M4OPT is distributed in the hope that it will be useful,
+!C M4KWARGS is distributed in the hope that it will be useful,
!C but WITHOUT ANY WARRANTY; without even the implied warranty of
!C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
!C GNU General Public License for more details.
!C
!C You should have received a copy of the GNU General Public License
-!C along with M4OPT. If not, see <http://www.gnu.org/licenses/>.
+!C along with M4KWARGS. If not, see <http://www.gnu.org/licenses/>.
!IN
# BEGIN
-m4opt_mangle_option(`foo')
-m4opt_mangle_option(`foo-bar:baz,qux,.45')
+m4_kwargs_mangle_name(`foo')
+m4_kwargs_mangle_name(`foo-bar:baz,qux,.45')
# END
!OUT
# BEGIN
diff --git a/t/namelist.t b/t/namelist.t
index 18677ff..181f03c 100644
--- a/t/namelist.t
+++ b/t/namelist.t
@@ -1,18 +1,18 @@
-!C This file is part of M4OPT
+!C This file is part of M4KWARGS
!C Copyright (C) 2015 Sergey Poznyakoff
!C
-!C M4OPT is free software; you can redistribute it and/or modify
+!C M4KWARGS is free software; you can redistribute it and/or modify
!C it under the terms of the GNU General Public License as published by
!C the Free Software Foundation; either version 3, or (at your option)
!C any later version.
!C
-!C M4OPT is distributed in the hope that it will be useful,
+!C M4KWARGS is distributed in the hope that it will be useful,
!C but WITHOUT ANY WARRANTY; without even the implied warranty of
!C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
!C GNU General Public License for more details.
!C
!C You should have received a copy of the GNU General Public License
-!C along with M4OPT. If not, see <http://www.gnu.org/licenses/>.
+!C along with M4KWARGS. If not, see <http://www.gnu.org/licenses/>.
!IN
m4_define(`list',``foo',`bar',`baz'')m4_dnl
# BEGIN
diff --git a/t/null.t b/t/null.t
index 9c79046..e12ba44 100644
--- a/t/null.t
+++ b/