1
0
forked from aniani/vim

patch 7.4.1104

Problem:    Various problems building with MzScheme/Racket.
Solution:   Make it work with new versions of Racket. (Yukihiro Nakadaira, Ken
            Takata)
This commit is contained in:
Bram Moolenaar
2016-01-16 16:20:38 +01:00
parent d125001297
commit 4e640bd930
8 changed files with 641 additions and 279 deletions

View File

@@ -13,6 +13,7 @@ The MzScheme Interface to Vim *mzscheme* *MzScheme*
5. mzeval() Vim function |mzscheme-mzeval|
6. Using Function references |mzscheme-funcref|
7. Dynamic loading |mzscheme-dynamic|
8. MzScheme setup |mzscheme-setup|
{Vi does not have any of these commands}
@@ -272,6 +273,9 @@ output then includes |+mzscheme/dyn|.
This means that Vim will search for the MzScheme DLL files only when needed.
When you don't use the MzScheme interface you don't need them, thus you can
use Vim without these DLL files.
NOTE: Newer version of MzScheme (Racket) require earlier (trampolined)
initialisation via scheme_main_setup. So Vim always loads the MzScheme DLL at
startup if possible.
To use the MzScheme interface the MzScheme DLLs must be in your search path.
In a console window type "path" to see what directories are used.
@@ -282,5 +286,24 @@ For MzScheme version 209 they will be "libmzsch209_000.dll" and
command, look for -DDYNAMIC_MZSCH_DLL="something" and
-DDYNAMIC_MZGC_DLL="something" in the "Compilation" info.
For example, if MzScheme (Racket) is installed at C:\Racket63, you may need
to set the environment variable as the following: >
PATH=%PATH%;C:\Racket63\lib
PLTCOLLECTS=C:\Racket63\collects
PLTCONFIGDIR=C:\Racket63\etc
<
==============================================================================
8. MzScheme setup *mzscheme-setup*
Vim requires "racket/base" module for if_mzsch core (fallback to "scheme/base"
if it doesn't exist), "r5rs" module for test and "raco ctool" command for
building Vim. If MzScheme did not have them, you can install them with
MzScheme's raco command:
>
raco pkg install scheme-lib # scheme/base module
raco pkg install r5rs-lib # r5rs module
raco pkg install cext-lib # raco ctool command
<
======================================================================
vim:tw=78:ts=8:sts=4:ft=help:norl:

View File

@@ -24,7 +24,7 @@ Contents:
5. Cross compiling for Win32 from a Linux machine
6. Building with Python support
7. Building with Python3 support
8. Building with MzScheme support
8. Building with MzScheme/Racket support
9. Building with Lua support
10. Building with Perl support
11. Building with Ruby support
@@ -415,8 +415,10 @@ E.g. When using MSVC (as one line):
PYTHON3=C:\Python34 DYNAMIC_PYTHON3=yes PYTHON3_VER=34
8. Building with MzScheme support
=================================
8. Building with MzScheme/Racket support
========================================
1) Building with MzScheme support
(written by Sergey Khorev <sergey.khorev@gmail.com>)
@@ -451,30 +453,74 @@ After a successful build, these dlls can be freely removed, leaving them in
%WINDOWS%\System32 only.
2) Building with Racket support
MzScheme and PLT Scheme names have been rebranded as Racket. Vim with Racket
(https://racket-lang.org/) support can be built with either MSVC or MinGW (or
Cygwin).
You need to set the following variables:
MZSCHEME: Where Racket is installed.
E.g. C:\Program Files (x86)\Racket
DYNAMIC_MZSCHEME: Whether dynamic linking is used. Usually, set to yes.
MZSCHEME_VER: Racket DLL version. E.g. 3m_9z0ds0 for Racket 6.3.
MZSCHEME_COLLECTS: (Optional) Path of the collects directory used at
runtime. Default: $(MZSCHEME)\collects
User can override this with the PLTCOLLECTS environment
variable.
E.g. When using MSVC (as one line):
nmake -f Make_mvc.mak
MZSCHEME="C:\Program Files (x86)\Racket" DYNAMIC_MZSCHEME=yes
MZSCHEME_VER=3m_9z0ds0
Or when using MinGW (as one line):
mingw32-make -f Make_ming.mak
MZSCHEME='C:/Program\ Files\ (x86)/Racket' DYNAMIC_MZSCHEME=yes
MZSCHEME_VER=3m_9z0ds0
Spaces should be escaped with '\'.
9. Building with Lua support
============================
Vim with Lua support can be built with either MSVC or MinGW (or Cygwin).
You can use binaries from LuaBinaries.
http://luabinaries.sourceforge.net/
Vim with Lua support can be built with either MSVC or MinGW (or maybe Cygwin).
You can use binaries from LuaBinaries: http://luabinaries.sourceforge.net/
This also applies to when you get a Vim executable and don't build yourself,
do the part up to "Build".
1) Download and install LuaBinaries
Go to the Download page of LuaBinaries:
http://luabinaries.sourceforge.net/download.html
Download lua-X.Y.Z_Win32_dllw4_lib.zip for x86 or
lua-X.Y.Z_Win64_dllw4_lib.zip for x64. You can use them for both MSVC and
lua-X.Y.Z_Win64_dllw4_lib.zip for x64. You can use them both for MSVC and
MinGW.
Unpack it to a working directory. E.g. C:\projects\lua53.
Lua's header files will be installed under the include directory.
Copy luaXY.dll to your Windows system directory. The system directory depends
on your Windows bitness and Vim bitness:
32-bit Vim on 32-bit Windows: C:\Windows\System32
32-bit Vim on 64-bit Windows: C:\Windows\SysWOW64
64-bit Vim on 64-bit Windows: C:\Windows\System32
Or another option is copying luaXY.dll to the directory where gvim.exe
(or vim.exe) is.
2) Build
You need to set the following variables:
LUA: Where Lua is installed. E.g. C:\projects\lua53.
DYNAMIC_LUA: Whether dynamic linking is used. Usually, set to yes.
You need to set LUA, DYNAMIC_LUA and LUA_VER.
LUA: Where Lua's header files are installed. E.g. C:\projects\lua53.
DYNAMIC_LUA: Whether dynamic linking is used. Set to yes.
LUA_VER: Lua version. E.g. 53 for Lua 5.3.X.
E.g. When using MSVC (as one line):
@@ -487,7 +533,8 @@ Or when using MinGW (as one line):
mingw32-make -f Make_mingw.mak
LUA=C:\projects\lua53 DYNAMIC_LUA=yes LUA_VER=53
Or when using Cygwin (as one line):
Or when using Cygwin (as one line) (untested):
make -f Make_cyg.mak
LUA=/cygdrive/c/projects/lua53 DYNAMIC_LUA=yes LUA_VER=53

