1 /* vi:set ts=8 sts=4 sw=4 noet:
2  *
3  * MzScheme interface for Vim, wrapper around scheme.h
4  */
5 #ifndef _IF_MZSCH_H_
6 #define _IF_MZSCH_H_
7 #ifdef __MINGW32__
8 // Hack to engage Cygwin-specific settings
9 # define __CYGWIN32__
10 # include <stdint.h>
11 #endif
12 
13 #ifdef PROTO
14 // avoid syntax error for defining Thread_Local_Variables.
15 # define __thread // empty
16 #endif
17 
18 // #ifdef needed for "make depend"
19 #ifdef FEAT_MZSCHEME
20 # include <schvers.h>
21 # include <scheme.h>
22 #endif
23 
24 #ifdef __MINGW32__
25 # undef __CYGWIN32__
26 #endif
27 
28 #if MZSCHEME_VERSION_MAJOR >= 299
29 # define SCHEME_STRINGP(obj) (SCHEME_BYTE_STRINGP(obj) || SCHEME_CHAR_STRINGP(obj))
30 # define BYTE_STRING_VALUE(obj) ((char_u *)SCHEME_BYTE_STR_VAL(obj))
31 #else
32 // macros for compatibility with older versions
33 # define scheme_current_config() scheme_config
34 # define scheme_make_sized_byte_string scheme_make_sized_string
35 # define scheme_format_utf8 scheme_format
36 # ifndef DYNAMIC_MZSCHEME
37 // for dynamic MzScheme there will be separate definitions in if_mzsch.c
38 #  define scheme_get_sized_byte_string_output scheme_get_sized_string_output
39 #  define scheme_make_byte_string scheme_make_string
40 #  define scheme_make_byte_string_output_port scheme_make_string_output_port
41 # endif
42 
43 # define SCHEME_BYTE_STRLEN_VAL SCHEME_STRLEN_VAL
44 # define BYTE_STRING_VALUE(obj) ((char_u *)SCHEME_STR_VAL(obj))
45 # define scheme_byte_string_to_char_string(obj) (obj)
46 # define SCHEME_BYTE_STRINGP SCHEME_STRINGP
47 #endif
48 
49 // Precise GC macros
50 #ifndef MZ_GC_DECL_REG
51 # define MZ_GC_DECL_REG(size)		 // empty
52 #endif
53 #ifndef MZ_GC_VAR_IN_REG
54 # define MZ_GC_VAR_IN_REG(x, v)		 // empty
55 #endif
56 #ifndef MZ_GC_ARRAY_VAR_IN_REG
57 # define MZ_GC_ARRAY_VAR_IN_REG(x, v, l) // empty
58 #endif
59 #ifndef MZ_GC_REG
60 # define MZ_GC_REG()			 // empty
61 #endif
62 #ifndef MZ_GC_UNREG
63 # define MZ_GC_UNREG()			 // empty
64 #endif
65 
66 #ifdef MZSCHEME_FORCE_GC
67 /*
68  * force garbage collection to check all references are registered
69  * seg faults will indicate not registered refs
70  */
71 # define MZ_GC_CHECK() scheme_collect_garbage();
72 #else
73 # define MZ_GC_CHECK()			// empty
74 #endif
75 
76 #endif // _IF_MZSCH_H_
77