// SPDX-License-Identifier: MIT // Copyright (c) 2023 John Watts and the LuminaSensum contributors #ifndef MODULE_H #define MODULE_H #include "object.h" #include "types.h" // Finds a module by its name // This internally loads the module and dependencies // A new reference is created for the caller Object module_find(VmState state, const char *name); // Frees all modules loaded internally // You must call this at the end of your program void modules_free(VmState state); // The following section is an internal API for use only with // the compiler's C code generator. Do not use for regular C code. #ifdef MODULE_INTERNAL_API // A class in a module struct module_class { int fields_count; }; typedef struct module_class ModuleClass; // Data structure for creating a module struct module_info { const char *name; const char **uses; ModuleClass **classes; Object (*create)(VmState state, Object use_modules); }; typedef struct module_info ModuleInfo; #endif #endif