View File

@@ -171,26 +171,37 @@ ifndef MZSCHEME_VER
MZSCHEME_VER=205_000
endif
ifndef MZSCHEME_PRECISE_GC
MZSCHEME_PRECISE_GC=no
endif
# for version 4.x we need to generate byte-code for Scheme base
ifndef MZSCHEME_GENERATE_BASE
MZSCHEME_GENERATE_BASE=no
endif
ifndef MZSCHEME_USE_RACKET
ifneq ($(wildcard $(MZSCHEME)/lib/msvc/libmzsch$(MZSCHEME_VER).lib),)
MZSCHEME_MAIN_LIB=mzsch
else
MZSCHEME_MAIN_LIB=racket
endif
ifndef MZSCHEME_PRECISE_GC
MZSCHEME_PRECISE_GC=no
ifneq ($(wildcard $(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll),)
ifeq ($(wildcard $(MZSCHEME)\lib\libmzgc$(MZSCHEME_VER).dll),)
MZSCHEME_PRECISE_GC=yes
endif
else
ifneq ($(wildcard $(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib),)
ifeq ($(wildcard $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib),)
MZSCHEME_PRECISE_GC=yes
endif
endif
endif
endif
ifeq (no,$(DYNAMIC_MZSCHEME))
ifeq (yes,$(MZSCHEME_PRECISE_GC))
MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER)
else
MZSCHEME_LIB = -l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
endif
# the modern MinGW can dynamically link to dlls directly.
# point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll
@@ -429,10 +440,21 @@ endif
endif
ifdef MZSCHEME
CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME)/collects\"
ifndef MZSCHEME_COLLECTS
MZSCHEME_COLLECTS=$(MZSCHEME)/collects
ifeq (yes, $(UNDER_CYGWIN))
MZSCHEME_COLLECTS:=$(shell cygpath -m $(MZSCHEME_COLLECTS) | sed -e 's/ /\\ /g')
endif
endif
CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME_COLLECTS)\"
ifeq (yes, $(DYNAMIC_MZSCHEME))
ifeq (yes, $(MZSCHEME_PRECISE_GC))
# Precise GC does not use separate dll
CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\"
else
CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
endif
endif
ifeq (yes, "$(MZSCHEME_DEBUG)")
CFLAGS += -DMZSCHEME_FORCE_GC
endif

View File

