Permalink
Browse files

Merged from the latest developing branch.

git-svn-id: https://vim.svn.sourceforge.net/svnroot/vim/trunk@1497 2a77ed30-b011-0410-a7ad-c7884a0aa172
  • Loading branch information...
edyfox
edyfox committed May 27, 2009
1 parent 90f02ca commit 24fa0174f5082db4e378332433201cdee646b27a
Showing with 1,166 additions and 561 deletions.
  1. +39 −58 runtime/doc/if_mzsch.txt
  2. +26 −0 src/Make_ming.mak
  3. +26 −1 src/Make_mvc.mak
  4. +6 −2 src/Makefile
  5. +51 −23 src/auto/configure
  6. +2 −0 src/config.mk.in
  7. +45 −18 src/configure.in
  8. +8 −3 src/edit.c
  9. +1 −1 src/eval.c
  10. +898 −443 src/if_mzsch.c
  11. +28 −0 src/if_mzsch.h
  12. +6 −0 src/main.c
  13. +22 −6 src/ops.c
  14. +2 −6 src/proto/if_mzsch.pro
  15. +6 −0 src/version.c
View
@@ -1,4 +1,4 @@
-*if_mzsch.txt* For Vim version 7.2. Last change: 2008 Jun 28
+*if_mzsch.txt* For Vim version 7.2. Last change: 2009 May 26
VIM REFERENCE MANUAL by Sergey Khorev
@@ -42,10 +42,6 @@ Note: On FreeBSD you should use the "drscheme" port.
*:mzfile* *:mzf*
:[range]mzf[ile] {file} Execute the MzScheme script in {file}. {not in Vi}
- All statements are executed in the namespace of the
- buffer that was current during :mzfile start.
- If you want to access other namespaces, use
- 'parameterize'.
All of these commands do essentially the same thing - they execute a piece of
MzScheme code, with the "current range" set to the given line
@@ -54,8 +50,6 @@ range.
In the case of :mzscheme, the code to execute is in the command-line.
In the case of :mzfile, the code to execute is the contents of the given file.
-Each buffer has its own MzScheme namespace. Global namespace is bound to
-the "global-namespace" value from the 'vimext' module.
MzScheme interface defines exception exn:vim, derived from exn.
It is raised for various Vim errors.
@@ -79,40 +73,8 @@ To avoid clashes with MzScheme, consider using prefix when requiring module,
e.g.: >
:mzscheme (require (prefix vim- vimext))
<
-All the examples below assume this naming scheme. Note that you need to do
-this again for every buffer.
+All the examples below assume this naming scheme.
-The auto-instantiation can be achieved with autocommands, e.g. you can put
-something like this in your .vimrc (EOFs should not have indentation): >
- function s:MzRequire()
- if has("mzscheme")
- :mz << EOF
- (require (prefix vim- vimext))
- (let ((buf (vim-get-buff-by-name (vim-eval "expand(\"<afile>\")"))))
- (when (and buf (not (eq? buf (vim-curr-buff))))
- (parameterize ((current-namespace (vim-get-buff-namespace buf)))
- (namespace-attach-module vim-global-namespace 'vimext)
- (namespace-require '(prefix vim vimext)))))
- EOF
- endif
- endfunction
-
- function s:MzStartup()
- if has("mzscheme")
- au BufNew,BufNewFile,BufAdd,BufReadPre * :call s:MzRequire()
- :mz << EOF
- (current-library-collection-paths
- (cons
- (build-path (find-system-path 'addon-dir) (version) "collects")
- (current-library-collection-paths)))
- EOF
- endif
- endfunction
-
- call s:MzStartup()
-<
-
-The global namespace just instantiated this module with the prefix "vimext:".
*mzscheme-sandbox*
When executed in the |sandbox|, access to some filesystem and Vim interface
procedures is restricted.
@@ -121,33 +83,54 @@ procedures is restricted.
2. Examples *mzscheme-examples*
>
:mzscheme (display "Hello")
+ :mz (display (string-append "Using MzScheme version " (version)))
+ :mzscheme (require (prefix vim- vimext)) ; for MzScheme < 4.x
+ :mzscheme (require (prefix-in vim- 'vimext)) ; MzScheme 4.x
:mzscheme (vim-set-buff-line 10 "This is line #10")
<
Inline script usage: >
function! <SID>SetFirstLine()
:mz << EOF
(display "!!!")
+ (require (prefix vim- vimext))
+ ; for newer versions (require (prefix-in vim- 'vimext))
(vim-set-buff-line 1 "This is line #1")
(vim-beep)
- EOF
+ EOF
endfunction
nmap <F9> :call <SID>SetFirstLine() <CR>
<
File execution: >
:mzfile supascript.scm
<
-Accessing the current buffer namespace from an MzScheme program running in
-another buffer within |:mzfile|-executed script : >
- ; Move to the window below
- (vim-command "wincmd j")
- ; execute in the context of buffer, to which window belongs
- ; assume that buffer has 'textstring' defined
- (parameterize ((current-namespace
- (vim-get-buff-namespace (vim-curr-buff))))
- (eval '(vim-set-buff-line 1 textstring)))
+Vim exception handling: >
+ :mz << EOF
+ (require (prefix vim- vimext))
+ ; for newer versions (require (prefix-in vim- 'vimext))
+ (with-handlers
+ ([exn:vim? (lambda (e) (display (exn-message e)))])
+ (vim-eval "nonsense-string"))
+ EOF
<
+Auto-instantiation of vimext module (can be placed in your |vimrc|): >
+ function! MzRequire()
+ :redir => l:mzversion
+ :mz (version)
+ :redir END
+ if strpart(l:mzversion, 1, 1) < "4"
+ " MzScheme versions < 4.x:
+ :mz (require (prefix vim- vimext))
+ else
+ " newer versions:
+ :mz (require (prefix-in vim- 'vimext))
+ endif
+ endfunction
+ if has("mzscheme")
+ silent call MzRequire()
+ endif
+<
==============================================================================
3. Threads *mzscheme-threads*
@@ -168,11 +151,11 @@ interface.
Common
------
(command {command-string}) Perform the vim ":Ex" style command.
- (eval {expr-string}) Evaluate the vim expression to a string.
- A |List| is turned into a string by
- joining the items and inserting line
- breaks.
- NOTE clashes with MzScheme eval
+ (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
(range-start) Start/End of the range passed with
(range-end) the Scheme command.
(beep) beep
@@ -186,7 +169,6 @@ Common
be set. The symbol 'global can be passed
as {buffer-or-window}. Then |:setglobal|
will be used.
- global-namespace The MzScheme main namespace.
Buffers *mzscheme-buffer*
-------
@@ -228,7 +210,6 @@ Buffers *mzscheme-buffer*
if there is no such buffer.
(get-buff-by-num {buffernum}) Get a buffer by its number (return #f if
there is no buffer with this number).
- (get-buff-namespace [buffer]) Get buffer namespace.
Windows *mzscheme-window*
------
@@ -250,7 +231,7 @@ Windows *mzscheme-window*
(set-cursor (line . col) [window]) Set cursor position.
==============================================================================
-5. Dynamic loading *mzscheme-dynamic*
+5. Dynamic loading *mzscheme-dynamic* *E812*
On MS-Windows the MzScheme libraries can be loaded dynamically. The |:version|
output then includes |+mzscheme/dyn|.
View
@@ -115,8 +115,21 @@ 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
+
ifeq (no,$(DYNAMIC_MZSCHEME))
+ifeq (yes,$(MZSCHEME_PRECISE_GC))
+MZSCHEME_LIB=-lmzsch$(MZSCHEME_VER)
+else
MZSCHEME_LIB = -lmzsch$(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
ifndef MZSCHEME_DLLS
@@ -410,6 +423,13 @@ endif
ifdef MZSCHEME
OBJ += $(OUTDIR)/if_mzsch.o
MZSCHEME_INCL = if_mzsch.h
+ifeq (yes,$(MZSCHEME_GENERATE_BASE))
+CFLAGS += -DINCLUDE_MZSCHEME_BASE
+MZ_EXTRA_DEP += mzscheme_base.c
+endif
+ifeq (yes,$(MZSCHEME_PRECISE_GC))
+CFLAGS += -DMZ_PRECISE_GC
+endif
endif
ifdef PYTHON
OBJ += $(OUTDIR)/if_python.o
@@ -588,6 +608,12 @@ if_perl.c: if_perl.xs typemap
$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC)
$(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o
+$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP)
+ $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o
+
+mzscheme_base.c:
+ $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base
+
pathdef.c: $(INCL)
ifneq (sh.exe, $(SHELL))
@echo creating pathdef.c
View
@@ -34,6 +34,7 @@
# MZSCHEME=[Path to MzScheme directory]
# DYNAMIC_MZSCHEME=yes (to load the MzScheme DLLs dynamically)
# MZSCHEME_VER=[version, 205_000, ...]
+# MZSCHEME_DEBUG=no
#
# Perl interface:
# PERL=[Path to Perl directory]
@@ -621,15 +622,37 @@ PYTHON_LIB = $(PYTHON)\libs\python$(PYTHON_VER).lib
MZSCHEME_VER = 205_000
!endif
CFLAGS = $(CFLAGS) -DFEAT_MZSCHEME -I $(MZSCHEME)\include
+!if EXIST("$(MZSCHEME)\collects\scheme\base.ss")
+# for MzScheme 4.x we need to include byte code for basic Scheme stuff
+MZSCHEME_EXTRA_DEP = mzscheme_base.c
+CFLAGS = $(CFLAGS) -DINCLUDE_MZSCHEME_BASE
+!endif
+!if EXIST("$(MZSCHEME)\lib\msvc\libmzsch$(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 \
-DDYNAMIC_MZSCH_DLL=\"libmzsch$(MZSCHEME_VER).dll\" \
-DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
!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\libmzsch$(MZSCHEME_VER).lib
+!else
MZSCHEME_LIB = $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib \
$(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib
!endif
+!endif
MZSCHEME_OBJ = $(OUTDIR)\if_mzsch.obj
!endif
@@ -930,9 +953,11 @@ $(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)
+$(OUTDIR)/if_mzsch.obj: $(OUTDIR) if_mzsch.c $(INCL) $(MZSCHEME_EXTRA_DEP)
$(CC) $(CFLAGS) if_mzsch.c \
-DMZSCHEME_COLLECTS=\"$(MZSCHEME:\=\\)\\collects\"
+mzscheme_base.c:
+ $(MZSCHEME)\mzc --c-mods mzscheme_base.c ++lib scheme/base
$(OUTDIR)/if_python.obj: $(OUTDIR) if_python.c $(INCL)
$(CC) $(CFLAGS) $(PYTHON_INC) if_python.c
View
@@ -536,7 +536,7 @@ CClink = $(CC)
# Use this with GCC to check for mistakes, unused arguments, etc.
#CFLAGS = -g -Wall -Wextra -Wmissing-prototypes -Wunreachable-code
#PYTHON_CFLAGS_EXTRA = -Wno-missing-field-initializers
-#MZSCHEME_CFLAGS_EXTRA = -Wno-unreachable-code
+#MZSCHEME_CFLAGS_EXTRA = -Wno-unreachable-code -Wno-unused-parameter
# EFENCE - Electric-Fence malloc debugging: catches memory accesses beyond
# allocated memory (and makes every malloc()/free() very slow).
@@ -2200,6 +2200,7 @@ clean celan: testclean
-rm -f $(TOOLS) auto/osdef.h auto/pathdef.c auto/if_perl.c
-rm -f conftest* *~ auto/link.sed
-rm -rf $(APPDIR)
+ -rm -rf mzscheme_base.c
if test -d $(PODIR); then \
cd $(PODIR); $(MAKE) prefix=$(DESTDIR)$(prefix) clean; \
fi
@@ -2433,8 +2434,11 @@ objects/if_cscope.o: if_cscope.c
objects/if_xcmdsrv.o: if_xcmdsrv.c
$(CCC) -o $@ if_xcmdsrv.c
-objects/if_mzsch.o: if_mzsch.c
+objects/if_mzsch.o: if_mzsch.c $(MZSCHEME_EXTRA)
$(CCC) -o $@ $(MZSCHEME_CFLAGS_EXTRA) if_mzsch.c
+
+mzscheme_base.c:
+ $(MZSCHEME_MZC) --c-mods mzscheme_base.c ++lib scheme/base
objects/if_perl.o: auto/if_perl.c
$(CCC) -o $@ auto/if_perl.c
Oops, something went wrong.

0 comments on commit 24fa017

Please sign in to comment.