diff options
author | Eric Blake <ebb9@byu.net> | 2006-08-25 22:06:41 +0000 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2007-10-06 06:53:26 -0600 |
commit | 832c5ebd68485d063867639f987fec7a8a4f58aa (patch) | |
tree | 3fb412b2acaddf907e5eff96ae27d4cfe249ebf3 /modules/stdlib.c | |
parent | 397d36e80cd39461bb5b2b3f2bb8879ea8d4e99a (diff) | |
download | m4-832c5ebd68485d063867639f987fec7a8a4f58aa.tar.gz |
* m4/m4module.h (M4_BUILTIN_GROKS_MACRO, M4_BUILTIN_BLIND)
(M4_BUILTIN_SIDE_EFFECT): New enumerators.
(struct m4_builtin): New member flags replaces groks_macro_args,
blind_if_no_args. min_args and max_args are now 0-based.
Rearrange members to reduce size on platforms where function
pointers are 64 bits but regular pointers are 32.
(m4_bad_argc): Add argument.
* m4/m4private.h (VALUE_SIDE_EFFECT_ARGS_BIT): New define.
* m4/utility.c (m4_bad_argc): Simplify calculation, and take side
effect into account.
* m4/module.c (install_builtin_table): Adjust all users affected
by this API change.
* m4/macro.c (m4_macro_call): Likewise.
* src/freeze.c (reload_frozen_state): Likewise.
* modules/m4.c (builtin_functions, ifelse, syscmd): Likewise.
* modules/gnu.c (builtin_functions, builtin, esyscmd): Likewise.
* modules/import.c (builtin_functions): Likewise.
* modules/load.c (builtin_functions): Likewise.
* modules/modtest.c (builtin_functions): Likewise.
* modules/mpeval.c (builtin_f
Diffstat (limited to 'modules/stdlib.c')
-rw-r--r-- | modules/stdlib.c | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/modules/stdlib.c b/modules/stdlib.c index a5187494..44e89783 100644 --- a/modules/stdlib.c +++ b/modules/stdlib.c @@ -1,5 +1,5 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,37 +36,41 @@ #define m4_builtin_table stdlib_LTX_m4_builtin_table -/* function macros blind minargs maxargs */ +/* function macros blind side minargs maxargs */ #define builtin_functions \ - BUILTIN (getcwd, false, false, 1, 1 ) \ - BUILTIN (getenv, false, true, 2, 2 ) \ - BUILTIN (getlogin, false, false, 1, 1 ) \ - BUILTIN (getpid, false, false, 1, 1 ) \ - BUILTIN (getppid, false, false, 1, 1 ) \ - BUILTIN (getuid, false, false, 1, 1 ) \ - BUILTIN (getpwnam, false, true, 2, 2 ) \ - BUILTIN (getpwuid, false, true, 2, 2 ) \ - BUILTIN (hostname, false, false, 1, 1 ) \ - BUILTIN (rand, false, false, 1, 1 ) \ - BUILTIN (srand, false, false, 1, 2 ) \ - BUILTIN (setenv, false, true, 3, 4 ) \ - BUILTIN (unsetenv, false, true, 2, 2 ) \ - BUILTIN (uname, false, false, 1, 1 ) \ - - -#define BUILTIN(handler, macros, blind, min, max) M4BUILTIN(handler); + BUILTIN (getcwd, false, false, false, 0, 0 ) \ + BUILTIN (getenv, false, true, false, 1, 1 ) \ + BUILTIN (getlogin, false, false, false, 0, 0 ) \ + BUILTIN (getpid, false, false, false, 0, 0 ) \ + BUILTIN (getppid, false, false, false, 0, 0 ) \ + BUILTIN (getuid, false, false, false, 0, 0 ) \ + BUILTIN (getpwnam, false, true, false, 1, 1 ) \ + BUILTIN (getpwuid, false, true, false, 1, 1 ) \ + BUILTIN (hostname, false, false, false, 0, 0 ) \ + BUILTIN (rand, false, false, false, 0, 0 ) \ + BUILTIN (srand, false, false, false, 0, 1 ) \ + BUILTIN (setenv, false, true, false, 2, 3 ) \ + BUILTIN (unsetenv, false, true, false, 1, 1 ) \ + BUILTIN (uname, false, false, false, 0, 0 ) \ + + +#define BUILTIN(handler, macros, blind, side, min, max) M4BUILTIN(handler); builtin_functions #undef BUILTIN m4_builtin m4_builtin_table[] = { -#define BUILTIN(handler, macros, blind, min, max) \ - { STR(handler), CONC(builtin_, handler), macros, blind, min, max }, +#define BUILTIN(handler, macros, blind, side, min, max) \ + { CONC(builtin_, handler), STR(handler), \ + ((macros ? M4_BUILTIN_GROKS_MACRO : 0) \ + | (blind ? M4_BUILTIN_BLIND : 0) \ + | (side ? M4_BUILTIN_SIDE_EFFECT : 0)), \ + min, max }, builtin_functions #undef BUILTIN - { 0, 0, false, false, 0, 0 }, + { NULL, NULL, 0, 0, 0 }, }; /** |