@@ -755,43 +755,52 @@ PYTHON3_LIB = $(PYTHON3)\libs\python$(PYTHON3_VER).lib
!ifndef MZSCHEME_VER
MZSCHEME_VER = 205_000
!endif
CFLAGS = $(CFLAGS) -DFEAT_MZSCHEME -I $(MZSCHEME)\include
!if EXIST("$(MZSCHEME)\collects\scheme\base.ss") \
|| EXIST("$(MZSCHEME)\collects\scheme\base.rkt") \
|| EXIST("$(MZSCHEME)\collects\racket\base.rkt")
# for MzScheme >= 4 we need to include byte code for basic Scheme stuff
MZSCHEME_EXTRA_DEP = mzscheme_base.c
CFLAGS = $(CFLAGS) -DINCLUDE_MZSCHEME_BASE
!ifndef MZSCHEME_COLLECTS
MZSCHEME_COLLECTS=$(MZSCHEME)\collects
!endif
CFLAGS = $(CFLAGS) -DFEAT_MZSCHEME -I "$(MZSCHEME)\include"
!if EXIST("$(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib")
MZSCHEME_MAIN_LIB=mzsch
!else
MZSCHEME_MAIN_LIB=racket
!endif
!if EXIST("$(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib") \
&& !EXIST("$(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib")
!if (EXIST("$(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll") \
&& !EXIST("$(MZSCHEME)\lib\libmzgc$(MZSCHEME_VER).dll")) \
|| (EXIST("$(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib") \
&& !EXIST("$(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib"))
!message Building with Precise GC
MZSCHEME_PRECISE_GC = yes
CFLAGS = $(CFLAGS) -DMZ_PRECISE_GC
!endif
!if "$(DYNAMIC_MZSCHEME)" == "yes"
!if "$(MZSCHEME_PRECISE_GC)" == "yes"
!error MzScheme with Precise GC cannot be loaded dynamically
!endif
!message MzScheme DLLs will be loaded dynamically
CFLAGS = $(CFLAGS) -DDYNAMIC_MZSCHEME \
CFLAGS = $(CFLAGS) -DDYNAMIC_MZSCHEME
!if "$(MZSCHEME_PRECISE_GC)" == "yes"
# Precise GC does not use separate dll
CFLAGS = $(CFLAGS) \
-DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" \
-DDYNAMIC_MZGC_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\"
!else
CFLAGS = $(CFLAGS) \
-DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" \
-DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
!endif
!else
!if "$(MZSCHEME_DEBUG)" == "yes"
CFLAGS = $(CFLAGS) -DMZSCHEME_FORCE_GC
!endif
!if "$(MZSCHEME_PRECISE_GC)" == "yes"
# Precise GC does not use separate dll
MZSCHEME_LIB = $(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib
!if EXIST("$(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).def")
# create .lib from .def
MZSCHEME_LIB = lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib
MZSCHEME_EXTRA_DEP = lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib
!else
MZSCHEME_LIB = $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib \
$(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib
MZSCHEME_LIB = "$(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib"
!endif
!else
MZSCHEME_LIB = "$(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib" \
"$(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib"
!endif
!endif
MZSCHEME_OBJ = $(OUTDIR)\if_mzsch.obj
@@ -1059,7 +1068,6 @@ clean:
- if exist dimm_i.c del dimm_i.c
- if exist dimm.tlb del dimm.tlb
- if exist dosinst.exe del dosinst.exe
- if exist mzscheme_base.c del mzscheme_base.c
cd xxd
$(MAKE) /NOLOGO -f Make_mvc.mak clean
cd ..
@@ -1172,13 +1180,10 @@ $(OUTDIR)/if_perlsfio.obj: $(OUTDIR) if_perlsfio.c $(INCL)
$(OUTDIR)/if_mzsch.obj: $(OUTDIR) if_mzsch.c if_mzsch.h $(INCL) $(MZSCHEME_EXTRA_DEP)
$(CC) $(CFLAGS) if_mzsch.c \
-DMZSCHEME_COLLECTS=\"$(MZSCHEME:\=\\)\\collects\"
mzscheme_base.c:
!IF "$(MZSCHEME_MAIN_LIB)" == "racket"
$(MZSCHEME)\raco ctool --c-mods mzscheme_base.c ++lib scheme/base
!ELSE
$(MZSCHEME)\mzc --c-mods mzscheme_base.c ++lib scheme/base
!ENDIF
-DMZSCHEME_COLLECTS="\"$(MZSCHEME_COLLECTS:\=\\)\""
lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib:
lib /DEF:"$(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).def"
$(OUTDIR)/if_python.obj: $(OUTDIR) if_python.c if_py_both.h $(INCL)
$(CC) $(CFLAGS) $(PYTHON_INC) if_python.c

97
src/auto/configure vendored
View File

@@ -5207,6 +5207,7 @@ fi
if test "X$with_plthome" != "X"; then
vi_cv_path_mzscheme_pfx="$with_plthome"
vi_cv_path_mzscheme="${vi_cv_path_mzscheme_pfx}/bin/mzscheme"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking PLTHOME environment var" >&5
$as_echo_n "checking PLTHOME environment var... " >&6; }
@@ -5214,6 +5215,7 @@ $as_echo_n "checking PLTHOME environment var... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$PLTHOME\"" >&5
$as_echo "\"$PLTHOME\"" >&6; }
vi_cv_path_mzscheme_pfx="$PLTHOME"
vi_cv_path_mzscheme="${vi_cv_path_mzscheme_pfx}/bin/mzscheme"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not set" >&5
$as_echo "not set" >&6; }
@@ -5285,8 +5287,16 @@ $as_echo "$vi_cv_path_mzscheme_pfx" >&6; }
fi
fi
SCHEME_INC=
if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for racket include directory" >&5
$as_echo_n "checking for racket include directory... " >&6; }
SCHEME_INC=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-include-dir))) (when (path? p) (display p)))'`
if test "X$SCHEME_INC" != "X"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${SCHEME_INC}" >&5
$as_echo "${SCHEME_INC}" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
$as_echo "not found" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include" >&5
$as_echo_n "checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include... " >&6; }
if test -f "$vi_cv_path_mzscheme_pfx/include/scheme.h"; then
@@ -5339,43 +5349,92 @@ $as_echo "no" >&6; }
fi
fi
fi
fi
if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for racket lib directory" >&5
$as_echo_n "checking for racket lib directory... " >&6; }
SCHEME_LIB=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-lib-dir))) (when (path? p) (display p)))'`
if test "X$SCHEME_LIB" != "X"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${SCHEME_LIB}" >&5
$as_echo "${SCHEME_LIB}" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
$as_echo "not found" >&6; }
fi
for path in "${vi_cv_path_mzscheme_pfx}/lib" "${SCHEME_LIB}"; do
if test "X$path" != "X"; then
if test "x$MACOSX" = "xyes"; then
MZSCHEME_LIBS="-framework Racket"
MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"; then
MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"
elif test -f "${path}/libmzscheme3m.a"; then
MZSCHEME_LIBS="${path}/libmzscheme3m.a"
MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket3m.a"; then
MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libracket3m.a"
elif test -f "${path}/libracket3m.a"; then
MZSCHEME_LIBS="${path}/libracket3m.a"
MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket.a"; then
MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libracket.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"
elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a"; then
MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"
elif test -f "${path}/libracket.a"; then
MZSCHEME_LIBS="${path}/libracket.a ${path}/libmzgc.a"
elif test -f "${path}/libmzscheme.a"; then
MZSCHEME_LIBS="${path}/libmzscheme.a ${path}/libmzgc.a"
else
if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.so"; then
MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme3m"
if test -f "${path}/libmzscheme3m.so"; then
MZSCHEME_LIBS="-L${path} -lmzscheme3m"
MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket3m.so"; then
MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lracket3m"
elif test -f "${path}/libracket3m.so"; then
MZSCHEME_LIBS="-L${path} -lracket3m"
MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket.so"; then
MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lracket -lmzgc"
elif test -f "${path}/libracket.so"; then
MZSCHEME_LIBS="-L${path} -lracket -lmzgc"
else
MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc"
if test "$path" != "$SCHEME_LIB"; then
continue
fi
MZSCHEME_LIBS="-L${path} -lmzscheme -lmzgc"
fi
if test "$GCC" = yes; then
MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${vi_cv_path_mzscheme_pfx}/lib"
MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${path}"
elif test "`(uname) 2>/dev/null`" = SunOS &&
uname -r | grep '^5' >/dev/null; then
MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${vi_cv_path_mzscheme_pfx}/lib"
MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${path}"
fi
fi
fi
if test "X$MZSCHEME_LIBS" != "X"; then
break
fi
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if racket requires -pthread" >&5
$as_echo_n "checking if racket requires -pthread... " >&6; }
if test "X$SCHEME_LIB" != "X" && $FGREP -e -pthread "$SCHEME_LIB/buildinfo" >/dev/null ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
MZSCHEME_LIBS="${MZSCHEME_LIBS} -pthread"
MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -pthread"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for racket config directory" >&5
$as_echo_n "checking for racket config directory... " >&6; }
SCHEME_CONFIGDIR=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-config-dir))) (when (path? p) (display p)))'`
if test "X$SCHEME_CONFIGDIR" != "X"; then
MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DMZSCHEME_CONFIGDIR='\"${SCHEME_CONFIGDIR}\"'"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${SCHEME_CONFIGDIR}" >&5
$as_echo "${SCHEME_CONFIGDIR}" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
$as_echo "not found" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for racket collects directory" >&5
$as_echo_n "checking for racket collects directory... " >&6; }
SCHEME_COLLECTS=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-collects-dir))) (when (path? p) (let-values (((base _1 _2) (split-path p))) (display base))))'`
if test "X$SCHEME_COLLECTS" = "X"; then
if test -d "$vi_cv_path_mzscheme_pfx/lib/plt/collects"; then
SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/plt/
else
@@ -5391,6 +5450,7 @@ $as_echo_n "checking for racket collects directory... " >&6; }
fi
fi
fi
fi
if test "X$SCHEME_COLLECTS" != "X" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${SCHEME_COLLECTS}" >&5
$as_echo "${SCHEME_COLLECTS}" >&6; }
@@ -5420,7 +5480,6 @@ $as_echo_n "checking for mzscheme_base.c... " >&6; }
fi
if test "X$MZSCHEME_EXTRA" != "X" ; then
MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE"
MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: needed" >&5
$as_echo "needed" >&6; }
else

