From 25f5825272d2e2aa17c0c626026c5b7ba6dbd6f5 Mon Sep 17 00:00:00 2001 From: "Gary V. Vaughan" Date: Sun, 22 Sep 2013 17:22:40 +0700 Subject: configury: separate installed modules from test only modules. * modulues/import.c, modules/modtest.c, modules/shadow.c: Move from here... * tests/import.c, tests/modtest.c, tests/shadow.c: ...to here. * Makefile.am: Adjust. Signed-off-by: Gary V. Vaughan --- Makefile.am | 61 ++++++++++++++---------------- modules/import.c | 110 ------------------------------------------------------ modules/modtest.c | 101 ------------------------------------------------- modules/shadow.c | 91 -------------------------------------------- tests/import.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/modtest.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/shadow.c | 91 ++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 331 insertions(+), 334 deletions(-) delete mode 100644 modules/import.c delete mode 100644 modules/modtest.c delete mode 100644 modules/shadow.c create mode 100644 tests/import.c create mode 100644 tests/modtest.c create mode 100644 tests/shadow.c diff --git a/Makefile.am b/Makefile.am index c752ff24..e9ec90dc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -52,6 +52,7 @@ MAINTAINERCLEANFILES = include_HEADERS = noinst_LTLIBRARIES= lib_LTLIBRARIES = +check_LTLIBRARIES = EXTRA_LTLIBRARIES= # Additional configuration. Version management comes from suggestions @@ -152,24 +153,20 @@ module_libadd = m4/libm4.la noinst_HEADERS = modules/m4.h -pkglib_LTLIBRARIES = \ - modules/gnu.la \ - modules/m4.la \ - modules/traditional.la +pkglib_LTLIBRARIES = +pkglib_LTLIBRARIES += modules/gnu.la EXTRA_modules_gnu_la_SOURCES = modules/format.c modules_gnu_la_LDFLAGS = $(module_ldflags) modules_gnu_la_LIBADD = $(module_libadd) EXTRA_DIST += $(EXTRA_modules_gnu_la_SOURCES) +pkglib_LTLIBRARIES += modules/m4.la EXTRA_modules_m4_la_SOURCES = modules/evalparse.c modules_m4_la_LDFLAGS = $(module_ldflags) modules_m4_la_LIBADD = $(module_libadd) EXTRA_DIST += $(EXTRA_modules_m4_la_SOURCES) -modules_traditional_la_LDFLAGS = $(module_ldflags) -modules_traditional_la_LIBADD = $(module_libadd) - if USE_GMP pkglib_LTLIBRARIES += modules/mpeval.la EXTRA_modules_mpeval_la_SOURCES = modules/evalparse.c @@ -177,33 +174,17 @@ modules_mpeval_la_LDFLAGS = $(module_ldflags) modules_mpeval_la_LIBADD = $(module_libadd) $(LIBADD_GMP) endif -module_check = -rpath /dev/null -check_LTLIBRARIES = \ - tests/import.la \ - tests/modtest.la \ - tests/shadow.la \ - tests/stdlib.la \ - tests/time.la - -tests_import_la_LDFLAGS = $(module_ldflags) $(module_check) -tests_import_la_LIBADD = $(module_libadd) -tests_import_la_SOURCES = modules/import.c - -tests_modtest_la_LDFLAGS = $(module_ldflags) $(module_check) -tests_modtest_la_LIBADD = $(module_libadd) -tests_modtest_la_SOURCES = modules/modtest.c +pkglib_LTLIBRARIES += modules/stdlib.la +modules_stdlib_la_LDFLAGS = $(module_ldflags) +modules_stdlib_la_LIBADD = $(module_libadd) -tests_shadow_la_LDFLAGS = $(module_ldflags) $(module_check) -tests_shadow_la_LIBADD = $(module_libadd) -tests_shadow_la_SOURCES = modules/shadow.c - -tests_stdlib_la_LDFLAGS = $(module_ldflags) $(module_check) -tests_stdlib_la_LIBADD = $(module_libadd) -tests_stdlib_la_SOURCES = modules/stdlib.c +pkglib_LTLIBRARIES += modules/time.la +modules_time_la_LDFLAGS = $(module_ldflags) +modules_time_la_LIBADD = $(module_libadd) -tests_time_la_LDFLAGS = $(module_ldflags) $(module_check) -tests_time_la_LIBADD = $(module_libadd) -tests_time_la_SOURCES = modules/time.c +pkglib_LTLIBRARIES += modules/traditional.la +modules_traditional_la_LDFLAGS = $(module_ldflags) +modules_traditional_la_LIBADD = $(module_libadd) ## ----- ## @@ -244,6 +225,7 @@ EXTRA_DIST += m4/system_.h ## -------------- ## ## Documentation. ## ## -------------- ## + info_TEXINFOS = doc/m4.texi m4_TEXINFOS = doc/regexprops-generic.texi doc/fdl-1.3.texi doc/gpl-3.0.texi dist_man_MANS = $(srcdir)/doc/m4.1 @@ -370,9 +352,24 @@ EXTRA_DIST += $(TESTSUITE) $(TESTSUITE_AT) $(OTHER_FILES) \ tests/generate.awk \ $(srcdir)/tests/package.m4 +module_check = -rpath /dev/null + +check_LTLIBRARIES += tests/import.la +tests_import_la_LDFLAGS = $(module_ldflags) $(module_check) +tests_import_la_LIBADD = $(module_libadd) + +check_LTLIBRARIES += tests/modtest.la +tests_modtest_la_LDFLAGS = $(module_ldflags) $(module_check) +tests_modtest_la_LIBADD = $(module_libadd) + +check_LTLIBRARIES += tests/shadow.la +tests_shadow_la_LDFLAGS = $(module_ldflags) $(module_check) +tests_shadow_la_LIBADD = $(module_libadd) + # Using variables so that this snippet is not too wide and can # be used as is in Texinfo @example/@end example. m4_texi = $(srcdir)/doc/m4.texi + generate = $(AWK) -f $(srcdir)/tests/generate.awk $(srcdir)/tests/generated.at: tests/generate.awk $(m4_texi) $(generate) $(m4_texi) >$@t diff --git a/modules/import.c b/modules/import.c deleted file mode 100644 index 9f03493c..00000000 --- a/modules/import.c +++ /dev/null @@ -1,110 +0,0 @@ -/* GNU m4 -- A simple macro processor - Copyright (C) 2003, 2006-2008, 2010, 2013 Free Software Foundation, - Inc. - - This file is part of GNU M4. - - GNU M4 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 of the License, or - (at your option) any later version. - - GNU M4 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 this program. If not, see . -*/ - -#include - -/* Build using only the exported interfaces, unless NDEBUG is set, in - which case use private symbols to speed things up as much as possible. */ -#ifndef NDEBUG -# include -#else -# include "m4private.h" -#endif - -/* function macros blind side minargs maxargs */ -#define builtin_functions \ - BUILTIN (import, false, false, false, 0, 1) \ - BUILTIN (symbol_fail, false, false, false, 0, 1) \ - BUILTIN (module_fail, false, false, false, 0, 1) \ - -#define BUILTIN(handler, macros, blind, side, min, max) M4BUILTIN (handler) - builtin_functions -#undef BUILTIN - -static const m4_builtin m4_builtin_table[] = -{ -#define BUILTIN(handler, macros, blind, side, min, max) \ - M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max) - - builtin_functions -#undef BUILTIN - - { NULL, NULL, 0, 0, 0 }, -}; - - -void -include_import (m4 *context, m4_module *module, m4_obstack *obs) -{ - m4_install_builtins (context, module, m4_builtin_table); -} - - - -typedef bool export_test_func (const char *); -typedef bool no_such_func (const char *); - -/** - * import() - **/ -M4BUILTIN_HANDLER (import) -{ - M4_MODULE_IMPORT (modtest, export_test); - - const char *s = "`import'::`import' called."; - - assert (obs != 0); - obstack_grow (obs, s, strlen(s)); - - if (export_test && export_test (M4ARG (1))) - fputs ("TRUE\n", stderr); -} - -/** - * symbol_fail() - **/ -M4BUILTIN_HANDLER (symbol_fail) -{ - M4_MODULE_IMPORT (modtest, no_such); - - const char *s = "`import'::`symbol_fail' called."; - - assert (obs != 0); - obstack_grow (obs, s, strlen(s)); - - if (no_such && no_such (M4ARG (1))) - fputs ("TRUE\n", stderr); -} - -/** - * module_fail() - **/ -M4BUILTIN_HANDLER (module_fail) -{ - M4_MODULE_IMPORT (no_such, no_such); - - const char *s = "`import'::`module_fail' called."; - - assert (obs != 0); - obstack_grow (obs, s, strlen(s)); - - if (no_such && no_such (M4ARG (1))) - fputs ("TRUE\n", stderr); -} diff --git a/modules/modtest.c b/modules/modtest.c deleted file mode 100644 index 2026431d..00000000 --- a/modules/modtest.c +++ /dev/null @@ -1,101 +0,0 @@ -/* GNU m4 -- A simple macro processor - Copyright (C) 1999-2001, 2003-2004, 2006-2008, 2010, 2013 Free - Software Foundation, Inc. - - This file is part of GNU M4. - - GNU M4 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 of the License, or - (at your option) any later version. - - GNU M4 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 this program. If not, see . -*/ - -#include - -/* Build using only the exported interfaces, unless NDEBUG is set, in - which case use private symbols to speed things up as much as possible. */ -#ifndef NDEBUG -# include -#else -# include "m4private.h" -#endif - -extern bool export_test (const char *foo); - -/* function macros blind side minargs maxargs */ -#define builtin_functions \ - BUILTIN (test, false, false, false, 0, 0) - -#define BUILTIN(handler, macros, blind, side, min, max) M4BUILTIN (handler) - builtin_functions -#undef BUILTIN - -static const m4_builtin m4_builtin_table[] = -{ -#define BUILTIN(handler, macros, blind, side, min, max) \ - M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max) - - builtin_functions -#undef BUILTIN - - { NULL, NULL, 0, 0, 0 }, -}; - -static const m4_macro m4_macro_table[] = -{ - /* name text min max */ - { "__test__", "`modtest'", 0, 0 }, - { "onearg", "$1", 1, 1 }, - { "manyargs", "$@", 0, SIZE_MAX }, - { NULL, NULL, 0, 0 }, -}; - - - -/** - * modtest() - **/ -void -include_modtest (m4 *context, m4_module *module, m4_obstack *obs) -{ - const char *s = "Test module loaded.\n"; - - m4_install_builtins (context, module, m4_builtin_table); - m4_install_macros (context, module, m4_macro_table); - - /* Don't depend on OBS so that the traces are the same when used - directly, or via a frozen file. */ - fputs (s, stderr); -} - - -/** - * test() - **/ -M4BUILTIN_HANDLER (test) -{ - const char *s = "Test module called."; - - assert (obs != 0); - obstack_grow (obs, s, strlen(s)); -} - - -/** - * export_test() - **/ -bool -export_test (const char *foo) -{ - if (foo) - xfprintf (stderr, "%s\n", foo); - return (bool) (foo != 0); -} diff --git a/modules/shadow.c b/modules/shadow.c deleted file mode 100644 index 2247f397..00000000 --- a/modules/shadow.c +++ /dev/null @@ -1,91 +0,0 @@ -/* GNU m4 -- A simple macro processor - Copyright (C) 1999-2000, 2006-2008, 2010, 2013 Free Software - Foundation, Inc. - - This file is part of GNU M4. - - GNU M4 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 of the License, or - (at your option) any later version. - - GNU M4 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 this program. If not, see . -*/ - -#include - -/* Build using only the exported interfaces, unless NDEBUG is set, in - which case use private symbols to speed things up as much as possible. */ -#ifndef NDEBUG -# include -#else -# include "m4private.h" -#endif - -/* function macros blind side minargs maxargs */ -#define builtin_functions \ - BUILTIN (shadow, false, false, false, 0, -1 ) \ - BUILTIN (test, false, false, false, 0, -1 ) \ - - -#define BUILTIN(handler, macros, blind, side, min, max) M4BUILTIN (handler) - builtin_functions -#undef BUILTIN - -static const m4_builtin m4_builtin_table[] = -{ -#define BUILTIN(handler, macros, blind, side, min, max) \ - M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max) - - builtin_functions -#undef BUILTIN - - { NULL, NULL, 0, 0, 0 }, -}; - -static const m4_macro m4_macro_table[] = -{ - /* name text min max */ - { "__test__", "`shadow'", 0, 0 }, - { NULL, NULL, 0, 0 }, -}; - - - -void -include_shadow (m4 *context, m4_module *module, m4_obstack *obs) -{ - const char *s = "Shadow module loaded."; - - if (obs) - obstack_grow (obs, s, strlen (s)); - - m4_install_builtins (context, module, m4_builtin_table); - m4_install_macros (context, module, m4_macro_table); -} - - - -/** - * shadow() - **/ -M4BUILTIN_HANDLER (shadow) -{ - const char *s = "Shadow::`shadow' called."; - obstack_grow (obs, s, strlen (s)); -} - -/** - * test() - **/ -M4BUILTIN_HANDLER (test) -{ - const char *s = "Shadow::`test' called."; - obstack_grow (obs, s, strlen (s)); -} diff --git a/tests/import.c b/tests/import.c new file mode 100644 index 00000000..9f03493c --- /dev/null +++ b/tests/import.c @@ -0,0 +1,110 @@ +/* GNU m4 -- A simple macro processor + Copyright (C) 2003, 2006-2008, 2010, 2013 Free Software Foundation, + Inc. + + This file is part of GNU M4. + + GNU M4 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 of the License, or + (at your option) any later version. + + GNU M4 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 this program. If not, see . +*/ + +#include + +/* Build using only the exported interfaces, unless NDEBUG is set, in + which case use private symbols to speed things up as much as possible. */ +#ifndef NDEBUG +# include +#else +# include "m4private.h" +#endif + +/* function macros blind side minargs maxargs */ +#define builtin_functions \ + BUILTIN (import, false, false, false, 0, 1) \ + BUILTIN (symbol_fail, false, false, false, 0, 1) \ + BUILTIN (module_fail, false, false, false, 0, 1) \ + +#define BUILTIN(handler, macros, blind, side, min, max) M4BUILTIN (handler) + builtin_functions +#undef BUILTIN + +static const m4_builtin m4_builtin_table[] = +{ +#define BUILTIN(handler, macros, blind, side, min, max) \ + M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max) + + builtin_functions +#undef BUILTIN + + { NULL, NULL, 0, 0, 0 }, +}; + + +void +include_import (m4 *context, m4_module *module, m4_obstack *obs) +{ + m4_install_builtins (context, module, m4_builtin_table); +} + + + +typedef bool export_test_func (const char *); +typedef bool no_such_func (const char *); + +/** + * import() + **/ +M4BUILTIN_HANDLER (import) +{ + M4_MODULE_IMPORT (modtest, export_test); + + const char *s = "`import'::`import' called."; + + assert (obs != 0); + obstack_grow (obs, s, strlen(s)); + + if (export_test && export_test (M4ARG (1))) + fputs ("TRUE\n", stderr); +} + +/** + * symbol_fail() + **/ +M4BUILTIN_HANDLER (symbol_fail) +{ + M4_MODULE_IMPORT (modtest, no_such); + + const char *s = "`import'::`symbol_fail' called."; + + assert (obs != 0); + obstack_grow (obs, s, strlen(s)); + + if (no_such && no_such (M4ARG (1))) + fputs ("TRUE\n", stderr); +} + +/** + * module_fail() + **/ +M4BUILTIN_HANDLER (module_fail) +{ + M4_MODULE_IMPORT (no_such, no_such); + + const char *s = "`import'::`module_fail' called."; + + assert (obs != 0); + obstack_grow (obs, s, strlen(s)); + + if (no_such && no_such (M4ARG (1))) + fputs ("TRUE\n", stderr); +} diff --git a/tests/modtest.c b/tests/modtest.c new file mode 100644 index 00000000..2026431d --- /dev/null +++ b/tests/modtest.c @@ -0,0 +1,101 @@ +/* GNU m4 -- A simple macro processor + Copyright (C) 1999-2001, 2003-2004, 2006-2008, 2010, 2013 Free + Software Foundation, Inc. + + This file is part of GNU M4. + + GNU M4 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 of the License, or + (at your option) any later version. + + GNU M4 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 this program. If not, see . +*/ + +#include + +/* Build using only the exported interfaces, unless NDEBUG is set, in + which case use private symbols to speed things up as much as possible. */ +#ifndef NDEBUG +# include +#else +# include "m4private.h" +#endif + +extern bool export_test (const char *foo); + +/* function macros blind side minargs maxargs */ +#define builtin_functions \ + BUILTIN (test, false, false, false, 0, 0) + +#define BUILTIN(handler, macros, blind, side, min, max) M4BUILTIN (handler) + builtin_functions +#undef BUILTIN + +static const m4_builtin m4_builtin_table[] = +{ +#define BUILTIN(handler, macros, blind, side, min, max) \ + M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max) + + builtin_functions +#undef BUILTIN + + { NULL, NULL, 0, 0, 0 }, +}; + +static const m4_macro m4_macro_table[] = +{ + /* name text min max */ + { "__test__", "`modtest'", 0, 0 }, + { "onearg", "$1", 1, 1 }, + { "manyargs", "$@", 0, SIZE_MAX }, + { NULL, NULL, 0, 0 }, +}; + + + +/** + * modtest() + **/ +void +include_modtest (m4 *context, m4_module *module, m4_obstack *obs) +{ + const char *s = "Test module loaded.\n"; + + m4_install_builtins (context, module, m4_builtin_table); + m4_install_macros (context, module, m4_macro_table); + + /* Don't depend on OBS so that the traces are the same when used + directly, or via a frozen file. */ + fputs (s, stderr); +} + + +/** + * test() + **/ +M4BUILTIN_HANDLER (test) +{ + const char *s = "Test module called."; + + assert (obs != 0); + obstack_grow (obs, s, strlen(s)); +} + + +/** + * export_test() + **/ +bool +export_test (const char *foo) +{ + if (foo) + xfprintf (stderr, "%s\n", foo); + return (bool) (foo != 0); +} diff --git a/tests/shadow.c b/tests/shadow.c new file mode 100644 index 00000000..2247f397 --- /dev/null +++ b/tests/shadow.c @@ -0,0 +1,91 @@ +/* GNU m4 -- A simple macro processor + Copyright (C) 1999-2000, 2006-2008, 2010, 2013 Free Software + Foundation, Inc. + + This file is part of GNU M4. + + GNU M4 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 of the License, or + (at your option) any later version. + + GNU M4 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 this program. If not, see . +*/ + +#include + +/* Build using only the exported interfaces, unless NDEBUG is set, in + which case use private symbols to speed things up as much as possible. */ +#ifndef NDEBUG +# include +#else +# include "m4private.h" +#endif + +/* function macros blind side minargs maxargs */ +#define builtin_functions \ + BUILTIN (shadow, false, false, false, 0, -1 ) \ + BUILTIN (test, false, false, false, 0, -1 ) \ + + +#define BUILTIN(handler, macros, blind, side, min, max) M4BUILTIN (handler) + builtin_functions +#undef BUILTIN + +static const m4_builtin m4_builtin_table[] = +{ +#define BUILTIN(handler, macros, blind, side, min, max) \ + M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max) + + builtin_functions +#undef BUILTIN + + { NULL, NULL, 0, 0, 0 }, +}; + +static const m4_macro m4_macro_table[] = +{ + /* name text min max */ + { "__test__", "`shadow'", 0, 0 }, + { NULL, NULL, 0, 0 }, +}; + + + +void +include_shadow (m4 *context, m4_module *module, m4_obstack *obs) +{ + const char *s = "Shadow module loaded."; + + if (obs) + obstack_grow (obs, s, strlen (s)); + + m4_install_builtins (context, module, m4_builtin_table); + m4_install_macros (context, module, m4_macro_table); +} + + + +/** + * shadow() + **/ +M4BUILTIN_HANDLER (shadow) +{ + const char *s = "Shadow::`shadow' called."; + obstack_grow (obs, s, strlen (s)); +} + +/** + * test() + **/ +M4BUILTIN_HANDLER (test) +{ + const char *s = "Shadow::`test' called."; + obstack_grow (obs, s, strlen (s)); +} -- cgit v1.2.1