1 |
/* argmatch.h -- definitions and prototypes for argmatch.c |
/* argmatch.h -- definitions and prototypes for argmatch.c |
2 |
Copyright (C) 1990, 1998, 1999, 2001 Free Software Foundation, Inc. |
Copyright (C) 1990, 1998, 1999, 2001, 2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
5 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
40 |
cost, since it will be statically evalauted to `assert (0)' or |
cost, since it will be statically evalauted to `assert (0)' or |
41 |
`assert (1)'. Unfortunately there is no -Wassert-0. */ |
`assert (1)'. Unfortunately there is no -Wassert-0. */ |
42 |
|
|
|
# undef ARRAY_CARDINALITY |
|
43 |
# define ARRAY_CARDINALITY(Array) (sizeof ((Array)) / sizeof (*(Array))) |
# define ARRAY_CARDINALITY(Array) (sizeof ((Array)) / sizeof (*(Array))) |
44 |
|
|
45 |
# define ARGMATCH_ASSERT(Arglist, Vallist) \ |
# define ARGMATCH_CONSTRAINT(Arglist, Vallist) \ |
46 |
assert (ARRAY_CARDINALITY ((Arglist)) == ARRAY_CARDINALITY ((Vallist)) + 1) |
(ARRAY_CARDINALITY ((Arglist)) == ARRAY_CARDINALITY ((Vallist)) + 1) |
47 |
|
# define ARGMATCH_ASSERT(Arglist, Vallist) \ |
48 |
|
assert (ARGMATCH_CONSTRAINT (Arglist, Vallist)) |
49 |
|
|
50 |
/* Return the index of the element of ARGLIST (NULL terminated) that |
/* Return the index of the element of ARGLIST (NULL terminated) that |
51 |
matches with ARG. If VALLIST is not NULL, then use it to resolve |
matches with ARG. If VALLIST is not NULL, then use it to resolve |