- def native_c_unitary_enum_map(self, struct_name, variants):
- out_c = "static inline " + struct_name + " " + struct_name + "_from_js(int32_t ord) {\n"
+ def var_decl_statement(self, ty_string, var_name, statement):
+ return "const " + var_name + ": " + ty_string + " = " + statement
+
+ def get_ptr(self, var):
+ return "CommonBase.get_ptr_of(" + var + ")"
+ def set_null_skip_free(self, var):
+ return "CommonBase.set_null_skip_free(" + var + ");"
+
+ def add_ref(self, holder, referent):
+ return "CommonBase.add_ref_from(" + holder + ", " + referent + ")"
+
+ def obj_defined(self, struct_names, folder):
+ with open(self.outdir + "/index.mts", 'a') as index:
+ index.write(f"export * from './{folder}/{struct_names[0]}.mjs';\n")
+ with open(self.outdir + "/imports.mts.part", 'a') as imports:
+ imports.write(f"import {{ {', '.join(struct_names)} }} from '../{folder}/{struct_names[0]}.mjs';\n")
+
+ def native_c_unitary_enum_map(self, struct_name, variants, enum_doc_comment):
+ out_c = "static inline LDK" + struct_name + " LDK" + struct_name + "_from_js(int32_t ord) {\n"