blob: 8852602c098f9f1d9df60938e136d165c8355c4c [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 Moolenaard90b6c02016-08-28 18:10:45 +020013#ifdef PROTO
14/* avoid syntax error for defining Thread_Local_Variables. */
15# define __thread /* empty */
16#endif
17
Bram Moolenaar76b92b22006-03-24 22:46:53 +000018/* #ifdef needed for "make depend" */
19#ifdef FEAT_MZSCHEME
Bram Moolenaar9e70cf12009-05-26 20:59:55 +000020# include <schvers.h>
Bram Moolenaar76b92b22006-03-24 22:46:53 +000021# include <scheme.h>
22#endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +000023
24#ifdef __MINGW32__
25# undef __CYGWIN32__
26#endif
27
28#if MZSCHEME_VERSION_MAJOR >= 299
Bram Moolenaar325b7a22004-07-05 15:58:32 +000029# define SCHEME_STRINGP(obj) (SCHEME_BYTE_STRINGP(obj) || SCHEME_CHAR_STRINGP(obj))
Bram Moolenaar75676462013-01-30 14:55:42 +010030# define BYTE_STRING_VALUE(obj) ((char_u *)SCHEME_BYTE_STR_VAL(obj))
Bram Moolenaar325b7a22004-07-05 15:58:32 +000031#else
Bram Moolenaar75676462013-01-30 14:55:42 +010032/* 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
Bram Moolenaar325b7a22004-07-05 15:58:32 +000043# define SCHEME_BYTE_STRLEN_VAL SCHEME_STRLEN_VAL
Bram Moolenaar75676462013-01-30 14:55:42 +010044# define BYTE_STRING_VALUE(obj) ((char_u *)SCHEME_STR_VAL(obj))
Bram Moolenaar555b2802005-05-19 21:08:39 +000045# define scheme_byte_string_to_char_string(obj) (obj)
Bram Moolenaar75676462013-01-30 14:55:42 +010046# define SCHEME_BYTE_STRINGP SCHEME_STRINGP
Bram Moolenaar325b7a22004-07-05 15:58:32 +000047#endif
48
Bram Moolenaar9e70cf12009-05-26 20:59:55 +000049/* Precise GC macros */
50#ifndef MZ_GC_DECL_REG
Bram Moolenaar55d5c032010-07-17 23:52:29 +020051# define MZ_GC_DECL_REG(size) /* empty */
Bram Moolenaar9e70cf12009-05-26 20:59:55 +000052#endif
53#ifndef MZ_GC_VAR_IN_REG
Bram Moolenaar55d5c032010-07-17 23:52:29 +020054# define MZ_GC_VAR_IN_REG(x, v) /* empty */
Bram Moolenaar9e70cf12009-05-26 20:59:55 +000055#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
Bram Moolenaar55d5c032010-07-17 23:52:29 +020060# define MZ_GC_REG() /* empty */
Bram Moolenaar9e70cf12009-05-26 20:59:55 +000061#endif
62#ifndef MZ_GC_UNREG
Bram Moolenaar55d5c032010-07-17 23:52:29 +020063# define MZ_GC_UNREG() /* empty */
Bram Moolenaar9e70cf12009-05-26 20:59:55 +000064#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
Bram Moolenaar325b7a22004-07-05 15:58:32 +000076#endif /* _IF_MZSCH_H_ */