1
0
forked from aniani/vim

Added Lua interfae. (Luis Carvalho)

This commit is contained in:
Bram Moolenaar 2010-07-14 23:23:17 +02:00
parent 26dcc7e8df
commit 0ba042961f
35 changed files with 1835 additions and 21 deletions

View File

@ -210,6 +210,7 @@ SRC_UNIX = \
SRC_DOS_UNIX = \
src/if_cscope.c \
src/if_cscope.h \
src/if_lua.c \
src/if_mzsch.c \
src/if_mzsch.h \
src/if_perl.xs \
@ -219,6 +220,7 @@ SRC_DOS_UNIX = \
src/if_sniff.h \
src/if_tcl.c \
src/proto/if_cscope.pro \
src/proto/if_lua.pro \
src/proto/if_mzsch.pro \
src/proto/if_perl.pro \
src/proto/if_perlsfio.pro \

View File

@ -80,8 +80,8 @@ DOSBIN_S = dosbin_s
# runtime/doc/*.txt and nsis/gvim.nsi. Other things in README_os2.txt. For a
# minor/major version: src/GvimExt/GvimExt.reg, src/vim.def, src/vim16.def.
# - Correct included_patches[] in src/version.c.
# - Compile Vim with GTK, Perl, Python, TCL, Ruby, MZscheme (if you can make it
# work), Cscope and "huge" features. Exclude workshop and SNiFF.
# - Compile Vim with GTK, Perl, Python, TCL, Ruby, MZscheme, Lua (if you can
# make it work), Cscope and "huge" features. Exclude workshop and SNiFF.
# - With these features: "make proto" (requires cproto and Motif installed;
# ignore warnings for missing include files, fix problems for syntax errors).
# - With these features: "make depend" (works best with gcc).

View File

@ -40,6 +40,7 @@ DOCS = \
helphelp.txt \
howto.txt \
if_cscop.txt \
if_lua.txt \
if_mzsch.txt \
if_ole.txt \
if_perl.txt \
@ -171,6 +172,7 @@ HTMLS = \
helphelp.html \
howto.html \
if_cscop.html \
if_lua.html \
if_mzsch.html \
if_ole.html \
if_perl.html \

View File

@ -6095,6 +6095,7 @@ lispindent Compiled with support for lisp indenting.
listcmds Compiled with commands for the buffer list |:files|
and the argument list |arglist|.
localmap Compiled with local mappings and abbr. |:map-local|
lua Compiled with Lua interface |Lua|.
mac Macintosh version of Vim.
macunix Macintosh version of Vim, using Unix files (OS-X).
menu Compiled with support for |:menu|.

View File

@ -158,6 +158,7 @@ GUI ~
Interfaces ~
|if_cscop.txt| using Cscope with Vim
|if_lua.txt| Lua interface
|if_mzsch.txt| MzScheme interface
|if_perl.txt| Perl interface
|if_pyth.txt| Python interface

239
runtime/doc/if_lua.txt Normal file
View File

