Skip to content

Commit

Permalink
updated for version 7.3.791
Browse files Browse the repository at this point in the history
Problem:    MzScheme interface doesn't work propely.
Solution:   Make it work better. (Sergey Khorev)
  • Loading branch information
brammool committed Jan 30, 2013
1 parent 8888c8c commit 4d3c07f
Show file tree
Hide file tree
Showing 13 changed files with 489 additions and 178 deletions.
41 changes: 34 additions & 7 deletions runtime/doc/if_mzsch.txt
Expand Up @@ -11,7 +11,8 @@ The MzScheme Interface to Vim *mzscheme* *MzScheme*
3. Threads |mzscheme-threads|
4. Vim access from MzScheme |mzscheme-vim|
5. mzeval() Vim function |mzscheme-mzeval|
6. Dynamic loading |mzscheme-dynamic|
6. Using Function references |mzscheme-funcref|
7. Dynamic loading |mzscheme-dynamic|

{Vi does not have any of these commands}

Expand All @@ -21,10 +22,17 @@ The MzScheme interface is available only if Vim was compiled with the
Based on the work of Brent Fulgham.
Dynamic loading added by Sergey Khorev

For downloading MzScheme and other info:
http://www.plt-scheme.org/software/mzscheme/
MzScheme and PLT Scheme names have been rebranded as Racket. For more
information please check http://racket-lang.org

Note: On FreeBSD you should use the "drscheme" port.
Futures and places of Racket version 5.x up to and including 5.3.1 do not
work correctly with processes created by Vim.
The simplest solution is to build Racket on your own with these features
disabled: >
./configure --disable-futures --disable-places --prefix=your-install-prefix
To speed up the process, you might also want to use --disable-gracket and
--disable-docs

==============================================================================
1. Commands *mzscheme-commands*
Expand Down Expand Up @@ -155,8 +163,11 @@ Common
(eval {expr-string}) Evaluate the vim expression into
respective MzScheme object: |Lists| are
represented as Scheme lists,
|Dictionaries| as hash tables.
NOTE the name clashes with MzScheme eval
|Dictionaries| as hash tables,
|Funcref|s as functions (see also
|mzscheme-funcref|)
NOTE the name clashes with MzScheme eval,
use module qualifiers to overcome this.
(range-start) Start/End of the range passed with
(range-end) the Scheme command.
(beep) beep
Expand Down Expand Up @@ -237,7 +248,23 @@ To facilitate bi-directional interface, you can use |mzeval()| function to
evaluate MzScheme expressions and pass their values to VimL.

==============================================================================
6. Dynamic loading *mzscheme-dynamic* *E815*
6. Using Function references *mzscheme-funcref*

MzScheme interface allows use of |Funcref|s so you can call Vim functions
directly from Scheme. For instance: >
function! MyAdd2(arg)
return a:arg + 2
endfunction
mz (define f2 (vim-eval "function(\"MyAdd2\")"))
mz (f2 7)
< or : >
:mz (define indent (vim-eval "function('indent')"))
" return Vim indent for line 12
:mz (indent 12)
<

==============================================================================
7. Dynamic loading *mzscheme-dynamic* *E815*

On MS-Windows the MzScheme libraries can be loaded dynamically. The |:version|
output then includes |+mzscheme/dyn|.
Expand Down
3 changes: 3 additions & 0 deletions src/Make_ming.mak
Expand Up @@ -384,6 +384,9 @@ CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME
ifeq (yes, $(DYNAMIC_MZSCHEME))
CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
endif
ifeq (yes, "$(MZSCHEME_DEBUG)")
CFLAGS += -DMZSCHEME_FORCE_GC
endif
endif

ifdef RUBY
Expand Down
2 changes: 1 addition & 1 deletion src/Make_mvc.mak
Expand Up @@ -1096,7 +1096,7 @@ $(OUTDIR)/if_perl.obj: $(OUTDIR) if_perl.c $(INCL)
$(OUTDIR)/if_perlsfio.obj: $(OUTDIR) if_perlsfio.c $(INCL)
$(CC) $(CFLAGS) $(PERL_INC) if_perlsfio.c

$(OUTDIR)/if_mzsch.obj: $(OUTDIR) if_mzsch.c $(INCL) $(MZSCHEME_EXTRA_DEP)
$(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:
Expand Down
7 changes: 6 additions & 1 deletion src/auto/configure
Expand Up @@ -4927,7 +4927,8 @@ $as_echo "no" >&6; }

if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
if test "x$MACOSX" = "xyes"; then
MZSCHEME_LIBS="-framework PLT_MzScheme"
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"
MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
Expand Down Expand Up @@ -4968,6 +4969,10 @@ $as_echo_n "checking for racket collects directory... " >&6; }
else
if test -d $vi_cv_path_mzscheme_pfx/share/racket/collects; then
SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/share/racket/
else
if test -d $vi_cv_path_mzscheme_pfx/collects; then
SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/
fi
fi
fi
fi
Expand Down
7 changes: 6 additions & 1 deletion src/configure.in
Expand Up @@ -617,7 +617,8 @@ if test "$enable_mzschemeinterp" = "yes"; then

if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
if test "x$MACOSX" = "xyes"; then
MZSCHEME_LIBS="-framework PLT_MzScheme"
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"
MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
Expand Down Expand Up @@ -660,6 +661,10 @@ if test "$enable_mzschemeinterp" = "yes"; then
else
if test -d $vi_cv_path_mzscheme_pfx/share/racket/collects; then
SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/share/racket/
else
if test -d $vi_cv_path_mzscheme_pfx/collects; then
SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/
fi
fi
fi
fi
Expand Down
16 changes: 16 additions & 0 deletions src/eval.c
Expand Up @@ -14333,6 +14333,22 @@ f_mzeval(argvars, rettv)
str = get_tv_string_buf(&argvars[0], buf);
do_mzeval(str, rettv);
}

void
mzscheme_call_vim(name, args, rettv)
char_u *name;
typval_T *args;
typval_T *rettv;
{
typval_T argvars[3];

argvars[0].v_type = VAR_STRING;
argvars[0].vval.v_string = name;
copy_tv(args, &argvars[1]);
argvars[2].v_type = VAR_UNKNOWN;
f_call(argvars, rettv);
clear_tv(&argvars[1]);
}
#endif

/*
Expand Down

0 comments on commit 4d3c07f

Please sign in to comment.