Dumb refactoring of manifest loading.
[tlb/tomd.git] / include / macros.h
index 9c9fa4e..aabab76 100644 (file)
@@ -3,4 +3,15 @@
 
 #define tomd_p(...) {printf("[tomd] "); printf(__VA_ARGS__); printf("\n");}
 #define SCM_ARR(arr, index) (scm_list_ref(arr, scm_from_int(index)))
+#define SCM_LIST_LEN(list) (scm_to_int(scm_length(list)))
+#define WRAP_SCM_FUNCTION_1(module, scm_name, name)    \
+SCM name(SCM obj) {                                  \
+  static SCM func_ref = SCM_UNDEFINED;               \
+  if(func_ref == SCM_UNDEFINED){                     \
+    func_ref = scm_c_public_ref(module, scm_name);   \
+  }                                                  \
+  return scm_call(func_ref, obj, SCM_UNDEFINED);     \
+}
+  
+  
 #endif