summaryrefslogtreecommitdiff
path: root/gnumake.h
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2013-10-05 16:10:30 -0400
committerPaul Smith <psmith@gnu.org>2013-10-05 16:10:30 -0400
commit2fb91e19a02ff8a3e43145d582cfebaf3a60f1d9 (patch)
tree7bd7b902fd68f6df94c90d7544184067031a2502 /gnumake.h
parentf96c114e22c26dbcd18b7c16590b5e0ef0c58fe9 (diff)
downloadgunmake-2fb91e19a02ff8a3e43145d582cfebaf3a60f1d9.tar.gz
Sanitize the registered function interface.
Expand the characters which are legal in a function name, and check the name for validity. Create a type for the function pointer. Convert the last argument from a boolean to flags, to allow for expansion.
Diffstat (limited to 'gnumake.h')
-rw-r--r--gnumake.h20
1 files changed, 13 insertions, 7 deletions
diff --git a/gnumake.h b/gnumake.h
index dbf303b..94d725e 100644
--- a/gnumake.h
+++ b/gnumake.h
@@ -26,6 +26,7 @@ typedef struct
unsigned long lineno;
} gmk_floc;
+typedef char *(*gmk_func_ptr)(const char *nm, unsigned int argc, char **argv);
#ifdef _WIN32
# ifdef GMK_BUILDING_MAKE
@@ -60,14 +61,19 @@ GMK_EXPORT char *gmk_expand (const char *str);
MIN_ARGS is the minimum number of arguments the function requires.
MAX_ARGS is the maximum number of arguments (or 0 if there's no maximum).
- MIN_ARGS and MAX_ARGS must be >= 0 and <= 255.
+ MIN_ARGS and MAX_ARGS may not exceed 255.
- If EXPAND_ARGS is 0, the arguments to the function will not be expanded
- before FUNC is called. If EXPAND_ARGS is non-0, they will be expanded.
+ The FLAGS value may be GMK_FUNC_DEFAULT, or one or more of the following
+ flags OR'd together:
+
+ GMK_FUNC_NOEXPAND: the arguments to the function will be not be expanded
+ before FUNC is called.
*/
-GMK_EXPORT void gmk_add_function (const char *name,
- char *(*func)(const char *nm,
- int argc, char **argv),
- int min_args, int max_args, int expand_args);
+GMK_EXPORT void gmk_add_function (const char *name, gmk_func_ptr func,
+ unsigned int min_args, unsigned int max_args,
+ unsigned int flags);
+
+#define GMK_FUNC_DEFAULT 0x00
+#define GMK_FUNC_NOEXPAND 0x01
#endif /* _GNUMAKE_H_ */