Commentary in job.scm that explains usage.
[tlb/tomd.git] / include / macros.h
1 #ifndef _MACROS_H
2 #define _MACROS_H
3
4 #include <errno.h>
5
6 #define tomd_panic(...) { \
7 printf("[tomd]PANIC "); \
8 printf(__VA_ARGS__); \
9 printf(" errno=%d\n", errno); \
10 for(;;){} \
11 }
12 #define tomc_p(...) {printf("[tomc] "); printf(__VA_ARGS__); printf("\n");}
13 #define tomd_p(...) {printf("[tomd] "); printf(__VA_ARGS__); printf("\n");}
14 #define SCM_ARR(arr, index) (scm_list_ref(arr, scm_from_int(index)))
15 #define SCM_LIST_LEN(list) (scm_to_int(scm_length(list)))
16 #define WRAP_SCM_FUNCTION_1(module, scm_name, name) \
17 SCM name(SCM obj) { \
18 static SCM func_ref = SCM_UNDEFINED; \
19 if(func_ref == SCM_UNDEFINED){ \
20 func_ref = scm_c_public_ref(module, scm_name); \
21 } \
22 return scm_call(func_ref, obj, SCM_UNDEFINED); \
23 }
24
25 #endif