View File

@@ -695,11 +695,13 @@ if test "$enable_mzschemeinterp" = "yes"; then
if test "X$with_plthome" != "X"; then
vi_cv_path_mzscheme_pfx="$with_plthome"
vi_cv_path_mzscheme="${vi_cv_path_mzscheme_pfx}/bin/mzscheme"
else
AC_MSG_CHECKING(PLTHOME environment var)
if test "X$PLTHOME" != "X"; then
AC_MSG_RESULT("$PLTHOME")
vi_cv_path_mzscheme_pfx="$PLTHOME"
vi_cv_path_mzscheme="${vi_cv_path_mzscheme_pfx}/bin/mzscheme"
else
AC_MSG_RESULT(not set)
dnl -- try to find MzScheme executable
@@ -731,8 +733,13 @@ if test "$enable_mzschemeinterp" = "yes"; then
fi
fi
SCHEME_INC=
if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
AC_MSG_CHECKING(for racket include directory)
SCHEME_INC=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-include-dir))) (when (path? p) (display p)))'`
if test "X$SCHEME_INC" != "X"; then
AC_MSG_RESULT(${SCHEME_INC})
else
AC_MSG_RESULT(not found)
AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include)
if test -f "$vi_cv_path_mzscheme_pfx/include/scheme.h"; then
SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include
@@ -770,45 +777,86 @@ if test "$enable_mzschemeinterp" = "yes"; then
fi
fi
fi
fi
if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
AC_MSG_CHECKING(for racket lib directory)
SCHEME_LIB=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-lib-dir))) (when (path? p) (display p)))'`
if test "X$SCHEME_LIB" != "X"; then
AC_MSG_RESULT(${SCHEME_LIB})
else
AC_MSG_RESULT(not found)
fi
for path in "${vi_cv_path_mzscheme_pfx}/lib" "${SCHEME_LIB}"; do
if test "X$path" != "X"; then
if test "x$MACOSX" = "xyes"; then
MZSCHEME_LIBS="-framework Racket"
MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"; then
MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"
elif test -f "${path}/libmzscheme3m.a"; then
MZSCHEME_LIBS="${path}/libmzscheme3m.a"
MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket3m.a"; then
MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libracket3m.a"
elif test -f "${path}/libracket3m.a"; then
MZSCHEME_LIBS="${path}/libracket3m.a"
MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket.a"; then
MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libracket.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"
elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a"; then
MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"
elif test -f "${path}/libracket.a"; then
MZSCHEME_LIBS="${path}/libracket.a ${path}/libmzgc.a"
elif test -f "${path}/libmzscheme.a"; then
MZSCHEME_LIBS="${path}/libmzscheme.a ${path}/libmzgc.a"
else
dnl Using shared objects
if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.so"; then
MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme3m"
if test -f "${path}/libmzscheme3m.so"; then
MZSCHEME_LIBS="-L${path} -lmzscheme3m"
MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket3m.so"; then
MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lracket3m"
elif test -f "${path}/libracket3m.so"; then
MZSCHEME_LIBS="-L${path} -lracket3m"
MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket.so"; then
MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lracket -lmzgc"
elif test -f "${path}/libracket.so"; then
MZSCHEME_LIBS="-L${path} -lracket -lmzgc"
else
MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc"
dnl try next until last
if test "$path" != "$SCHEME_LIB"; then
continue
fi
MZSCHEME_LIBS="-L${path} -lmzscheme -lmzgc"
fi
if test "$GCC" = yes; then
dnl Make Vim remember the path to the library. For when it's not in
dnl $LD_LIBRARY_PATH.
MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${vi_cv_path_mzscheme_pfx}/lib"
MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${path}"
elif test "`(uname) 2>/dev/null`" = SunOS &&
uname -r | grep '^5' >/dev/null; then
MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${vi_cv_path_mzscheme_pfx}/lib"
MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${path}"
fi
fi
fi
if test "X$MZSCHEME_LIBS" != "X"; then
break
fi
done
AC_MSG_CHECKING([if racket requires -pthread])
if test "X$SCHEME_LIB" != "X" && $FGREP -e -pthread "$SCHEME_LIB/buildinfo" >/dev/null ; then
AC_MSG_RESULT(yes)
MZSCHEME_LIBS="${MZSCHEME_LIBS} -pthread"
MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -pthread"
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING(for racket config directory)
SCHEME_CONFIGDIR=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-config-dir))) (when (path? p) (display p)))'`
if test "X$SCHEME_CONFIGDIR" != "X"; then
MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DMZSCHEME_CONFIGDIR='\"${SCHEME_CONFIGDIR}\"'"
AC_MSG_RESULT(${SCHEME_CONFIGDIR})
else
AC_MSG_RESULT(not found)
fi
AC_MSG_CHECKING(for racket collects directory)
SCHEME_COLLECTS=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-collects-dir))) (when (path? p) (let-values (((base _1 _2) (split-path p))) (display base))))'`
if test "X$SCHEME_COLLECTS" = "X"; then
if test -d "$vi_cv_path_mzscheme_pfx/lib/plt/collects"; then
SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/plt/
else
@@ -824,6 +872,7 @@ if test "$enable_mzschemeinterp" = "yes"; then
fi
fi
fi
fi
if test "X$SCHEME_COLLECTS" != "X" ; then
AC_MSG_RESULT(${SCHEME_COLLECTS})
else
@@ -851,7 +900,6 @@ if test "$enable_mzschemeinterp" = "yes"; then
if test "X$MZSCHEME_EXTRA" != "X" ; then
dnl need to generate bytecode for MzScheme base
MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE"
MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
AC_MSG_RESULT(needed)
else
AC_MSG_RESULT(not needed)

