diff options
author | Paul Smith <psmith@gnu.org> | 2013-10-05 16:10:30 -0400 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2013-10-05 16:10:30 -0400 |
commit | 2fb91e19a02ff8a3e43145d582cfebaf3a60f1d9 (patch) | |
tree | 7bd7b902fd68f6df94c90d7544184067031a2502 /gnumake.h | |
parent | f96c114e22c26dbcd18b7c16590b5e0ef0c58fe9 (diff) | |
download | gunmake-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.h | 20 |
1 files changed, 13 insertions, 7 deletions
@@ -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_ */ |