blob: 7c1766ebbce96bbca442b3a7b37806e34a098431 [file] [log] [blame]
Bram Moolenaar325b7a22004-07-05 15:58:32 +00001/* vi:set ts=8 sts=4 sw=4:
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__
Bram Moolenaar75676462013-01-30 14:55:42 +010010# include <stdint.h>
Bram Moolenaar325b7a22004-07-05 15:58:32 +000011#endif
12
Bram Moolenaar76b92b22006-03-24 22:46:53 +000013/* #ifdef needed for "make depend" */
14#ifdef FEAT_MZSCHEME
Bram Moolenaar9e70cf12009-05-26 20:59:55 +000015# include <schvers.h>
Bram Moolenaar76b92b22006-03-24 22:46:53 +000016# include <scheme.h>
17#endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +000018
19#ifdef __MINGW32__
20# undef __CYGWIN32__
21#endif
22
23#if MZSCHEME_VERSION_MAJOR >= 299
Bram Moolenaar325b7a22004-07-05 15:58:32 +000024# define SCHEME_STRINGP(obj) (SCHEME_BYTE_STRINGP(obj) || SCHEME_CHAR_STRINGP(obj))
Bram Moolenaar75676462013-01-30 14:55:42 +010025# define BYTE_STRING_VALUE(obj) ((char_u *)SCHEME_BYTE_STR_VAL(obj))
Bram Moolenaar325b7a22004-07-05 15:58:32 +000026#else
Bram Moolenaar75676462013-01-30 14:55:42 +010027/* macros for compatibility with older versions */
28# define scheme_current_config() scheme_config
29# define scheme_make_sized_byte_string scheme_make_sized_string
30# define scheme_format_utf8 scheme_format
31# ifndef DYNAMIC_MZSCHEME
32/* for dynamic MzScheme there will be separate definitions in if_mzsch.c */
33# define scheme_get_sized_byte_string_output scheme_get_sized_string_output
34# define scheme_make_byte_string scheme_make_string
35# define scheme_make_byte_string_output_port scheme_make_string_output_port
36# endif
37
Bram Moolenaar325b7a22004-07-05 15:58:32 +000038# define SCHEME_BYTE_STRLEN_VAL SCHEME_STRLEN_VAL
Bram Moolenaar75676462013-01-30 14:55:42 +010039# define BYTE_STRING_VALUE(obj) ((char_u *)SCHEME_STR_VAL(obj))
Bram Moolenaar555b2802005-05-19 21:08:39 +000040# define scheme_byte_string_to_char_string(obj) (obj)
Bram Moolenaar75676462013-01-30 14:55:42 +010041# define SCHEME_BYTE_STRINGP SCHEME_STRINGP
Bram Moolenaar325b7a22004-07-05 15:58:32 +000042#endif
43
Bram Moolenaar9e70cf12009-05-26 20:59:55 +000044/* Precise GC macros */
45#ifndef MZ_GC_DECL_REG
Bram Moolenaar55d5c032010-07-17 23:52:29 +020046# define MZ_GC_DECL_REG(size) /* empty */
Bram Moolenaar9e70cf12009-05-26 20:59:55 +000047#endif
48#ifndef MZ_GC_VAR_IN_REG
Bram Moolenaar55d5c032010-07-17 23:52:29 +020049# define MZ_GC_VAR_IN_REG(x, v) /* empty */
Bram Moolenaar9e70cf12009-05-26 20:59:55 +000050#endif
51#ifndef MZ_GC_ARRAY_VAR_IN_REG
52# define MZ_GC_ARRAY_VAR_IN_REG(x, v, l) /* empty */
53#endif
54#ifndef MZ_GC_REG
Bram Moolenaar55d5c032010-07-17 23:52:29 +020055# define MZ_GC_REG() /* empty */
Bram Moolenaar9e70cf12009-05-26 20:59:55 +000056#endif
57#ifndef MZ_GC_UNREG
Bram Moolenaar55d5c032010-07-17 23:52:29 +020058# define MZ_GC_UNREG() /* empty */
Bram Moolenaar9e70cf12009-05-26 20:59:55 +000059#endif
60
61#ifdef MZSCHEME_FORCE_GC
62/*
63 * force garbage collection to check all references are registered
64 * seg faults will indicate not registered refs
65 */
66# define MZ_GC_CHECK() scheme_collect_garbage();
67#else
68# define MZ_GC_CHECK() /* empty */
69#endif
70
Bram Moolenaar325b7a22004-07-05 15:58:32 +000071#endif /* _IF_MZSCH_H_ */