View File

@@ -29,6 +29,27 @@
* depend". */
#if defined(FEAT_MZSCHEME) || defined(PROTO)
/*
* scheme_register_tls_space is only available on 32-bit Windows until
* racket-6.3. See
* http://docs.racket-lang.org/inside/im_memoryalloc.html?q=scheme_register_tls_space
*/
#if MZSCHEME_VERSION_MAJOR >= 500 && defined(WIN32) \
&& defined(USE_THREAD_LOCAL) \
&& (!defined(_WIN64) || MZSCHEME_VERSION_MAJOR >= 603)
# define HAVE_TLS_SPACE 1
#endif
/*
* Since version 4.x precise GC requires trampolined startup.
* Futures and places in version 5.x need it too.
*/
#if defined(MZ_PRECISE_GC) && MZSCHEME_VERSION_MAJOR >= 400 \
|| MZSCHEME_VERSION_MAJOR >= 500 \
&& (defined(MZ_USE_FUTURES) || defined(MZ_USE_PLACES))
# define TRAMPOLINED_MZVIM_STARTUP
#endif
/* Base data structures */
#define SCHEME_VIMBUFFERP(obj) SAME_TYPE(SCHEME_TYPE(obj), mz_buffer_type)
#define SCHEME_VIMWINDOWP(obj) SAME_TYPE(SCHEME_TYPE(obj), mz_window_type)
@@ -138,9 +159,9 @@ static Scheme_Object *vim_window_validp(void *data, int, Scheme_Object **);
*/
static int vim_error_check(void);
static int do_mzscheme_command(exarg_T *, void *, Scheme_Closed_Prim *what);
static void startup_mzscheme(void);
static int startup_mzscheme(void);
static char *string_to_line(Scheme_Object *obj);
#if MZSCHEME_VERSION_MAJOR >= 500
#if MZSCHEME_VERSION_MAJOR >= 501
# define OUTPUT_LEN_TYPE intptr_t
#else
# define OUTPUT_LEN_TYPE long
@@ -237,7 +258,7 @@ static Scheme_Object *dll_scheme_true;
static Scheme_Thread **dll_scheme_current_thread_ptr;
static void (**dll_scheme_console_printf_ptr)(char *str, ...);
static void (**dll_scheme_console_output_ptr)(char *str, long len);
static void (**dll_scheme_console_output_ptr)(char *str, OUTPUT_LEN_TYPE len);
static void (**dll_scheme_notify_multithread_ptr)(int on);
static void *(*dll_GC_malloc)(size_t size_in_bytes);
@@ -255,6 +276,7 @@ static Scheme_Object *(*dll_scheme_apply)(Scheme_Object *rator, int num_rands,
static Scheme_Object *(*dll_scheme_builtin_value)(const char *name);
# if MZSCHEME_VERSION_MAJOR >= 299
static Scheme_Object *(*dll_scheme_byte_string_to_char_string)(Scheme_Object *s);
static Scheme_Object *(*dll_scheme_make_path)(const char *chars);
# endif
static void (*dll_scheme_close_input_port)(Scheme_Object *port);
static void (*dll_scheme_count_lines)(Scheme_Object *port);
@@ -264,7 +286,7 @@ static Scheme_Object *(*dll_scheme_current_continuation_marks)(void);
static Scheme_Object *(*dll_scheme_current_continuation_marks)(Scheme_Object *prompt_tag);
#endif
static void (*dll_scheme_display)(Scheme_Object *obj, Scheme_Object *port);
static char *(*dll_scheme_display_to_string)(Scheme_Object *obj, long *len);
static char *(*dll_scheme_display_to_string)(Scheme_Object *obj, OUTPUT_LEN_TYPE *len);
static int (*dll_scheme_eq)(Scheme_Object *obj1, Scheme_Object *obj2);
static Scheme_Object *(*dll_scheme_do_eval)(Scheme_Object *obj,
int _num_rands, Scheme_Object **rands, int val);
@@ -280,7 +302,7 @@ static char *(*dll_scheme_format)(char *format, int flen, int argc,
Scheme_Object **argv, long *rlen);
# else
static char *(*dll_scheme_format_utf8)(char *format, int flen, int argc,
Scheme_Object **argv, long *rlen);
Scheme_Object **argv, OUTPUT_LEN_TYPE *rlen);
static Scheme_Object *(*dll_scheme_get_param)(Scheme_Config *c, int pos);
# endif
static void (*dll_scheme_gc_ptr_ok)(void *p);
@@ -289,7 +311,7 @@ static char *(*dll_scheme_get_sized_string_output)(Scheme_Object *,
long *len);
# else
static char *(*dll_scheme_get_sized_byte_string_output)(Scheme_Object *,
long *len);
OUTPUT_LEN_TYPE *len);
# endif
static Scheme_Object *(*dll_scheme_intern_symbol)(const char *name);
static Scheme_Object *(*dll_scheme_lookup_global)(Scheme_Object *symbol,
@@ -354,10 +376,34 @@ static void (*dll_scheme_hash_set)(Scheme_Hash_Table *table,
static Scheme_Object *(*dll_scheme_hash_get)(Scheme_Hash_Table *table,
Scheme_Object *key);
static Scheme_Object *(*dll_scheme_make_double)(double d);
# ifdef INCLUDE_MZSCHEME_BASE
static Scheme_Object *(*dll_scheme_make_sized_byte_string)(char *chars,
long len, int copy);
static Scheme_Object *(*dll_scheme_namespace_require)(Scheme_Object *req);
static Scheme_Object *(*dll_scheme_dynamic_wind)(void (*pre)(void *), Scheme_Object *(* volatile act)(void *), void (* volatile post)(void *), Scheme_Object *(*jmp_handler)(void *), void * volatile data);
# ifdef MZ_PRECISE_GC
static void *(*dll_GC_malloc_one_tagged)(size_t size_in_bytes);
static void (*dll_GC_register_traversers)(short tag, Size_Proc size, Mark_Proc mark, Fixup_Proc fixup, int is_constant_size, int is_atomic);
# endif
# if MZSCHEME_VERSION_MAJOR >= 400
static void (*dll_scheme_init_collection_paths)(Scheme_Env *global_env, Scheme_Object *extra_dirs);
static void **(*dll_scheme_malloc_immobile_box)(void *p);
static void (*dll_scheme_free_immobile_box)(void **b);
# endif
# if MZSCHEME_VERSION_MAJOR >= 500
# ifdef TRAMPOLINED_MZVIM_STARTUP
static int (*dll_scheme_main_setup)(int no_auto_statics, Scheme_Env_Main _main, int argc, char **argv);
# if defined(IMPLEMENT_THREAD_LOCAL_VIA_WIN_TLS) || MZSCHEME_VERSION_MAJOR >= 603
static void (*dll_scheme_register_tls_space)(void *tls_space, int _tls_index);
# endif
# endif
# if defined(IMPLEMENT_THREAD_LOCAL_VIA_WIN_TLS) || defined(IMPLEMENT_THREAD_LOCAL_EXTERNALLY_VIA_PROC)
static Thread_Local_Variables *(*dll_scheme_external_get_thread_local_variables)(void);
# endif
# endif
# if MZSCHEME_VERSION_MAJOR >= 600
static void (*dll_scheme_embedded_load)(intptr_t len, const char *s, int predefined);
static void (*dll_scheme_register_embedded_load)(intptr_t len, const char *s);
static void (*dll_scheme_set_config_path)(Scheme_Object *p);
# endif
/* arrays are imported directly */
@@ -368,7 +414,9 @@ static Scheme_Object *(*dll_scheme_namespace_require)(Scheme_Object *req);
# define scheme_true dll_scheme_true
/* pointers are GetProceAddress'ed as pointers to pointer */
#if !defined(USE_THREAD_LOCAL) && !defined(LINK_EXTENSIONS_BY_TABLE)
# define scheme_current_thread (*dll_scheme_current_thread_ptr)
# endif
# define scheme_console_printf (*dll_scheme_console_printf_ptr)
# define scheme_console_output (*dll_scheme_console_output_ptr)
# define scheme_notify_multithread (*dll_scheme_notify_multithread_ptr)
@@ -384,6 +432,7 @@ static Scheme_Object *(*dll_scheme_namespace_require)(Scheme_Object *req);
# define scheme_builtin_value dll_scheme_builtin_value
# if MZSCHEME_VERSION_MAJOR >= 299
# define scheme_byte_string_to_char_string dll_scheme_byte_string_to_char_string
# define scheme_make_path dll_scheme_make_path
# endif
# define scheme_check_threads dll_scheme_check_threads
# define scheme_close_input_port dll_scheme_close_input_port
@@ -455,9 +504,39 @@ static Scheme_Object *(*dll_scheme_namespace_require)(Scheme_Object *req);
# define scheme_hash_set dll_scheme_hash_set
# define scheme_hash_get dll_scheme_hash_get
# define scheme_make_double dll_scheme_make_double
# ifdef INCLUDE_MZSCHEME_BASE
# define scheme_make_sized_byte_string dll_scheme_make_sized_byte_string
# define scheme_namespace_require dll_scheme_namespace_require
# define scheme_dynamic_wind dll_scheme_dynamic_wind
# ifdef MZ_PRECISE_GC
# define GC_malloc_one_tagged dll_GC_malloc_one_tagged
# define GC_register_traversers dll_GC_register_traversers
# endif
# if MZSCHEME_VERSION_MAJOR >= 400
# ifdef TRAMPOLINED_MZVIM_STARTUP
# define scheme_main_setup dll_scheme_main_setup
# if defined(IMPLEMENT_THREAD_LOCAL_VIA_WIN_TLS) || MZSCHEME_VERSION_MAJOR >= 603
# define scheme_register_tls_space dll_scheme_register_tls_space
# endif
# endif
# define scheme_init_collection_paths dll_scheme_init_collection_paths
# define scheme_malloc_immobile_box dll_scheme_malloc_immobile_box
# define scheme_free_immobile_box dll_scheme_free_immobile_box
# endif
# if MZSCHEME_VERSION_MAJOR >= 600
# define scheme_embedded_load dll_scheme_embedded_load
# define scheme_register_embedded_load dll_scheme_register_embedded_load
# define scheme_set_config_path dll_scheme_set_config_path
# endif
# if MZSCHEME_VERSION_MAJOR >= 500
# if defined(IMPLEMENT_THREAD_LOCAL_VIA_WIN_TLS) || defined(IMPLEMENT_THREAD_LOCAL_EXTERNALLY_VIA_PROC)
/* define as function for macro in schshread.h */
Thread_Local_Variables *
scheme_external_get_thread_local_variables(void)
{
return dll_scheme_external_get_thread_local_variables();
}
# endif
# endif
typedef struct
@@ -477,7 +556,9 @@ static Thunk_Info mzsch_imports[] = {
{"scheme_void", (void **)&dll_scheme_void},
{"scheme_null", (void **)&dll_scheme_null},
{"scheme_true", (void **)&dll_scheme_true},
#if !defined(USE_THREAD_LOCAL) && !defined(LINK_EXTENSIONS_BY_TABLE)
{"scheme_current_thread", (void **)&dll_scheme_current_thread_ptr},
#endif
{"scheme_console_printf", (void **)&dll_scheme_console_printf_ptr},
{"scheme_console_output", (void **)&dll_scheme_console_output_ptr},
{"scheme_notify_multithread",
@@ -488,6 +569,7 @@ static Thunk_Info mzsch_imports[] = {
{"scheme_basic_env", (void **)&dll_scheme_basic_env},
# if MZSCHEME_VERSION_MAJOR >= 299
{"scheme_byte_string_to_char_string", (void **)&dll_scheme_byte_string_to_char_string},
{"scheme_make_path", (void **)&dll_scheme_make_path},
# endif
{"scheme_builtin_value", (void **)&dll_scheme_builtin_value},
{"scheme_check_threads", (void **)&dll_scheme_check_threads},
@@ -564,10 +646,34 @@ static Thunk_Info mzsch_imports[] = {
{"scheme_hash_set", (void **)&dll_scheme_hash_set},
{"scheme_hash_get", (void **)&dll_scheme_hash_get},
{"scheme_make_double", (void **)&dll_scheme_make_double},
# ifdef INCLUDE_MZSCHEME_BASE
{"scheme_make_sized_byte_string", (void **)&dll_scheme_make_sized_byte_string},
{"scheme_namespace_require", (void **)&dll_scheme_namespace_require},
#endif
{"scheme_dynamic_wind", (void **)&dll_scheme_dynamic_wind},
# ifdef MZ_PRECISE_GC
{"GC_malloc_one_tagged", (void **)&dll_GC_malloc_one_tagged},
{"GC_register_traversers", (void **)&dll_GC_register_traversers},
# endif
# if MZSCHEME_VERSION_MAJOR >= 400
# ifdef TRAMPOLINED_MZVIM_STARTUP
{"scheme_main_setup", (void **)&dll_scheme_main_setup},
# if defined(IMPLEMENT_THREAD_LOCAL_VIA_WIN_TLS) || MZSCHEME_VERSION_MAJOR >= 603
{"scheme_register_tls_space", (void **)&dll_scheme_register_tls_space},
# endif
# endif
{"scheme_init_collection_paths", (void **)&dll_scheme_init_collection_paths},
{"scheme_malloc_immobile_box", (void **)&dll_scheme_malloc_immobile_box},
{"scheme_free_immobile_box", (void **)&dll_scheme_free_immobile_box},
# endif
# if MZSCHEME_VERSION_MAJOR >= 500
# if defined(IMPLEMENT_THREAD_LOCAL_VIA_WIN_TLS) || defined(IMPLEMENT_THREAD_LOCAL_EXTERNALLY_VIA_PROC)
{"scheme_external_get_thread_local_variables", (void **)&dll_scheme_external_get_thread_local_variables},
# endif
# endif
# if MZSCHEME_VERSION_MAJOR >= 600
{"scheme_embedded_load", (void **)&dll_scheme_embedded_load},
{"scheme_register_embedded_load", (void **)&dll_scheme_register_embedded_load},
{"scheme_set_config_path", (void **)&dll_scheme_set_config_path},
# endif
{NULL, NULL}};
static HINSTANCE hMzGC = 0;
@@ -687,8 +793,6 @@ guaranteed_byte_string_arg(char *proc, int num, int argc, Scheme_Object **argv)
/* need to put it here for dynamic stuff to work */
#if defined(INCLUDE_MZSCHEME_BASE)
# include "mzscheme_base.c"
#elif MZSCHEME_VERSION_MAJOR >= 400
# error MzScheme >=4 must include mzscheme_base.c, for MinGW32 you need to define MZSCHEME_GENERATE_BASE=yes
#endif
/*
@@ -701,6 +805,10 @@ static Scheme_Type mz_buffer_type;
static Scheme_Type mz_window_type;
static int initialized = FALSE;
#ifdef DYNAMIC_MZSCHEME
static int disabled = FALSE;
#endif
static int load_base_module_failed = FALSE;
/* global environment */
static Scheme_Env *environment = NULL;
@@ -846,38 +954,43 @@ notify_multithread(int on)
void
mzscheme_end(void)
{
/* We can not unload the DLL. Racket's thread might be still alive. */
#if 0
#ifdef DYNAMIC_MZSCHEME
dynamic_mzscheme_end();
#endif
#endif
}
/*
* scheme_register_tls_space is only available on 32-bit Windows.
* See http://docs.racket-lang.org/inside/im_memoryalloc.html?q=scheme_register_tls_space
*/
#if MZSCHEME_VERSION_MAJOR >= 500 && defined(WIN32) \
&& defined(USE_THREAD_LOCAL) && !defined(_WIN64)
# define HAVE_TLS_SPACE 1
#if HAVE_TLS_SPACE
# if defined(_MSC_VER)
static __declspec(thread) void *tls_space;
#endif
/*
* Since version 4.x precise GC requires trampolined startup.
* Futures and places in version 5.x need it too.
*/
#if defined(MZ_PRECISE_GC) && MZSCHEME_VERSION_MAJOR >= 400 \
|| MZSCHEME_VERSION_MAJOR >= 500 && (defined(MZ_USE_FUTURES) || defined(MZ_USE_PLACES))
# ifdef DYNAMIC_MZSCHEME
# error Precise GC v.4+ or Racket with futures/places do not support dynamic MzScheme
extern intptr_t _tls_index;
# elif defined(__MINGW32__)
static __thread void *tls_space;
extern intptr_t _tls_index;
# else
static THREAD_LOCAL void *tls_space;
static intptr_t _tls_index = 0;
# endif
# define TRAMPOLINED_MZVIM_STARTUP
#endif
int
mzscheme_main(int argc, char** argv)
{
#ifdef DYNAMIC_MZSCHEME
/*
* Racket requires trampolined startup. We can not load it later.
* If dynamic dll loading is failed, disable it.
*/
if (!mzscheme_enabled(FALSE))
{
disabled = TRUE;
return vim_main2(argc, argv);
}
#endif
#ifdef HAVE_TLS_SPACE
scheme_register_tls_space(&tls_space, 0);
scheme_register_tls_space(&tls_space, _tls_index);
#endif
#ifdef TRAMPOLINED_MZVIM_STARTUP
return scheme_main_setup(TRUE, mzscheme_env_main, argc, argv);
@@ -919,7 +1032,21 @@ mzscheme_env_main(Scheme_Env *env, int argc, char **argv)
return vim_main_result;
}
static void
static Scheme_Object*
load_base_module(void *data)
{
scheme_namespace_require(scheme_intern_symbol((char *)data));
return scheme_null;
}
static Scheme_Object *
load_base_module_on_error(void *data)
{
load_base_module_failed = TRUE;
return scheme_null;
}
static int
startup_mzscheme(void)
{
#ifndef TRAMPOLINED_MZVIM_STARTUP
@@ -942,87 +1069,45 @@ startup_mzscheme(void)
MZ_GC_CHECK();
#ifdef INCLUDE_MZSCHEME_BASE
{
/*
* versions 4.x do not provide Scheme bindings by default
* we need to add them explicitly
*/
Scheme_Object *scheme_base_symbol = NULL;
MZ_GC_DECL_REG(1);
MZ_GC_VAR_IN_REG(0, scheme_base_symbol);
MZ_GC_REG();
/* invoke function from generated and included mzscheme_base.c */
declare_modules(environment);
scheme_base_symbol = scheme_intern_symbol("scheme/base");
MZ_GC_CHECK();
scheme_namespace_require(scheme_base_symbol);
MZ_GC_CHECK();
MZ_GC_UNREG();
}
#endif
register_vim_exn();
/* use new environment to initialise exception handling */
init_exn_catching_apply();
/* redirect output */
scheme_console_output = do_output;
scheme_console_printf = do_printf;
#ifdef MZSCHEME_COLLECTS
/* setup 'current-library-collection-paths' parameter */
# if MZSCHEME_VERSION_MAJOR >= 299
# ifdef MACOS
{
Scheme_Object *coll_byte_string = NULL;
Scheme_Object *coll_char_string = NULL;
Scheme_Object *coll_path = NULL;
int mustfree = FALSE;
char_u *s;
MZ_GC_DECL_REG(3);
MZ_GC_VAR_IN_REG(0, coll_byte_string);
MZ_GC_VAR_IN_REG(1, coll_char_string);
MZ_GC_VAR_IN_REG(2, coll_path);
MZ_GC_DECL_REG(1);
MZ_GC_VAR_IN_REG(0, coll_path);
MZ_GC_REG();
coll_byte_string = scheme_make_byte_string(MZSCHEME_COLLECTS);
/* workaround for dynamic loading on windows */
s = vim_getenv("PLTCOLLECTS", &mustfree);
if (s != NULL)
{
coll_path = scheme_make_path(s);
MZ_GC_CHECK();
coll_char_string = scheme_byte_string_to_char_string(coll_byte_string);
MZ_GC_CHECK();
coll_path = scheme_char_string_to_path(coll_char_string);
MZ_GC_CHECK();
scheme_set_collects_path(coll_path);
MZ_GC_CHECK();
MZ_GC_UNREG();
if (mustfree)
vim_free(s);
}
# else
# ifdef MZSCHEME_COLLECTS
if (coll_path == NULL)
{
Scheme_Object *coll_byte_string = NULL;
Scheme_Object *coll_char_string = NULL;
Scheme_Object *coll_path = NULL;
Scheme_Object *coll_pair = NULL;
Scheme_Config *config = NULL;
MZ_GC_DECL_REG(5);
MZ_GC_VAR_IN_REG(0, coll_byte_string);
MZ_GC_VAR_IN_REG(1, coll_char_string);
MZ_GC_VAR_IN_REG(2, coll_path);
MZ_GC_VAR_IN_REG(3, coll_pair);
MZ_GC_VAR_IN_REG(4, config);
MZ_GC_REG();
coll_byte_string = scheme_make_byte_string(MZSCHEME_COLLECTS);
coll_path = scheme_make_path(MZSCHEME_COLLECTS);
MZ_GC_CHECK();
coll_char_string = scheme_byte_string_to_char_string(coll_byte_string);
MZ_GC_CHECK();
coll_path = scheme_char_string_to_path(coll_char_string);
MZ_GC_CHECK();
coll_pair = scheme_make_pair(coll_path, scheme_null);
MZ_GC_CHECK();
config = scheme_current_config();
MZ_GC_CHECK();
scheme_set_param(config, MZCONFIG_COLLECTION_PATHS, coll_pair);
MZ_GC_CHECK();
MZ_GC_UNREG();
}
# endif
if (coll_path != NULL)
{
scheme_set_collects_path(coll_path);
MZ_GC_CHECK();
}
MZ_GC_UNREG();
}
# else
# ifdef MZSCHEME_COLLECTS
{
Scheme_Object *coll_string = NULL;
Scheme_Object *coll_pair = NULL;
@@ -1045,6 +1130,71 @@ startup_mzscheme(void)
}
# endif
#endif
# if MZSCHEME_VERSION_MAJOR >= 600
{
Scheme_Object *config_path = NULL;
int mustfree = FALSE;
char_u *s;
MZ_GC_DECL_REG(1);
MZ_GC_VAR_IN_REG(0, config_path);
MZ_GC_REG();
/* workaround for dynamic loading on windows */
s = vim_getenv("PLTCONFIGDIR", &mustfree);
if (s != NULL)
{
config_path = scheme_make_path(s);
MZ_GC_CHECK();
if (mustfree)
vim_free(s);
}
#ifdef MZSCHEME_CONFIGDIR
if (config_path == NULL)
{
config_path = scheme_make_path(MZSCHEME_CONFIGDIR);
MZ_GC_CHECK();
}
#endif
if (config_path != NULL)
{
scheme_set_config_path(config_path);
MZ_GC_CHECK();
}
MZ_GC_UNREG();
}
# endif
#if MZSCHEME_VERSION_MAJOR >= 400
scheme_init_collection_paths(environment, scheme_null);
#endif
/*
* versions 4.x do not provide Scheme bindings by default
* we need to add them explicitly
*/
{
/* use error handler to avoid abort */
scheme_dynamic_wind(NULL, load_base_module, NULL,
load_base_module_on_error, "racket/base");
if (load_base_module_failed)
{
load_base_module_failed = FALSE;
scheme_dynamic_wind(NULL, load_base_module, NULL,
load_base_module_on_error, "scheme/base");
if (load_base_module_failed)
return -1;
}
}
register_vim_exn();
/* use new environment to initialise exception handling */
init_exn_catching_apply();
/* redirect output */
scheme_console_output = do_output;
scheme_console_printf = do_printf;
#ifdef HAVE_SANDBOX
{
Scheme_Object *make_security_guard = NULL;
@@ -1118,6 +1268,8 @@ startup_mzscheme(void)
* whether thread scheduling is (or not) required
*/
scheme_notify_multithread = notify_multithread;
return 0;
}
/*
@@ -1130,13 +1282,17 @@ mzscheme_init(void)
if (!initialized)
{
#ifdef DYNAMIC_MZSCHEME
if (!mzscheme_enabled(TRUE))
if (disabled || !mzscheme_enabled(TRUE))
{
EMSG(_("E815: Sorry, this command is disabled, the MzScheme libraries could not be loaded."));
return -1;
}
#endif
startup_mzscheme();
if (load_base_module_failed || startup_mzscheme())
{
EMSG(_("Exxx: Sorry, this command is disabled, the MzScheme's racket/base module could not be loaded."));
return -1;
}
initialized = TRUE;
}
{

View File

@@ -741,6 +741,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1104,
/**/
1103,
/**/