diff options
author | Michael Smith <mikesmiffy128@gmail.com> | 2022-07-31 16:02:10 +0100 |
---|---|---|
committer | Michael Smith <mikesmiffy128@gmail.com> | 2022-08-10 22:40:52 +0100 |
commit | 5e921bf59373d79d27c322ff86e8b5a37b151e45 (patch) | |
tree | 4d40e39543b085ce4c8cb9b1a7b3c0108de680c0 /src/build/cmeta.h | |
parent | c8d7588251fd4fe63ac6afe2a90ca7066c786609 (diff) |
Add magical feature codegen system, at long last
Diffstat (limited to 'src/build/cmeta.h')
-rw-r--r-- | src/build/cmeta.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/build/cmeta.h b/src/build/cmeta.h index 125ce2c..40c4ac5 100644 --- a/src/build/cmeta.h +++ b/src/build/cmeta.h @@ -40,6 +40,39 @@ void cmeta_conmacros(const struct cmeta *cm, void (*cb)(const char *name, bool isvar, bool unreg)); /* + * Looks for a feature description macro in file, returning the description + * string if it exists, an empty string if the feature is defined without a + * user-facing description, and null if source file does not define a feature. + */ +const char *cmeta_findfeatmacro(const struct cmeta *cm); + +/* + * the various kinds of feature specficiation macros, besides the feature + * declaration macro itself + */ +enum cmeta_featmacro { + CMETA_FEAT_REQUIRE, + CMETA_FEAT_REQUIREGD, + CMETA_FEAT_REQUIREGLOBAL, + CMETA_FEAT_REQUEST, + CMETA_FEAT_PREINIT, + CMETA_FEAT_INIT, + CMETA_FEAT_END +}; + +/* + * Iterates through all feature dependency macros and init/end/preinit + * indicators, passing each bit of information to the callback cb. + * + * PREINT, INIT and END macros don't pass anything to param. + * + * This one takes a context pointer, while the others don't, because this is all + * cobbled together without much consistent abstraction. + */ +void cmeta_featinfomacros(const struct cmeta *cm, void (*cb)( + enum cmeta_featmacro type, const char *param, void *ctxt), void *ctxt); + +/* * Iterates through all event-related macros and takes note of which events are * defined, giving a callback for each. */ |