@ -0,0 +1,239 @@
*if_lua.txt* For Vim version 7.3a. Last change: 2008 Aug 31
VIM REFERENCE MANUAL by Luis Carvalho
The Lua Interface to Vim *lua* *Lua*
1. Commands |lua-commands|
2. The vim module |lua-vim|
3. Buffer userdata |lua-buffer|
4. Window userdata |lua-window|
{Vi does not have any of these commands}
The Lua interface is available only when Vim was compiled with the
|+lua| feature.
==============================================================================
1. Commands *lua-commands*
*:lua*
:[range]lua {chunk}
Execute Lua chunk {chunk}. {not in Vi}
Examples:
>
:lua print("Hello, Vim!")
:lua local curbuf = vim.buffer() curbuf[7] = "line #7"
<
:[range]lua << {endmarker}
{script}
{endmarker}
Execute Lua script {script}. {not in Vi}
Note: This command doesn't work when the Lua
feature wasn't compiled in. To avoid errors, see
|script-here|.
{endmarker} must NOT be preceded by any white space. If {endmarker} is
omitted from after the "<<", a dot '.' must be used after {script}, like
for the |:append| and |:insert| commands.
This form of the |:lua| command is mainly useful for including Lua code
in Vim scripts.
Example:
>
function! CurrentLineInfo()
lua << EOF
local linenr = vim.window().line
local curline = vim.buffer()[linenr]
print(string.format("Current line [%d] has %d chars",
linenr, #curline))
EOF
endfunction
<
*:luado*
:[range]luado {body} Execute Lua function$function (line)${body}$end$ for
each line in the [range], with the function argument
being set to the text of each line in turn, without a
trailing <EOL>. If the value returned by the function
is a string it becomes the text of the line in the
current turn. The default for [range] is the whole
file: "1,$". {not in Vi}
Examples:
>
:luado return string.format("%s\t%d", line:reverse(), #line)
:lua require"lpeg"
:lua -- balanced parenthesis grammar:
:lua bp = lpeg.P{ "(" * ((1 - lpeg.S"()") + lpeg.V(1))^0 * ")" }
:luado if bp:match(line) then return "-->\t" .. line end
<
*:luafile*
:[range]luafile {file}
Execute Lua script in {file}. {not in Vi}
The whole argument is used as a single file name.
Examples:
>
:luafile script.lua
:luafile %
<
All these commands execute a Lua chunk from either the command line (:lua and
:luado) or a file (:luafile) with the given line [range]. Similarly to the Lua
interpreter, each chunk has its own scope and so only global variables are
shared between command calls. Lua default libraries$table$,$string$,$math$,
and$package$are available,$io$and$debug$are not, and$os$is restricted to
functions$date$,$clock$,$time$,$difftime$, and$getenv$. In addition,
Lua$print$function has its output redirected to the Vim message area, with
arguments separated by a white space instead of a tab.
Lua uses the "vim" module (see|lua-vim|) to issue commands to Vim
and manage buffers (|lua-buffer|) and windows (|lua-window|). However,
procedures that alter buffer content, open new buffers, and change cursor
position are restricted when the command is executed in the|sandbox|.
==============================================================================
2. The vim module *lua-vim*
Lua interfaces Vim through the "vim" module. The first and last line of the
input range are stored in$vim.firstline$and$vim.lastline$respectively. The
module also includes routines for buffer, window, and current line queries,
Vim evaluation and command execution, and others.
$vim.isbuffer(value)$ Returns#true#if$value$is a buffer userdata and
$false$otherwise (see|lua-buffer|).
$vim.buffer($[arg]$)$ If$arg$is a number, returns buffer with number
$arg$in the buffer list or, if$arg$is
a string, returns buffer whose full or short
name is$arg$. In both cases, returns#nil#if
the buffer is not found. Otherwise, if
$toboolean(arg)$is#true#returns the first
buffer in the buffer list or else the current
buffer.
$vim.iswindow(value)$ Returns#true#if$value$is a window userdata and
$false$otherwise (see|lua-window|).
$vim.window($[arg]$)$ If$arg$is a number, returns window with number
$arg$or#nil#if not found. Otherwise, if
$toboolean(arg)$is#true#returns the first
window or else the current window.
$vim.command(${cmd}$)$ Executes the vim (ex-mode) command {cmd}.
Examples: >
:lua vim.command"set tw=60"
:lua vim.command"normal ddp"
<
$vim.eval(${expr}$)$ Evaluates expression {expr} (see|expression|),
converts the result to Lua, and returns it.
Vim strings and numbers are directly converted
to Lua strings and numbers respectively. Vim
lists and dictionaries are converted to Lua
tables (lists become integer-keyed tables).
Examples: >
:lua tw = vim.eval"&tw"
:lua print(vim.eval"{'a': 'one'}".a)
<
$vim.line()$ Returns the current line (without the trailing
<EOL>), a Lua string.
$vim.beep()$ Beeps.
$vim.open(${fname}$)$ Opens a new buffer for file {fname} and
returns it. Note that the buffer is not set as
current.
==============================================================================
3. Buffer userdata *lua-buffer*
Buffer userdata represent vim buffers. A buffer userdata$b$has the following
properties and methods:
Properties
----------
#o#$b()$sets$b$as the current buffer.
#o#$#b$is the number of lines in buffer$b$.
#o#$b[k]$represents line number$k$:$b[k] = newline$replaces line$k$
with string$newline$and$b[k] =$#nil#deletes line$k$.
#o#$b.name$contains the short name of buffer$b$(read-only).
#o#$b.fname$contains the full name of buffer$b$(read-only).
#o#$b.number$contains the position of buffer$b$in the buffer list
(read-only).
Methods
-------
#o#$b:insert(newline$[, pos]$)$inserts string$newline$at position$pos$
in the buffer. The default value for$pos$is$#b + 1$. If$pos == 0$
then$newline$becomes the first line in the buffer.
#o#$b:next()$returns the buffer next to$b$in the buffer list.
#o#$b:previous()$returns the buffer previous to$b$in the buffer list.
#o#$b:isvalid()$returns#true#if buffer$b$corresponds to a "real" (not
freed from memory) Vim buffer.
Examples:
>
:lua b = vim.buffer() -- current buffer
:lua print(b.name, b.number)
:lua b[1] = "first line"
:lua b:insert("FIRST!", 0)
:lua b[1] = nil -- delete top line
:lua for i=1,3 do b:insert(math.random()) end
:3,4lua for i=vim.lastline,vim.firstline,-1 do b[i] = nil end
:lua vim.open"myfile"() -- open buffer and set it as current
function! ListBuffers()
lua << EOF
local b = vim.buffer(true) -- first buffer in list
while b ~= nil do
print(b.number, b.name, #b)
b = b:next()
end
vim.beep()
EOF
endfunction
<
==============================================================================
4. Window userdata *lua-window*
Window objects represent vim windows. A window userdata$w$has the following
properties and methods:
Properties
----------
#o#$w()$sets$w$as the current window.
#o#$w.buffer$contains the buffer of window$w$(read-only).
#o#$w.line$represents the cursor line position in window$w$.
#o#$w.col$represents the cursor column position in window$w$.
#o#$w.width$represents the width of window$w$.
#o#$w.height$represents the height of window$w$.
Methods
-------
#o#$w:next()$returns the window next to$w$.
#o#$w:previous()$returns the window previous to$w$.
#o#$w:isvalid()$returns#true#if window$w$corresponds to a "real" (not
freed from memory) Vim window.
Examples:
>
:lua w = vim.window() -- current window
:lua print(w.buffer.name, w.line, w.col)
:lua w.width = w.width + math.random(10)
:lua w.height = 2 * math.random() * w.height
:lua n,w = 0,vim.window(true) while w~=nil do n,w = n + 1,w:next() end
:lua print("There are " .. n .. " windows")
<
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

View File

@ -1299,6 +1299,9 @@ The commands are sorted on the non-optional part of their name.
|:ltag| :lt[ag] jump to tag and add matching tags to the
location list
|:lunmap| :lu[nmap] like ":unmap!" but includes Lang-Arg mode
|:lua| :lua execute |Lua| command
|:luado| :luad[o] execute Lua command for each line
|:luafile| :luaf[ile] execute |Lua| script file
|:lvimgrep| :lv[imgrep] search for pattern in files
|:lvimgrepadd| :lvimgrepa[dd] like :vimgrep, but append to current list
|:lwindow| :lw[indow] open or close location window

View File

@ -1165,6 +1165,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
+lispindent various.txt /*+lispindent*
+listcmds various.txt /*+listcmds*
+localmap various.txt /*+localmap*
+lua various.txt /*+lua*
+lua/dyn various.txt /*+lua\/dyn*
+menu various.txt /*+menu*
+mksession various.txt /*+mksession*
+modify_fname various.txt /*+modify_fname*
@ -2365,6 +2367,9 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
:lt tagsrch.txt /*:lt*
:ltag tagsrch.txt /*:ltag*
:lu map.txt /*:lu*
:lua if_lua.txt /*:lua*
:luado if_lua.txt /*:luado*
:luafile if_lua.txt /*:luafile*
:lunmap map.txt /*:lunmap*
:lv quickfix.txt /*:lv*
:lvimgrep quickfix.txt /*:lvimgrep*
@ -4280,6 +4285,7 @@ L motion.txt /*L*
Linux-backspace options.txt /*Linux-backspace*
List eval.txt /*List*
Lists eval.txt /*Lists*
Lua if_lua.txt /*Lua*
M motion.txt /*M*
MDI starting.txt /*MDI*
MS-DOS os_msdos.txt /*MS-DOS*
@ -6055,6 +6061,7 @@ hit-enter-prompt message.txt /*hit-enter-prompt*
hit-return message.txt /*hit-return*
hitest.vim syntax.txt /*hitest.vim*
hjkl usr_02.txt /*hjkl*
hl-ColorColumn syntax.txt /*hl-ColorColumn*
hl-Conceal syntax.txt /*hl-Conceal*
hl-Cursor syntax.txt /*hl-Cursor*
hl-CursorColumn syntax.txt /*hl-CursorColumn*
@ -6248,6 +6255,7 @@ ident-search tips.txt /*ident-search*
idl-syntax syntax.txt /*idl-syntax*
idl.vim syntax.txt /*idl.vim*
if_cscop.txt if_cscop.txt /*if_cscop.txt*
if_lua.txt if_lua.txt /*if_lua.txt*
if_mzsch.txt if_mzsch.txt /*if_mzsch.txt*
if_ole.txt if_ole.txt /*if_ole.txt*
if_perl.txt if_perl.txt /*if_perl.txt*
@ -6424,6 +6432,11 @@ log10() eval.txt /*log10()*
long-lines version5.txt /*long-lines*
lowercase change.txt /*lowercase*
lpc.vim syntax.txt /*lpc.vim*
lua if_lua.txt /*lua*
lua-buffer if_lua.txt /*lua-buffer*
lua-commands if_lua.txt /*lua-commands*
lua-vim if_lua.txt /*lua-vim*
lua-window if_lua.txt /*lua-window*
lua.vim syntax.txt /*lua.vim*
m motion.txt /*m*
m' motion.txt /*m'*

View File

@ -1107,9 +1107,6 @@ Patches to possibly include:
- Patch for adding "J" flag to 'cinoptions': placement of jump label. (Manuel
Konig, 2010 Feb 19) Update by Lech Lorens, Feb 22.
Need another name, "J" is now used for Javascript.
- Add Lua interface? (Wolfgang Oertl) patch by Luis Carvalho, 2008 Sep 5
Patch for Make_ming.mak from Paul Moore (2008 Sep 1)
http://code.google.com/p/vim-iflua/ Download vim72-lua-0.7.patch.gz
Needs some work:
- Have a look at patch to enable screen access from Python. (Marko Mahnic,
2010 Apr 12)

View File

@ -338,6 +338,8 @@ N *+lispindent* |'lisp'|
N *+listcmds* Vim commands for the list of buffers |buffer-hidden|
and argument list |:argdelete|
N *+localmap* Support for mappings local to a buffer |:map-local|
m *+lua* |Lua| interface
m *+lua/dyn* |Lua| interface |/dyn|
N *+menu* |:menu|
N *+mksession* |:mksession|
N *+modify_fname* |filename-modifiers|

View File

@ -7172,6 +7172,9 @@ executed.
Removed support for GTK 1. It was no longer maintained and required a lot of
#ifdefs in the source code. GTK 2 should be available for every system.
It is no longer allowed to set the 'encoding' option from a modeline. It
would corrupt the text.
Added *added-7.3*
-----
@ -7188,6 +7191,9 @@ file.
Added the |+conceal| feature. (Vince Negri)
Added the 'colorcolumn' option: highlight one or more columns in a window.
E.g. to highlight the column after 'textwidth'. (partly by Gregor Uhlenheuer)
Added support for NetBeans in a terminal. Added |:nbstart| and |:nbclose|.
(Xavier de Gaye)
@ -7196,6 +7202,9 @@ log(), sinh(), tan(), tanh(). (Bill McCarthy)
gettabvar() and settabvar() functions. (Yegappan Lakshmanan)
Added the |Lua| interface.
New syntax files:
TODO

View File

@ -411,7 +411,7 @@ Scripts and Expressions. |expression|
etc., etc. See |eval|.
Debugging and profiling are supported. |debug-scripts| |profile|
If this is not enough, an interface is provided to |Python|, |Ruby|,
|Tcl|, |Perl| and |MzScheme|.
|Tcl|, |Lua|, |Perl| and |MzScheme|.
Viminfo. |viminfo-file|
The command-line history, marks and registers can be stored in a file

View File

@ -35,6 +35,9 @@
# LINK name of the linker ($(BOR)\bin\ilink if OSTYPE is DOS16,
# $(BOR)\bin\ilink32 otherwise)
# GUI no or yes: set to yes if you want the GUI version (yes)
# LUA define to path to Lua dir to get Lua support (not defined)
# LUA_VER define to version of Lua being used (51)
# DYNAMIC_LUA no or yes: set to yes to load the Lua DLL dynamically (no)
# PERL define to path to Perl dir to get Perl support (not defined)
# PERL_VER define to version of Perl being used (56)
# DYNAMIC_PERL no or yes: set to yes to load the Perl DLL dynamically (no)
@ -129,6 +132,9 @@ CSCOPE = yes
NETBEANS = yes
!endif
### LUA: uncomment this line if you want lua support in vim
# LUA=c:\lua
### PERL: uncomment this line if you want perl support in vim
# PERL=c:\perl
@ -199,6 +205,7 @@ ALIGN = 4
# Incompatible when calling external functions (like MSVC-compiled DLLs), so
# don't use FASTCALL when linking with external libs.
!if ("$(FASTCALL)"=="") && \
("$(LUA)"=="") && \
("$(PYTHON)"=="") && \
("$(PERL)"=="") && \
("$(TCL)"=="") && \
@ -292,6 +299,18 @@ INCLUDE = $(BOR)\include;.;proto
DEFINES = -DFEAT_$(FEATURES) -DWIN32 -DHAVE_PATHDEF \
-DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER)
!ifdef LUA
INTERP_DEFINES = $(INTERP_DEFINES) -DFEAT_LUA
INCLUDE = $(LUA)\include;$(INCLUDE)
! ifndef LUA_VER
LUA_VER = 51
! endif
! if ("$(DYNAMIC_LUA)" == "yes")
INTERP_DEFINES = $(INTERP_DEFINES) -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\"
LUA_LIB_FLAG = /nodefaultlib:
! endif
!endif
!ifdef PERL
INTERP_DEFINES = $(INTERP_DEFINES) -DFEAT_PERL
INCLUDE = $(PERL)\lib\core;$(INCLUDE)
@ -584,6 +603,11 @@ vimobj = $(vimobj) \
$(OBJDIR)\if_ole.obj
!endif
!ifdef LUA
vimobj = $(vimobj) \
$(OBJDIR)\if_lua.obj
!endif
!ifdef PERL
vimobj = $(vimobj) \
$(OBJDIR)\if_perl.obj
@ -692,6 +716,12 @@ MSG = $(MSG) NETBEANS
!ifdef XPM
MSG = $(MSG) XPM
!endif
!ifdef LUA
MSG = $(MSG) LUA
! if "$(DYNAMIC_LUA)" == "yes"
MSG = $(MSG)(dynamic)
! endif
!endif
!ifdef PERL
MSG = $(MSG) PERL
! if "$(DYNAMIC_PERL)" == "yes"
@ -788,6 +818,9 @@ clean:
-@del *.ilf
-@del *.ils
-@del *.tds
!ifdef LUA
-@del lua.lib
!endif
!ifdef PERL
-@del perl.lib
!endif
@ -825,6 +858,9 @@ $(DLLTARGET): $(OBJDIR) $(vimdllobj)
!endif
!if ($(OSTYPE)==WIN32)
import32.lib+
!ifdef LUA
$(LUA_LIB_FLAG)lua.lib+
!endif
!ifdef PERL
$(PERL_LIB_FLAG)perl.lib+
!endif
@ -874,6 +910,9 @@ $(TARGET): $(OBJDIR) $(vimobj) $(OBJDIR)\$(RESFILE)
ole2w32.lib +
!endif
import32.lib+
!ifdef LUA
$(LUA_LIB_FLAG)lua.lib+
!endif
!ifdef PERL
$(PERL_LIB_FLAG)perl.lib+
!endif
@ -912,6 +951,9 @@ $(OBJDIR)\ex_eval.obj: ex_eval.c ex_cmds.h
$(OBJDIR)\if_ole.obj: if_ole.cpp
$(OBJDIR)\if_lua.obj: if_lua.c lua.lib
$(CC) $(CCARG) $(CC1) $(CC2)$@ -pc if_lua.c
$(OBJDIR)\if_perl.obj: if_perl.c perl.lib
$(CC) $(CCARG) $(CC1) $(CC2)$@ -pc if_perl.c
@ -966,6 +1008,9 @@ char_u *compiled_user = (char_u *)"$(USERNAME)";
char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";
| auto\pathdef.c
lua.lib: $(LUA)\lib\lua$(LUA_VER).lib
coff2omf $(LUA)\lib\lua$(LUA_VER).lib $@
perl.lib: $(PERL)\lib\CORE\perl$(PERL_VER).lib
coff2omf $(PERL)\lib\CORE\perl$(PERL_VER).lib $@

View File

@ -24,6 +24,9 @@
# MZSCHEME_VER define to version of MzScheme being used (209_000)
# DYNAMIC_MZSCHEME no or yes: use yes to load the MzScheme DLLs dynamically (yes)
# MZSCHEME_DLLS path to MzScheme DLLs (libmzgc and libmzsch), for "static" build.
# LUA define to path to Lua dir to get Lua support (not defined)
# LUA_VER define to version of Lua being used (51)
# DYNAMIC_LUA no or yes: use yes to load the Lua DLL dynamically (yes)
# GETTEXT no or yes: set to yes for dynamic gettext support (yes)
# ICONV no or yes: set to yes for dynamic iconv support (yes)
# MBYTE no or yes: set to yes to include multibyte support (yes)
@ -272,6 +275,30 @@ EXTRA_LIBS += $(TCL)/lib/tcl$(TCL_VER).lib
endif
endif
##############################
# DYNAMIC_LUA=yes works.
# DYNAMIC_LUA=no does not (unresolved externals on link).
##############################
ifdef LUA
DEFINES += -DFEAT_LUA
INCLUDES += -I$(LUA)/include
EXTRA_OBJS += $(OUTDIR)/if_lua.o
ifndef DYNAMIC_LUA
DYNAMIC_LUA = yes
endif
ifndef LUA_VER
LUA_VER = 51
endif
ifeq (yes, $(DYNAMIC_LUA))
DEFINES += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\"
else
EXTRA_LIBS += $(LUA)/lib/lua$(LUA_VER).lib
endif
endif
##############################
ifeq (yes, $(GETTEXT))
DEFINES += -DDYNAMIC_GETTEXT

View File

@ -104,6 +104,23 @@ PERLLIB=$(PERL)/lib
PERLLIBS=$(PERLLIB)/Core
endif
# uncomment 'LUA' if you want a Lua-enabled version
#LUA=/usr/local
ifdef LUA
ifndef DYNAMIC_LUA
DYNAMIC_LUA=yes
endif
ifndef LUA_VER
LUA_VER=51
endif
ifeq (no,$(DYNAMIC_LUA))
LUA_LIB = -L$(LUA)/lib -llua
endif
endif
# uncomment 'MZSCHEME' if you want a MzScheme-enabled version
#MZSCHEME=d:/plt
ifdef MZSCHEME
@ -294,6 +311,13 @@ CFLAGS += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
endif
endif
ifdef LUA
CFLAGS += -I$(LUA)/include -DFEAT_LUA
ifeq (yes, $(DYNAMIC_LUA))
CFLAGS += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\"
endif
endif
ifdef MZSCHEME
CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME)/collects\"
ifeq (yes, $(DYNAMIC_MZSCHEME))
@ -427,6 +451,9 @@ OBJ = \
ifdef PERL
OBJ += $(OUTDIR)/if_perl.o
endif
ifdef LUA
OBJ += $(OUTDIR)/if_lua.o
endif
ifdef MZSCHEME
OBJ += $(OUTDIR)/if_mzsch.o
MZSCHEME_INCL = if_mzsch.h
@ -549,7 +576,7 @@ uninstal.exe: uninstal.c
$(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIB)
$(TARGET): $(OUTDIR) $(OBJ)
$(CC) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(RUBYLIB)
$(CC) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(RUBYLIB)
upx: exes
upx gvim.exe
@ -632,7 +659,7 @@ ifneq (sh.exe, $(SHELL))
@echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c
@echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c
@echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c
@echo 'char_u *all_lflags = (char_u *)"$(CC) $(CFLAGS) $(LFLAGS) -o $(TARGET) $(LIB) -lole32 -luuid $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(RUBYLIB)";' >> pathdef.c
@echo 'char_u *all_lflags = (char_u *)"$(CC) $(CFLAGS) $(LFLAGS) -o $(TARGET) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(RUBYLIB)";' >> pathdef.c
@echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c
@echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c
else
@ -642,7 +669,7 @@ else
@echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c
@echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c
@echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c
@echo char_u *all_lflags = (char_u *)"$(CC) $(CFLAGS) $(LFLAGS) -o $(TARGET) $(LIB) -lole32 -luuid $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(RUBYLIB)"; >> pathdef.c
@echo char_u *all_lflags = (char_u *)"$(CC) $(CFLAGS) $(LFLAGS) -o $(TARGET) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(RUBYLIB)"; >> pathdef.c
@echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c
@echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c
endif

View File

@ -30,6 +30,11 @@
# is yes)
# Global IME support: GIME=yes (requires GUI=yes)
#
# Lua interface:
# LUA=[Path to Lua directory]
# DYNAMIC_LUA=yes (to load the Lua DLL dynamically)
# LUA_VER=[Lua version] (default is 51)
#
# MzScheme interface:
# MZSCHEME=[Path to MzScheme directory]
# DYNAMIC_MZSCHEME=yes (to load the MzScheme DLLs dynamically)
@ -152,6 +157,9 @@ OBJDIR = .\ObjC
!if "$(OLE)" == "yes"
OBJDIR = $(OBJDIR)O
!endif
!ifdef LUA
OBJDIR = $(OBJDIR)U
!endif
!ifdef PERL
OBJDIR = $(OBJDIR)L
!endif
@ -364,6 +372,9 @@ MSVCVER = 10.0
!if "$(_NMAKE_VER)" == "10.00.30319.01"
MSVCVER = 10.0
!endif
!if "$(_NMAKE_VER)" == "9.00.30729.01"
MSVCVER = 9.0
!endif
!endif
# Abort bulding VIM if version of VC is unrecognised.
@ -609,6 +620,27 @@ TCL_LIB = $(TCL)\lib\tcl$(TCL_VER)vc.lib
!endif
!endif
# Lua interface
!ifdef LUA
!ifndef LUA_VER
LUA_VER = 51
!endif
!message Lua requested (version $(LUA_VER)) - root dir is "$(LUA)"
!if "$(DYNAMIC_LUA)" == "yes"
!message Lua DLL will be loaded dynamically
!endif
CFLAGS = $(CFLAGS) -DFEAT_LUA
LUA_OBJ = $(OUTDIR)\if_lua.obj
LUA_INC = /I "$(LUA)\include" /I "$(LUA)"
!if "$(DYNAMIC_LUA)" == "yes"
CFLAGS = $(CFLAGS) -DDYNAMIC_LUA \
-DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\"
LUA_LIB = /nodefaultlib:lua$(LUA_VER).lib
!else
LUA_LIB = "$(LUA)\lib\lua$(LUA_VER).lib"
!endif
!endif
# PYTHON interface
!ifdef PYTHON
!ifndef PYTHON_VER
@ -803,7 +835,7 @@ conflags = $(conflags) /map /mapinfo:lines
LINKARGS1 = $(linkdebug) $(conflags)
LINKARGS2 = $(CON_LIB) $(GUI_LIB) $(LIBC) $(OLE_LIB) user32.lib $(SNIFF_LIB) \
$(MZSCHEME_LIB) $(PERL_LIB) $(PYTHON_LIB) $(RUBY_LIB) \
$(LUA_LIB) $(MZSCHEME_LIB) $(PERL_LIB) $(PYTHON_LIB) $(RUBY_LIB) \
$(TCL_LIB) $(NETBEANS_LIB) $(XPM_LIB) $(LINK_PDB)
# Report link time code generation progress if used.
@ -819,11 +851,12 @@ all: $(VIM).exe vimrun.exe install.exe uninstal.exe xxd/xxd.exe \
GvimExt/gvimext.dll
$(VIM).exe: $(OUTDIR) $(OBJ) $(GUI_OBJ) $(OLE_OBJ) $(OLE_IDL) $(MZSCHEME_OBJ) \
$(PERL_OBJ) $(PYTHON_OBJ) $(RUBY_OBJ) $(TCL_OBJ) $(SNIFF_OBJ) \
$(CSCOPE_OBJ) $(NETBEANS_OBJ) $(XPM_OBJ) version.c version.h
$(LUA_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(RUBY_OBJ) $(TCL_OBJ) \
$(SNIFF_OBJ) $(CSCOPE_OBJ) $(NETBEANS_OBJ) $(XPM_OBJ) \
version.c version.h
$(CC) $(CFLAGS) version.c
$(link) $(LINKARGS1) -out:$(VIM).exe $(OBJ) $(GUI_OBJ) $(OLE_OBJ) \
$(MZSCHEME_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(RUBY_OBJ) \
$(LUA_OBJ) $(MZSCHEME_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(RUBY_OBJ) \
$(TCL_OBJ) $(SNIFF_OBJ) $(CSCOPE_OBJ) $(NETBEANS_OBJ) \
$(XPM_OBJ) $(OUTDIR)\version.obj $(LINKARGS2)
@ -961,6 +994,9 @@ $(OUTDIR)/gui_w32.obj: $(OUTDIR) gui_w32.c gui_w48.c $(INCL) $(GUI_INCL)
$(OUTDIR)/if_cscope.obj: $(OUTDIR) if_cscope.c $(INCL)
$(OUTDIR)/if_lua.obj: $(OUTDIR) if_lua.c $(INCL)
$(CC) $(CFLAGS) $(LUA_INC) if_lua.c
if_perl.c : if_perl.xs typemap
$(PERL_EXE) $(XSUBPP) -prototypes -typemap $(XSUBPP_TYPEMAP) \
-typemap typemap if_perl.xs > if_perl.c

View File

@ -38,6 +38,7 @@
# could be lost.
# - Uncomment one or more of these lines to include an interface;
# each makes Vim quite a bit bigger:
# --enable-luainterp for Lua interpreter
# --enable-perlinterp for Perl interpreter
# --enable-pythoninterp for Python interpreter
# --enable-rubyinterp for Ruby interpreter
@ -395,6 +396,13 @@ CClink = $(CC)
#CONF_OPT_RUBY = --enable-rubyinterp
#CONF_OPT_RUBY = --enable-rubyinterp --with-ruby-command=ruby1.9.1
# LUA
# Uncomment this when you want to include the Lua interface.
#CONF_OPT_LUA = --enable-luainterp
# Lua installation dir (also in LUA_PREFIX environment variable)
#CONF_OPT_LUA_PREFIX = --with-lua-prefix=/usr/local
#CONF_OPT_LUA_PREFIX = --with-lua-prefix=/usr
# MZSCHEME
# Uncomment this when you want to include the MzScheme interface.
#CONF_OPT_MZSCHEME = --enable-mzschemeinterp
@ -1296,7 +1304,7 @@ SHELL = /bin/sh
.SUFFIXES: .c .o .pro
PRE_DEFS = -Iproto $(DEFS) $(GUI_DEFS) $(GUI_IPATH) $(CPPFLAGS) $(EXTRA_IPATHS)
POST_DEFS = $(X_CFLAGS) $(MZSCHEME_CFLAGS) $(PERL_CFLAGS) $(ECL_CFLAGS) $(PYTHON_CFLAGS) $(TCL_CFLAGS) $(RUBY_CFLAGS) $(EXTRA_DEFS)
POST_DEFS = $(X_CFLAGS) $(LUA_CFLAGS) $(MZSCHEME_CFLAGS) $(PERL_CFLAGS) $(ECL_CFLAGS) $(PYTHON_CFLAGS) $(TCL_CFLAGS) $(RUBY_CFLAGS) $(EXTRA_DEFS)
ALL_CFLAGS = $(PRE_DEFS) $(CFLAGS) $(PROFILE_CFLAGS) $(POST_DEFS)
@ -1311,7 +1319,7 @@ LINT_EXTRA = -DUSE_SNIFF -DHANGUL_INPUT -D"__attribute__(x)="
DEPEND_CFLAGS = -DPROTO -DDEPEND -DFEAT_GUI $(LINT_CFLAGS)
ALL_LIB_DIRS = $(GUI_LIBS_DIR) $(X_LIBS_DIR)
ALL_LIBS = $(GUI_LIBS1) $(GUI_X_LIBS) $(GUI_LIBS2) $(X_PRE_LIBS) $(X_LIBS) $(X_EXTRA_LIBS) $(LIBS) $(EXTRA_LIBS) $(MZSCHEME_LIBS) $(PERL_LIBS) $(PYTHON_LIBS) $(TCL_LIBS) $(RUBY_LIBS) $(PROFILE_LIBS)
ALL_LIBS = $(GUI_LIBS1) $(GUI_X_LIBS) $(GUI_LIBS2) $(X_PRE_LIBS) $(X_LIBS) $(X_EXTRA_LIBS) $(LIBS) $(EXTRA_LIBS) $(LUA_LIBS) $(MZSCHEME_LIBS) $(PERL_LIBS) $(PYTHON_LIBS) $(TCL_LIBS) $(RUBY_LIBS) $(PROFILE_LIBS)
# abbreviations
DEST_BIN = $(DESTDIR)$(BINDIR)
@ -1414,13 +1422,13 @@ BASIC_SRC = \
window.c \
$(OS_EXTRA_SRC)
SRC = $(BASIC_SRC) $(GUI_SRC) $(HANGULIN_SRC) $(MZSCHEME_SRC) \
SRC = $(BASIC_SRC) $(GUI_SRC) $(HANGULIN_SRC) $(LUA_SRC) $(MZSCHEME_SRC) \
$(PERL_SRC) $(PYTHON_SRC) $(TCL_SRC) $(RUBY_SRC) \
$(SNIFF_SRC) $(WORKSHOP_SRC) $(WSDEBUG_SRC)
TAGS_SRC = *.c *.cpp if_perl.xs
EXTRA_SRC = hangulin.c if_mzsch.c auto/if_perl.c if_perlsfio.c \
EXTRA_SRC = hangulin.c if_lua.c if_mzsch.c auto/if_perl.c if_perlsfio.c \
if_python.c if_tcl.c if_ruby.c if_sniff.c gui_beval.c \
workshop.c wsdebug.c integration.c netbeans.c
@ -1487,6 +1495,7 @@ OBJ = \
objects/undo.o \
objects/window.o \
$(GUI_OBJ) \
$(LUA_OBJ) \
$(MZSCHEME_OBJ) \
$(PERL_OBJ) \
$(PYTHON_OBJ) \
@ -1587,6 +1596,7 @@ config auto/config.mk: auto/configure config.mk.in config.h.in
$(CONF_OPT_SNIFF) $(CONF_OPT_FEAT) $(CONF_TERM_LIB) \
$(CONF_OPT_COMPBY) $(CONF_OPT_ACL) $(CONF_OPT_NETBEANS) \
$(CONF_ARGS) $(CONF_OPT_MZSCHEME) $(CONF_OPT_PLTHOME) \
$(CONF_OPT_LUA) $(CONF_OPT_LUA_PREFIX) \
$(CONF_OPT_SYSMOUSE)
# Use "make reconfig" to rerun configure without cached values.
@ -2439,6 +2449,9 @@ objects/if_cscope.o: if_cscope.c
objects/if_xcmdsrv.o: if_xcmdsrv.c
$(CCC) -o $@ if_xcmdsrv.c
objects/if_lua.o: if_lua.c
$(CCC) -o $@ if_lua.c
objects/if_mzsch.o: if_mzsch.c $(MZSCHEME_EXTRA)
$(CCC) -o $@ $(MZSCHEME_CFLAGS_EXTRA) if_mzsch.c
@ -2945,6 +2958,10 @@ objects/hangulin.o: hangulin.c vim.h auto/config.h feature.h os_unix.h \
auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \
regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \
globals.h farsi.h arabic.h
objects/if_lua.o: if_lua.c vim.h auto/config.h feature.h os_unix.h \
auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \
regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \
globals.h farsi.h arabic.h
objects/if_mzsch.o: if_mzsch.c vim.h auto/config.h feature.h os_unix.h \
auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \
regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \

149
src/auto/configure vendored
View File

@ -662,6 +662,12 @@ MZSCHEME_PRO
MZSCHEME_OBJ
MZSCHEME_SRC
vi_cv_path_mzscheme
LUA_CFLAGS
LUA_LIBS
LUA_PRO
LUA_OBJ
LUA_SRC
vi_cv_path_lua
compiledby
dogvimdiff
dovimdiff
@ -742,6 +748,8 @@ with_features
with_compiledby
enable_xsmp
enable_xsmp_interact
enable_luainterp
with_lua_prefix
enable_mzschemeinterp
with_plthome
enable_perlinterp
@ -1405,6 +1413,7 @@ Optional Features:
--disable-selinux Don't check for SELinux support.
--disable-xsmp Disable XSMP session management
--disable-xsmp-interact Disable XSMP interaction
--enable-luainterp Include Lua interpreter.
--enable-mzschemeinterp Include MzScheme interpreter.
--enable-perlinterp Include Perl interpreter.
--enable-pythoninterp Include Python interpreter.
@ -1446,6 +1455,7 @@ Optional Packages:
--with-modified-by=NAME name of who modified a release version
--with-features=TYPE tiny, small, normal, big or huge (default: normal)
--with-compiledby=NAME name to show in :version message
--with-lua-prefix=PFX Prefix where Lua is installed.
--with-plthome=PLTHOME Use PLTHOME.
--with-python-config-dir=PATH Python's config directory
--with-tclsh=PATH which tclsh to use (default: tclsh8.0)
@ -4562,6 +4572,145 @@ else
$as_echo "yes" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-luainterp argument" >&5
$as_echo_n "checking --enable-luainterp argument... " >&6; }
# Check whether --enable-luainterp was given.
if test "${enable_luainterp+set}" = set; then :
enableval=$enable_luainterp;
else
enable_luainterp="no"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_luainterp" >&5
$as_echo "$enable_luainterp" >&6; }
if test "$enable_luainterp" = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-lua-prefix argument" >&5
$as_echo_n "checking --with-lua-prefix argument... " >&6; }
# Check whether --with-lua_prefix was given.
if test "${with_lua_prefix+set}" = set; then :
withval=$with_lua_prefix; with_lua_prefix="$withval"; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_lua_prefix" >&5
$as_echo "$with_lua_prefix" >&6; }
else
with_lua_prefix="";{ $as_echo "$as_me:${as_lineno-$LINENO}: result: \"no\"" >&5
$as_echo "\"no\"" >&6; }
fi
if test "X$with_lua_prefix" != "X"; then
vi_cv_path_lua_pfx="$with_lua_prefix"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking LUA_PREFIX environment var" >&5
$as_echo_n "checking LUA_PREFIX environment var... " >&6; }
if test "X$LUA_PREFIX" != "X"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$LUA_PREFIX\"" >&5
$as_echo "\"$LUA_PREFIX\"" >&6; }
vi_cv_path_lua_pfx="$LUA_PREFIX"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: \"not set\"" >&5
$as_echo "\"not set\"" >&6; }
fi
fi
LUA_INC=
if test "X$vi_cv_path_lua_pfx" != "X"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if lua.h can be found in $vi_cv_path_lua_pfx/include" >&5
$as_echo_n "checking if lua.h can be found in $vi_cv_path_lua_pfx/include... " >&6; }
if test -f $vi_cv_path_lua_pfx/include/lua.h; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: \"yes\"" >&5
$as_echo "\"yes\"" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: \"no\"" >&5
$as_echo "\"no\"" >&6; }
# Extract the first word of "lua", so it can be a program name with args.
set dummy lua; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if test "${ac_cv_path_vi_cv_path_lua+set}" = set; then :
$as_echo_n "(cached) " >&6
else
case $vi_cv_path_lua in
[\\/]* | ?:[\\/]*)
ac_cv_path_vi_cv_path_lua="$vi_cv_path_lua" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_path_vi_cv_path_lua="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
vi_cv_path_lua=$ac_cv_path_vi_cv_path_lua
if test -n "$vi_cv_path_lua"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_path_lua" >&5
$as_echo "$vi_cv_path_lua" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "X$vi_cv_path_lua" != "X"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Lua version" >&5
$as_echo_n "checking Lua version... " >&6; }
if test "${vi_cv_version_lua+set}" = set; then :
$as_echo_n "(cached) " >&6
else
vi_cv_version_lua=`${vi_cv_path_lua} -e "print(_VERSION:sub(5,7))"`
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_version_lua" >&5
$as_echo "$vi_cv_version_lua" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if lua.h can be found in $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua" >&5
$as_echo_n "checking if lua.h can be found in $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua... " >&6; }
if test -f $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua/lua.h; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: \"yes\"" >&5
$as_echo "\"yes\"" >&6; }
LUA_INC=/lua$vi_cv_version_lua
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: \"no\"" >&5
$as_echo "\"no\"" >&6; }
vi_cv_path_lua_pfx=
fi
fi
fi
fi
if test "X$vi_cv_path_lua_pfx" != "X"; then
if test "X$vi_cv_version_lua" != "X"; then
LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua$vi_cv_version_lua"
else
LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua"
fi
LUA_CFLAGS="-I${vi_cv_path_lua_pfx}/include${LUA_INC}"
LUA_SRC="if_lua.c"
LUA_OBJ="objects/if_lua.o"
LUA_PRO="if_lua.pro"
$as_echo "#define FEAT_LUA 1" >>confdefs.h
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-mzschemeinterp argument" >&5
$as_echo_n "checking --enable-mzschemeinterp argument... " >&6; }
# Check whether --enable-mzschemeinterp was given.

View File

@ -595,6 +595,9 @@ free_buffer(buf)
buf_T *buf;
{
free_buffer_stuff(buf, TRUE);
#ifdef FEAT_LUA
lua_buffer_free(buf);
#endif
#ifdef FEAT_MZSCHEME
mzscheme_buffer_free(buf);
#endif

View File

@ -22,6 +22,12 @@ X_PRE_LIBS = @X_PRE_LIBS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIB@
LUA_LIBS = @LUA_LIBS@
LUA_SRC = @LUA_SRC@
LUA_OBJ = @LUA_OBJ@
LUA_CFLAGS = @LUA_CFLAGS@
LUA_PRO = @LUA_PRO@
MZSCHEME_LIBS = @MZSCHEME_LIBS@
MZSCHEME_SRC = @MZSCHEME_SRC@
MZSCHEME_OBJ = @MZSCHEME_OBJ@

View File

@ -316,6 +316,9 @@
/* Define if you want huge features. */
#undef FEAT_HUGE
/* Define if you want to include the Lua interpreter. */
#undef FEAT_LUA
/* Define if you want to include the MzScheme interpreter. */
#undef FEAT_MZSCHEME

View File

@ -36,6 +36,12 @@ X_PRE_LIBS = @X_PRE_LIBS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIB@
LUA_LIBS = @LUA_LIBS@
LUA_SRC = @LUA_SRC@
LUA_OBJ = @LUA_OBJ@
LUA_CFLAGS = @LUA_CFLAGS@
LUA_PRO = @LUA_PRO@
MZSCHEME_LIBS = @MZSCHEME_LIBS@
MZSCHEME_SRC = @MZSCHEME_SRC@
MZSCHEME_OBJ = @MZSCHEME_OBJ@

View File

@ -410,6 +410,81 @@ else
AC_MSG_RESULT(yes)
fi
dnl Check for Lua feature.
AC_MSG_CHECKING(--enable-luainterp argument)
AC_ARG_ENABLE(luainterp,
[ --enable-luainterp Include Lua interpreter.], ,
[enable_luainterp="no"])
AC_MSG_RESULT($enable_luainterp)
if test "$enable_luainterp" = "yes"; then
dnl -- find the lua executable
AC_SUBST(vi_cv_path_lua)
AC_MSG_CHECKING(--with-lua-prefix argument)
AC_ARG_WITH(lua_prefix,
[ --with-lua-prefix=PFX Prefix where Lua is installed.],
with_lua_prefix="$withval"; AC_MSG_RESULT($with_lua_prefix),
with_lua_prefix="";AC_MSG_RESULT("no"))
if test "X$with_lua_prefix" != "X"; then
vi_cv_path_lua_pfx="$with_lua_prefix"
else
AC_MSG_CHECKING(LUA_PREFIX environment var)
if test "X$LUA_PREFIX" != "X"; then
AC_MSG_RESULT("$LUA_PREFIX")
vi_cv_path_lua_pfx="$LUA_PREFIX"
else
AC_MSG_RESULT("not set")
fi
fi
LUA_INC=
if test "X$vi_cv_path_lua_pfx" != "X"; then
AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include)
if test -f $vi_cv_path_lua_pfx/include/lua.h; then
AC_MSG_RESULT("yes")
else
AC_MSG_RESULT("no")
dnl -- try to find Lua executable
AC_PATH_PROG(vi_cv_path_lua, lua)
if test "X$vi_cv_path_lua" != "X"; then
dnl -- find Lua version
AC_CACHE_CHECK(Lua version, vi_cv_version_lua,
[ vi_cv_version_lua=`${vi_cv_path_lua} -e "print(_VERSION:sub(5,7))"` ])
AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua)
if test -f $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua/lua.h; then
AC_MSG_RESULT("yes")
LUA_INC=/lua$vi_cv_version_lua
else
AC_MSG_RESULT("no")
vi_cv_path_lua_pfx=
fi
fi
fi
fi
if test "X$vi_cv_path_lua_pfx" != "X"; then
if test "X$vi_cv_version_lua" != "X"; then
dnl Test alternate location using version
LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua$vi_cv_version_lua"
else
LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua"
fi
LUA_CFLAGS="-I${vi_cv_path_lua_pfx}/include${LUA_INC}"
LUA_SRC="if_lua.c"
LUA_OBJ="objects/if_lua.o"
LUA_PRO="if_lua.pro"
AC_DEFINE(FEAT_LUA)
fi
AC_SUBST(LUA_SRC)
AC_SUBST(LUA_OBJ)
AC_SUBST(LUA_PRO)
AC_SUBST(LUA_LIBS)
AC_SUBST(LUA_CFLAGS)
fi
dnl Check for MzScheme feature.
AC_MSG_CHECKING(--enable-mzschemeinterp argument)
AC_ARG_ENABLE(mzschemeinterp,

View File

@ -5912,7 +5912,7 @@ list_equal(l1, l2, ic)
}
#if defined(FEAT_RUBY) || defined(FEAT_PYTHON) || defined(FEAT_MZSCHEME) \
|| defined(PROTO)
|| defined(FEAT_LUA) || defined(PROTO)
/*
* Return the dictitem that an entry in a hashtable points to.
*/
@ -11912,6 +11912,11 @@ f_has(argvars, rettv)
#ifdef FEAT_LOCALMAP
"localmap",
#endif
#ifdef FEAT_LUA
# ifndef DYNAMIC_LUA
"lua",
# endif
#endif
#ifdef FEAT_MENU
"menu",
#endif
@ -12167,6 +12172,10 @@ f_has(argvars, rettv)
else if (STRICMP(name, "iconv") == 0)
n = iconv_enabled(FALSE);
#endif
#ifdef DYNAMIC_LUA
else if (STRICMP(name, "lua") == 0)
n = lua_enabled(FALSE);
#endif
#ifdef DYNAMIC_MZSCHEME
else if (STRICMP(name, "mzscheme") == 0)
n = mzscheme_enabled(FALSE);

