Made changes to get tomd working as a init program.
[tlb/tomd.git] / include / macros.h
CommitLineData
57c82614
TB
1#ifndef _MACROS_H
2#define _MACROS_H
3
229b92de
TB
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 }
1110e851
TB
12#define tomc_p(...) {printf("[tomc] "); printf(__VA_ARGS__); printf("\n");}
13#define tomd_p(...) {printf("[tomd] "); printf(__VA_ARGS__); printf("\n");}
811f95df 14#define SCM_ARR(arr, index) (scm_list_ref(arr, scm_from_int(index)))
3024ed65
TB
15#define SCM_LIST_LEN(list) (scm_to_int(scm_length(list)))
16#define WRAP_SCM_FUNCTION_1(module, scm_name, name) \
17SCM 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}
229b92de 24
57c82614 25#endif