summaryrefslogtreecommitdiffstats
path: root/src/if_mzsch.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 08:50:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 08:50:31 +0000
commitaed8ce9da277f5ecffe968b324f242c41c3b752a (patch)
treed2e538394cb7a8a7c42a4aac6ccf1a8e3256999b /src/if_mzsch.h
parentInitial commit. (diff)
downloadvim-aed8ce9da277f5ecffe968b324f242c41c3b752a.tar.xz
vim-aed8ce9da277f5ecffe968b324f242c41c3b752a.zip
Adding upstream version 2:9.0.1378.upstream/2%9.0.1378upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/if_mzsch.h')
-rw-r--r--src/if_mzsch.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/src/if_mzsch.h b/src/if_mzsch.h
new file mode 100644
index 0000000..6f5cd33
--- /dev/null
+++ b/src/if_mzsch.h
@@ -0,0 +1,76 @@
+/* vi:set ts=8 sts=4 sw=4 noet:
+ *
+ * MzScheme interface for Vim, wrapper around scheme.h
+ */
+#ifndef _IF_MZSCH_H_
+#define _IF_MZSCH_H_
+#ifdef __MINGW32__
+// Hack to engage Cygwin-specific settings
+# define __CYGWIN32__
+# include <stdint.h>
+#endif
+
+#ifdef PROTO
+// avoid syntax error for defining Thread_Local_Variables.
+# define __thread // empty
+#endif
+
+// #ifdef needed for "make depend"
+#ifdef FEAT_MZSCHEME
+# include <schvers.h>
+# include <scheme.h>
+#endif
+
+#ifdef __MINGW32__
+# undef __CYGWIN32__
+#endif
+
+#if MZSCHEME_VERSION_MAJOR >= 299
+# define SCHEME_STRINGP(obj) (SCHEME_BYTE_STRINGP(obj) || SCHEME_CHAR_STRINGP(obj))
+# define BYTE_STRING_VALUE(obj) ((char_u *)SCHEME_BYTE_STR_VAL(obj))
+#else
+// macros for compatibility with older versions
+# define scheme_current_config() scheme_config
+# define scheme_make_sized_byte_string scheme_make_sized_string
+# define scheme_format_utf8 scheme_format
+# ifndef DYNAMIC_MZSCHEME
+// for dynamic MzScheme there will be separate definitions in if_mzsch.c
+# define scheme_get_sized_byte_string_output scheme_get_sized_string_output
+# define scheme_make_byte_string scheme_make_string
+# define scheme_make_byte_string_output_port scheme_make_string_output_port
+# endif
+
+# define SCHEME_BYTE_STRLEN_VAL SCHEME_STRLEN_VAL
+# define BYTE_STRING_VALUE(obj) ((char_u *)SCHEME_STR_VAL(obj))
+# define scheme_byte_string_to_char_string(obj) (obj)
+# define SCHEME_BYTE_STRINGP SCHEME_STRINGP
+#endif
+
+// Precise GC macros
+#ifndef MZ_GC_DECL_REG
+# define MZ_GC_DECL_REG(size) // empty
+#endif
+#ifndef MZ_GC_VAR_IN_REG
+# define MZ_GC_VAR_IN_REG(x, v) // empty
+#endif
+#ifndef MZ_GC_ARRAY_VAR_IN_REG
+# define MZ_GC_ARRAY_VAR_IN_REG(x, v, l) // empty
+#endif
+#ifndef MZ_GC_REG
+# define MZ_GC_REG() // empty
+#endif
+#ifndef MZ_GC_UNREG
+# define MZ_GC_UNREG() // empty
+#endif
+
+#ifdef MZSCHEME_FORCE_GC
+/*
+ * force garbage collection to check all references are registered
+ * seg faults will indicate not registered refs
+ */
+# define MZ_GC_CHECK() scheme_collect_garbage();
+#else
+# define MZ_GC_CHECK() // empty
+#endif
+
+#endif // _IF_MZSCH_H_