View File

@ -571,6 +571,12 @@ EX(CMD_lrewind, "lrewind", ex_cc,
RANGE|NOTADR|COUNT|TRLBAR|BANG),
EX(CMD_ltag, "ltag", ex_tag,
NOTADR|TRLBAR|BANG|WORD1),
EX(CMD_lua, "lua", ex_lua,
RANGE|EXTRA|NEEDARG|CMDWIN),
EX(CMD_luado, "luado", ex_luado,
RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN),
EX(CMD_luafile, "luafile", ex_luafile,
RANGE|FILE1|NEEDARG|CMDWIN),
EX(CMD_lunmap, "lunmap", ex_unmap,
EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
EX(CMD_lvimgrep, "lvimgrep", ex_vimgrep,

View File

@ -248,6 +248,11 @@ static void ex_popup __ARGS((exarg_T *eap));
# define ex_rundo ex_ni
# define ex_wundo ex_ni
#endif
#ifndef FEAT_LUA
# define ex_lua ex_script_ni
# define ex_luado ex_ni
# define ex_luafile ex_ni
#endif
#ifndef FEAT_MZSCHEME
# define ex_mzscheme ex_script_ni
# define ex_mzfile ex_ni
@ -2543,6 +2548,7 @@ do_one_cmd(cmdlinep, sourcing,
case CMD_leftabove:
case CMD_let:
case CMD_lockmarks:
case CMD_lua:
case CMD_match:
case CMD_mzscheme:
case CMD_perl:

View File

@ -1194,6 +1194,7 @@
/*
* These features can only be included by using a configure argument. See the
* Makefile for a line to uncomment.
* +lua Lua interface: "--enable-luainterp"
* +mzscheme MzScheme interface: "--enable-mzscheme"
* +perl Perl interface: "--enable-perlinterp"
* +python Python interface: "--enable-pythoninterp"

View File

@ -1417,7 +1417,8 @@ EXTERN char_u e_libcall[] INIT(= N_("E364: Library call failed for \"%s()\""));
#endif
#if defined(DYNAMIC_PERL) || defined(DYNAMIC_PYTHON) || defined(DYNAMIC_RUBY) \
|| defined(DYNAMIC_TCL) || defined(DYNAMIC_ICONV) \
|| defined(DYNAMIC_GETTEXT) || defined(DYNAMIC_MZSCHEME)
|| defined(DYNAMIC_GETTEXT) || defined(DYNAMIC_MZSCHEME) \
|| defined(DYNAMIC_LUA)
EXTERN char_u e_loadlib[] INIT(= N_("E370: Could not load library %s"));
EXTERN char_u e_loadfunc[] INIT(= N_("E448: Could not load library function %s"));
#endif

1099
src/if_lua.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -243,13 +243,13 @@ EVIEWTARGET = $EVIEWNAME$LNKSUF
PRE_DEFS = -Iproto -I. $DEFS $GUI_DEFS $GUI_IPATH $CPPFLAGS $?(EXTRA_IPATHS)
POST_DEFS = $X_CFLAGS $MZSCHEME_CFLAGS $PERL_CFLAGS $PYTHON_CFLAGS $TCL_CFLAGS $RUBY_CFLAGS $?(EXTRA_DEFS)
POST_DEFS = $X_CFLAGS $LUA_CFLAGS $MZSCHEME_CFLAGS $PERL_CFLAGS $PYTHON_CFLAGS $TCL_CFLAGS $RUBY_CFLAGS $?(EXTRA_DEFS)
CFLAGS = $PRE_DEFS $CONF_CFLAGS $?(PROFILE_CFLAGS) $POST_DEFS
CPPFLAGS =
ALL_LIB_DIRS = $GUI_LIBS_DIR $X_LIBS_DIR
LDFLAGS = $ALL_LIB_DIRS $CONF_LDFLAGS
LIBS = $GUI_LIBS1 $GUI_X_LIBS $GUI_LIBS2 $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $CONF_LIBS $?(EXTRA_LIBS) $MZSCHEME_LIBS $PERL_LIBS $PYTHON_LIBS $TCL_LIBS $RUBY_LIBS $?(PROFILE_LIBS)
LIBS = $GUI_LIBS1 $GUI_X_LIBS $GUI_LIBS2 $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $CONF_LIBS $?(EXTRA_LIBS) $LUA_LIBS $MZSCHEME_LIBS $PERL_LIBS $PYTHON_LIBS $TCL_LIBS $RUBY_LIBS $?(PROFILE_LIBS)
Target = $VIMNAME
@ -340,6 +340,7 @@ Source =
$OS_EXTRA_SRC
$GUI_SRC
$HANGULIN_SRC
$LUA_SRC
$MZSCHEME_SRC
$PERL_SRC
$NETBEANS_SRC

View File

@ -1390,6 +1390,9 @@ getout(exitval)
windgoto((int)Rows - 1, 0);
#endif
#ifdef FEAT_LUA
lua_end();
#endif
#ifdef FEAT_MZSCHEME
mzscheme_end();
#endif

View File

@ -174,6 +174,10 @@ void qsort __ARGS((void *base, size_t elm_count, size_t elm_size, int (*cmp)(con
# include "version.pro"
# include "window.pro"
# ifdef FEAT_LUA
# include "if_lua.pro"
# endif
# ifdef FEAT_MZSCHEME
# include "if_mzsch.pro"
# endif

8
src/proto/if_lua.pro Normal file
View File

@ -0,0 +1,8 @@
/* if_lua.c */
void lua_end __ARGS((void));
void ex_lua __ARGS((exarg_T *eap));
void ex_luado __ARGS((exarg_T *eap));
void ex_luafile __ARGS((exarg_T *eap));
void lua_buffer_free __ARGS((buf_T *buf));
void lua_window_free __ARGS((win_T *win));
/* vim: set ft=c : */

View File

@ -314,6 +314,15 @@ static char *(features[]) =
#else
"-localmap",
#endif
#ifdef FEAT_LUA
# ifdef DYNAMIC_LUA
"+lua/dyn",
# else
"+lua",
# endif
#else
"-lua",
#endif
#ifdef FEAT_MENU
"+menu",
#else

View File

@ -4370,6 +4370,10 @@ win_free(wp, tp)
block_autocmds();
#endif
#ifdef FEAT_LUA
lua_window_free(wp);
#endif
#ifdef FEAT_MZSCHEME
mzscheme_window_free(wp);
#endif