blob: 6f5cd3365ba261cb24eb841f99e72d3ba6f3890e [file] [log] [blame]
Bram Moolenaaredf3f972016-08-29 22:49:24 +02001/* vi:set ts=8 sts=4 sw=4 noet:
Bram Moolenaar325b7a22004-07-05 15:58:32 +00002 *
3 * MzScheme interface for Vim, wrapper around scheme.h
4 */
5#ifndef _IF_MZSCH_H_
6#define _IF_MZSCH_H_
7#ifdef __MINGW32__
Bram Moolenaar9bf703d2019-11-30 19:44:38 +01008// Hack to engage Cygwin-specific settings
Bram Moolenaar325b7a22004-07-05 15:58:32 +00009# 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
Bram Moolenaar9bf703d2019-11-30 19:44:38 +010014// avoid syntax error for defining Thread_Local_Variables.
15# define __thread // empty
Bram Moolenaard90b6c02016-08-28 18:10:45 +020016#endif
17
Bram Moolenaar9bf703d2019-11-30 19:44:38 +010018// #ifdef needed for "make depend"
Bram Moolenaar76b92b22006-03-24 22:46:53 +000019#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 Moolenaar9bf703d2019-11-30 19:44:38 +010032// macros for compatibility with older versions
Bram Moolenaar75676462013-01-30 14:55:42 +010033# 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
Bram Moolenaar9bf703d2019-11-30 19:44:38 +010037// for dynamic MzScheme there will be separate definitions in if_mzsch.c
Bram Moolenaar75676462013-01-30 14:55:42 +010038# 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 Moolenaar9bf703d2019-11-30 19:44:38 +010049// Precise GC macros
Bram Moolenaar9e70cf12009-05-26 20:59:55 +000050#ifndef MZ_GC_DECL_REG
Bram Moolenaar9bf703d2019-11-30 19:44:38 +010051# define MZ_GC_DECL_REG(size) // empty
Bram Moolenaar9e70cf12009-05-26 20:59:55 +000052#endif
53#ifndef MZ_GC_VAR_IN_REG
Bram Moolenaar9bf703d2019-11-30 19:44:38 +010054# 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
Bram Moolenaar9bf703d2019-11-30 19:44:38 +010057# define MZ_GC_ARRAY_VAR_IN_REG(x, v, l) // empty
Bram Moolenaar9e70cf12009-05-26 20:59:55 +000058#endif
59#ifndef MZ_GC_REG
Bram Moolenaar9bf703d2019-11-30 19:44:38 +010060# define MZ_GC_REG() // empty
Bram Moolenaar9e70cf12009-05-26 20:59:55 +000061#endif
62#ifndef MZ_GC_UNREG
Bram Moolenaar9bf703d2019-11-30 19:44:38 +010063# 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
Bram Moolenaar9bf703d2019-11-30 19:44:38 +010073# define MZ_GC_CHECK() // empty
Bram Moolenaar9e70cf12009-05-26 20:59:55 +000074#endif
75
Bram Moolenaar9bf703d2019-11-30 19:44:38 +010076#endif // _IF_MZSCH_H_