Readd the janet_register function.

This commit is contained in:
bakpakin 2021-08-22 10:23:18 -05:00
parent 257c8b65c2
commit 7734e77dfc
2 changed files with 8 additions and 0 deletions

View File

@ -545,6 +545,11 @@ void janet_cfuns_ext_prefix(JanetTable *env, const char *regprefix, const JanetR
if (env) namebuf_deinit(&nb);
}
/* Register a value in the global registry */
void janet_register(const char *name, JanetCFunction cfun) {
janet_registry_put(cfun, name, NULL, NULL, 0);
}
/* Abstract type introspection */
void janet_register_abstract_type(const JanetAbstractType *at) {

View File

@ -1852,6 +1852,9 @@ JANET_API void janet_cfuns_ext_prefix(JanetTable *env, const char *regprefix, co
JANET_API void janet_def_sm(JanetTable *env, const char *name, Janet val, const char *documentation, const char *source_file, int32_t source_line);
JANET_API void janet_var_sm(JanetTable *env, const char *name, Janet val, const char *documentation, const char *source_file, int32_t source_line);
/* Legacy definition of C functions */
JANET_API void janet_register(const char *name, JanetCFunction cfun);
/* Allow setting entry name for static libraries */
#ifdef __cplusplus
#define JANET_MODULE_PREFIX extern "C"