diff options
-rw-r--r-- | runtime/doc/if_perl.txt | 15 | ||||
-rw-r--r-- | runtime/doc/syntax.txt | 6 | ||||
-rw-r--r-- | runtime/doc/todo.txt | 5 | ||||
-rw-r--r-- | runtime/ftplugin/debchangelog.vim | 6 | ||||
-rw-r--r-- | runtime/syntax/fortran.vim | 78 | ||||
-rw-r--r-- | src/Makefile | 11 | ||||
-rwxr-xr-x | src/auto/configure | 14 | ||||
-rw-r--r-- | src/config.h.in | 3 | ||||
-rw-r--r-- | src/configure.in | 13 | ||||
-rw-r--r-- | src/if_perl.xs | 67 | ||||
-rwxr-xr-x | src/link.sh | 2 |
11 files changed, 158 insertions, 62 deletions
diff --git a/runtime/doc/if_perl.txt b/runtime/doc/if_perl.txt index 842393a77..50f2712f3 100644 --- a/runtime/doc/if_perl.txt +++ b/runtime/doc/if_perl.txt @@ -1,4 +1,4 @@ -*if_perl.txt* For Vim version 7.3b. Last change: 2010 Jul 20 +*if_perl.txt* For Vim version 7.3b. Last change: 2010 Jul 21 VIM REFERENCE MANUAL by Sven Verdoolaege @@ -265,12 +265,15 @@ Note that "EOF" must be at the start of the line. ============================================================================== 4. Dynamic loading *perl-dynamic* -On MS-Windows the Perl library can be loaded dynamically. The |:version| -output then includes |+perl/dyn|. +On MS-Windows and Unix the Perl library can be loaded dynamically. The +|:version| output then includes |+perl/dyn|. -This means that Vim will search for the Perl DLL file only when needed. When -you don't use the Perl interface you don't need it, thus you can use Vim -without this DLL file. +This means that Vim will search for the Perl DLL or shared library file only +when needed. When you don't use the Perl interface you don't need it, thus +you can use Vim without this file. + + +MS-Windows ~ You can download Perl from http://www.perl.org. The one from ActiveState was used for building Vim. diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index bdd3c4f9b..9c9caefc8 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 7.3b. Last change: 2010 Jul 20 +*syntax.txt* For Vim version 7.3b. Last change: 2010 Jul 21 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1083,7 +1083,9 @@ FORTRAN *fortran.vim* *ft-fortran-syntax* Default highlighting and dialect ~ Highlighting appropriate for f95 (Fortran 95) is used by default. This choice should be appropriate for most users most of the time because Fortran 95 is a -superset of Fortran 90 and almost a superset of Fortran 77. +superset of Fortran 90 and almost a superset of Fortran 77. Preliminary +support for Fortran 2003 and Fortran 2008 features has been introduced and is +automatically available in the default (f95) highlighting. Fortran source code form ~ Fortran 9x code can be in either fixed or free source form. Note that the diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 0b736ba06..906d6ed9e 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.3b. Last change: 2010 Jul 20 +*todo.txt* For Vim version 7.3b. Last change: 2010 Jul 21 VIM REFERENCE MANUAL by Bram Moolenaar @@ -31,6 +31,7 @@ be worked on, but only if you sponsor Vim development. See |sponsor|. -------------------- Known bugs and current work ----------------------- Include patch for horizontal scoll wheel? (Bjorn Winckler, 2010 Jul 20) +Asked for a few changes. Patch for Dynamic loading for Perl. (James Vega, 2010 Jul 20) @@ -1124,8 +1125,6 @@ More patches: Sep 13) - Patch for adding "space" item in 'listchars'. (Jérémie Roquet, 2009 Oct 29, Docs patch Oct 30) -- Patch for supporting #rrggbb in color terminals. (Matt Wozniski) - Where is a recent version of this patch? Or use CSApprox plugin? - Replace ccomplete.vim by cppcomplete.vim from www.vim.org? script 1520 by Vissale Neang. (Martin Stubenschrott) Asked Vissale to make the scripts more friendly for the Vim distribution. diff --git a/runtime/ftplugin/debchangelog.vim b/runtime/ftplugin/debchangelog.vim index cd21e93d5..80ff8efe4 100644 --- a/runtime/ftplugin/debchangelog.vim +++ b/runtime/ftplugin/debchangelog.vim @@ -3,9 +3,9 @@ " Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> " Former Maintainers: Michael Piefel <piefel@informatik.hu-berlin.de> " Stefano Zacchiroli <zack@debian.org> -" Last Change: 2010-04-29 +" Last Change: 2010-07-11 " License: GNU GPL, version 2.0 or later -" URL: http://hg.debian.org/hg/pkg-vim/vim/raw-file/tip/runtime/ftplugin/debchangelog.vim +" URL: http://hg.debian.org/hg/pkg-vim/vim/file/unstable/runtime/ftplugin/debchangelog.vim " Bug completion requires apt-listbugs installed for Debian packages or " python-launchpadlib installed for Ubuntu packages @@ -228,7 +228,7 @@ endfunction augroup changelogMenu au BufEnter * if &filetype == "debchangelog" | call <SID>MakeMenu() | endif -au BufLeave * if &filetype == "debchangelog" | aunmenu Changelog | endif +au BufLeave * if &filetype == "debchangelog" | silent! aunmenu Changelog | endif augroup END " }}} diff --git a/runtime/syntax/fortran.vim b/runtime/syntax/fortran.vim index 3d323fbb9..bcc77c5a5 100644 --- a/runtime/syntax/fortran.vim +++ b/runtime/syntax/fortran.vim @@ -1,16 +1,16 @@ " Vim syntax file " Language: Fortran95 (and Fortran90, Fortran77, F and elf90) -" Version: 0.88 +" Version: 0.89 " URL: http://www.unb.ca/chem/ajit/syntax/fortran.vim -" Last Change: 2008 Nov 01 +" Last Change: 2010 July 21 " Maintainer: Ajit J. Thakkar (ajit AT unb.ca); <http://www.unb.ca/chem/ajit/> -" Usage: Do :help fortran-syntax from Vim +" Usage: For instructions, do :help fortran-syntax from Vim " Credits: " Version 0.1 was based on the fortran 77 syntax file by Mario Eusebio and " Preben Guldberg. Useful suggestions were made by: Andrej Panjkov, " Bram Moolenaar, Thomas Olsen, Michael Sternberg, Christian Reile, " Walter Dieudonné, Alexander Wagner, Roman Bertle, Charles Rendleman, -" and Andrew Griffiths. For instructions on use, do :help fortran from vim +" Andrew Griffiths, Joe Krahn, and Hendrik Merx. " For version 5.x: Clear all syntax items " For version 6.x: Quit if a syntax file is already loaded @@ -74,7 +74,7 @@ if !exists("b:fortran_fixed_source") " Detection becomes more accurate and time-consuming if more lines " are checked. Increase the limit below if you keep lots of comments at " the very top of each file and you have a fast computer. - let b:lmax = 250 + let b:lmax = 500 if ( b:lmax > line("$") ) let b:lmax = line("$") endif @@ -82,7 +82,7 @@ if !exists("b:fortran_fixed_source") let b:ln=1 while b:ln <= b:lmax let b:test = strpart(getline(b:ln),0,5) - if b:test[0] !~ '[Cc*!#]' && b:test !~ '^ \+[!#]' && b:test =~ '[^ 0-9\t]' + if b:test !~ '^[Cc*]' && b:test !~ '^ *[!#]' && b:test =~ '[^ 0-9\t]' && b:test !~ '^[ 0-9]*\t' let b:fortran_fixed_source = 0 break endif @@ -207,7 +207,8 @@ endif syn keyword fortranTypeEx external syn keyword fortranIOEx format -syn keyword fortranKeywordEx continue +syn match fortranKeywordEx "\<continue\>" +syn match fortranKeyword "^\s*\d\+\s\+continue\>" syn match fortranKeywordEx "\<go\s*to\>" syn region fortranStringEx start=+'+ end=+'+ contains=fortranContinueMark,fortranLeftMargin,fortranSerialNumber syn keyword fortran77IntrinsicEx dim lge lgt lle llt mod @@ -290,6 +291,40 @@ if b:fortran_dialect == "f95" || b:fortran_dialect == "F" endif endif +if b:fortran_dialect == "f95" + " F2003 + syn keyword fortran03Intrinsic command_argument_count get_command get_command_argument get_environment_variable is_iostat_end is_iostat_eor move_alloc new_line selected_char_kind same_type_as extends_type_of + " ISO_C_binding + syn keyword fortran03Constant c_null_char c_alert c_backspace c_form_feed c_new_line c_carriage_return c_horizontal_tab c_vertical_tab + syn keyword fortran03Constant c_int c_short c_long c_long_long c_signed_char c_size_t c_int8_t c_int16_t c_int32_t c_int64_t c_int_least8_t c_int_least16_t c_int_least32_t c_int_least64_t c_int_fast8_t c_int_fast16_t c_int_fast32_t c_int_fast64_t c_intmax_t C_intptr_t c_float c_double c_long_double c_float_complex c_double_complex c_long_double_complex c_bool c_char c_null_ptr c_null_funptr + syn keyword fortran03Intrinsic iso_c_binding c_loc c_funloc c_associated c_f_pointer c_f_procpointer + syn keyword fortran03Type c_ptr c_funptr + " ISO_Fortran_env + syn keyword fortran03Constant iso_fortran_env character_storage_size error_unit file_storage_size input_unit iostat_end iostat_eor numeric_storage_size output_unit + " IEEE_arithmetic + syn keyword fortran03Intrinsic ieee_arithmetic ieee_support_underflow_control ieee_get_underflow_mode ieee_set_underflow_mode + + syn keyword fortran03ReadWrite flush wait + syn keyword fortran03IO decimal round iomsg + syn keyword fortran03Type asynchronous nopass non_overridable pass protected volatile abstract extends import + syn keyword fortran03Type non_intrinsic value bind deferred generic final enumerator class + syn match fortran03Type "\<associate\>" + syn match fortran03Type "\<end\s*associate" + syn match fortran03Type "\<enum\s*,\s*bind\s*(\s*c\s*)" + syn match fortran03Type "\<end\s*enum" + syn match fortran03Conditional "\<select\s*type" + syn match fortran03Conditional "\<type\s*is\>" + syn match fortran03UnitHeader "\<abstract\s*interface\>" + syn match fortran03Operator "\([\|]\)" + + " F2008 + syn keyword fortran08Intrinsic acosh asinh atanh bessel_j0 bessel_j1 bessel_jn bessel_y0 bessel_y1 bessel_yn erf erfc erfc_scaled gamma log_gamma hypot norm2 + syn keyword fortran08Intrinsic atomic_define atomic_ref execute_command_line leadz trailz storage_size merge_bits + syn keyword fortran08Intrinsic bge bgt ble blt dshiftl dshiftr findloc iall iany iparity image_index lcobound ucobound maskl maskr num_images parity popcnt poppar shifta shiftl shiftr this_image + syn keyword fortran08IO newunit + syn keyword fortran08Type contiguous +endif + syn cluster fortranCommentGroup contains=fortranTodo if (b:fortran_fixed_source == 1) @@ -324,9 +359,9 @@ syn match cInclude "^\s*#\s*include\>\s*["<]" contains=cIncluded if exists("fortran_fold") || exists("fortran_more_precise") syn sync fromstart elseif (b:fortran_fixed_source == 0) - syn sync linecont "&" minlines=20 + syn sync linecont "&" minlines=30 else - syn sync minlines=20 + syn sync minlines=30 endif if version >= 600 && exists("fortran_fold") @@ -336,15 +371,17 @@ if version >= 600 && exists("fortran_fold") syn region fortranModule transparent fold keepend start="^\s*module\s\+\(procedure\)\@!\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\(module\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranProgram syn region fortranFunction transparent fold keepend extend start="^\s*\(elemental \|pure \|recursive \)\=\s*\(\(\(real \|integer \|logical \|complex \|double \s*precision \)\s*\((\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\|type\s\+(\s*\w\+\s*) \|character \((\(\s*len\s*=\)\=\s*\d\+\s*)\|(\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\=\s*function\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\($\|function\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule syn region fortranSubroutine transparent fold keepend extend start="^\s*\(elemental \|pure \|recursive \)\=\s*subroutine\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\($\|subroutine\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule - syn region fortranBlockData transparent fold keepend start="\<block\s*data\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\($\|block\s*data\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock + syn region fortranBlockData transparent fold keepend start="\<block\s*data\(\s\+\z(\a\w*\)\)\=" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\($\|block\s*data\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock syn region fortranInterface transparent fold keepend extend start="^\s*interface\>" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*interface\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock + syn region fortranTypeDef transparent fold keepend extend start="^\s*type\s*\(,\s*\(public\|private\)\)\=\s*::" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*type\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock else syn region fortranProgram transparent fold keepend start="^\s*program\s\+\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\(program\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranModule syn region fortranModule transparent fold keepend start="^\s*module\s\+\(procedure\)\@!\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\(module\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranProgram syn region fortranFunction transparent fold keepend extend start="^\s*\(elemental \|pure \|recursive \)\=\s*\(\(\(real \|integer \|logical \|complex \|double \s*precision \)\s*\((\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\|type\s\+(\s*\w\+\s*) \|character \((\(\s*len\s*=\)\=\s*\d\+\s*)\|(\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\=\s*function\s\+\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\($\|function\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule syn region fortranSubroutine transparent fold keepend extend start="^\s*\(elemental \|pure \|recursive \)\=\s*subroutine\s\+\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\($\|subroutine\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule - syn region fortranBlockData transparent fold keepend start="\<block\s*data\s\+\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\($\|block\s*data\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock + syn region fortranBlockData transparent fold keepend start="\<block\s*data\(\s\+\z(\a\w*\)\)\=" skip="^\s*[!#].*$" excludenl end="\<end\s*\($\|block\s*data\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock syn region fortranInterface transparent fold keepend extend start="^\s*interface\>" skip="^\s*[!#].*$" excludenl end="\<end\s*interface\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock + syn region fortranTypeDef transparent fold keepend extend start="^\s*type\s*\(,\s*\(public\|private\)\)\=\s*::" skip="^\s*[!#].*$" excludenl end="\<end\s*type\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock endif if exists("fortran_fold_conditionals") @@ -390,26 +427,41 @@ if version >= 508 || !exists("did_fortran_syn_inits") " fortranMultiCommentLines HiLink fortranKeyword Keyword HiLink fortranConstructName Identifier + HiLink fortran03Conditional fortranConditional HiLink fortranConditional Conditional HiLink fortranRepeat Repeat HiLink fortranTodo Todo - HiLink fortranContinueMark Todo + if (b:fortran_fixed_source == 1) + HiLink fortranContinueMark Todo + else + HiLink fortranContinueMark Keyword + endif HiLink fortranString String HiLink fortranNumber Number + HiLink fortran03Operator fortranOperator HiLink fortranOperator Operator HiLink fortranBoolean Boolean HiLink fortranLabelError Error HiLink fortranObsolete Todo + HiLink fortran03Type fortranType + HiLink fortran08Type fortranType HiLink fortranType Type HiLink fortranStructure Type HiLink fortranStorageClass StorageClass - HiLink fortranCall fortranUnitHeader + HiLink fortranCall Function + HiLink fortran03UnitHeader fortranUnitHeader HiLink fortranUnitHeader fortranPreCondit + HiLink fortran03ReadWrite fortranReadWrite HiLink fortranReadWrite Keyword + HiLink fortran03IO fortranIO + HiLink fortran08IO fortranIO HiLink fortranIO Keyword HiLink fortran95Intrinsic fortran90Intrinsic HiLink fortran77Intrinsic fortran90Intrinsic HiLink fortran90Intrinsic Function + HiLink fortran03Intrinsic Function + HiLink fortran08Intrinsic Function + HiLink fortran03Constant Function if ( b:fortran_dialect == "elf" || b:fortran_dialect == "F" ) HiLink fortranKeywordOb fortranObsolete diff --git a/src/Makefile b/src/Makefile index 5d858bdb4..59aca22da 100644 --- a/src/Makefile +++ b/src/Makefile @@ -384,8 +384,10 @@ CClink = $(CC) #CONF_OPT_PLTHOME = --with-plthome=/home/me/mz # PERL -# Uncomment this when you want to include the Perl interface. +# Uncomment one of these when you want to include the Perl interface. +# First one is for static linking, second one for dynamic loading. # The Perl option sometimes causes problems, because it adds extra flags +# # to the command line. If you see strange flags during compilation, check in # auto/config.mk where they come from. If it's PERL_CFLAGS, try commenting # the next line. @@ -393,6 +395,7 @@ CClink = $(CC) # one: "touch perl.exp". # This requires at least "small" features, "tiny" doesn't work. #CONF_OPT_PERL = --enable-perlinterp +#CONF_OPT_PERL = --enable-perlinterp=dynamic # PYTHON # Uncomment this when you want to include the Python interface. @@ -1311,7 +1314,7 @@ SHELL = /bin/sh .SUFFIXES: .c .o .pro PRE_DEFS = -Iproto $(DEFS) $(GUI_DEFS) $(GUI_IPATH) $(CPPFLAGS) $(EXTRA_IPATHS) -POST_DEFS = $(X_CFLAGS) $(LUA_CFLAGS) $(MZSCHEME_CFLAGS) $(PERL_CFLAGS) $(ECL_CFLAGS) $(TCL_CFLAGS) $(RUBY_CFLAGS) $(EXTRA_DEFS) +POST_DEFS = $(X_CFLAGS) $(LUA_CFLAGS) $(MZSCHEME_CFLAGS) $(TCL_CFLAGS) $(RUBY_CFLAGS) $(EXTRA_DEFS) ALL_CFLAGS = $(PRE_DEFS) $(CFLAGS) $(PROFILE_CFLAGS) $(POST_DEFS) @@ -2494,10 +2497,10 @@ 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 + $(CCC) $(PERL_CFLAGS) -o $@ auto/if_perl.c objects/if_perlsfio.o: if_perlsfio.c - $(CCC) -o $@ if_perlsfio.c + $(CCC) $(PERL_CFLAGS) -o $@ if_perlsfio.c objects/py_config.o: $(PYTHON_CONFDIR)/config.c $(CCC) $(PYTHON_CFLAGS) -o $@ $(PYTHON_CONFDIR)/config.c \ diff --git a/src/auto/configure b/src/auto/configure index 9d7a7191c..12ec72124 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -1423,7 +1423,7 @@ Optional Features: --disable-xsmp-interact Disable XSMP interaction --enable-luainterp Include Lua interpreter. --enable-mzschemeinterp Include MzScheme interpreter. - --enable-perlinterp Include Perl interpreter. + --enable-perlinterp=OPTS Include Perl interpreter. default=no OPTS=no/yes/dynamic --enable-pythoninterp Include Python interpreter. --enable-python3interp Include Python3 interpreter. --enable-tclinterp Include Tcl interpreter. @@ -4241,7 +4241,7 @@ if test "${with_local_dir+set}" = set; then : */*) ;; no) # avoid adding local dir to LDFLAGS and CPPFLAGS - have_local_dir=yes + have_local_include=yes have_local_lib=yes ;; *) as_fn_error "must pass path argument to --with-local-dir" "$LINENO" 5 ;; @@ -4924,7 +4924,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_perlinterp" >&5 $as_echo "$enable_perlinterp" >&6; } -if test "$enable_perlinterp" = "yes"; then +if test "$enable_perlinterp" = "yes" -o "$enable_perlinterp" = "dynamic"; then # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 @@ -4971,6 +4971,7 @@ fi $as_echo_n "checking Perl version... " >&6; } if $vi_cv_path_perl -e 'require 5.003_01' >/dev/null 2>/dev/null; then eval `$vi_cv_path_perl -V:usethreads` + eval `$vi_cv_path_perl -V:libperl` if test "X$usethreads" = "XUNKNOWN" -o "X$usethreads" = "Xundef"; then badthreads=no else @@ -5077,6 +5078,13 @@ $as_echo ">>> too old; need Perl version 5.003_01 or later <<<" >&6; } PERL_LIBS="-L$darwindir/CORE -lperl" fi fi + if test "$enable_perlinterp" = "dynamic"; then + if test "$perl_ok" = "yes" -a "X$libperl" != "X"; then + $as_echo "#define DYNAMIC_PERL 1" >>confdefs.h + + PERL_CFLAGS="-DDYNAMIC_PERL_DLL=\\\"$libperl\\\" $PERL_CFLAGS" + fi + fi fi diff --git a/src/config.h.in b/src/config.h.in index 5570f2baf..3e86b847c 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -325,6 +325,9 @@ /* Define if you want to include the Perl interpreter. */ #undef FEAT_PERL +/* Define for linking via dlopen() or LoadLibrary() */ +#undef DYNAMIC_PERL + /* Define if you want to include the Python interpreter. */ #undef FEAT_PYTHON diff --git a/src/configure.in b/src/configure.in index 112f8a627..b10d5c9da 100644 --- a/src/configure.in +++ b/src/configure.in @@ -213,7 +213,7 @@ if test "$cross_compiling" = no; then */*) ;; no) # avoid adding local dir to LDFLAGS and CPPFLAGS - have_local_dir=yes + have_local_include=yes have_local_lib=yes ;; *) AC_MSG_ERROR(must pass path argument to --with-local-dir) ;; @@ -620,16 +620,17 @@ fi AC_MSG_CHECKING(--enable-perlinterp argument) AC_ARG_ENABLE(perlinterp, - [ --enable-perlinterp Include Perl interpreter.], , + [ --enable-perlinterp[=OPTS] Include Perl interpreter. [default=no] [OPTS=no/yes/dynamic]], , [enable_perlinterp="no"]) AC_MSG_RESULT($enable_perlinterp) -if test "$enable_perlinterp" = "yes"; then +if test "$enable_perlinterp" = "yes" -o "$enable_perlinterp" = "dynamic"; then AC_SUBST(vi_cv_path_perl) AC_PATH_PROG(vi_cv_path_perl, perl) if test "X$vi_cv_path_perl" != "X"; then AC_MSG_CHECKING(Perl version) if $vi_cv_path_perl -e 'require 5.003_01' >/dev/null 2>/dev/null; then eval `$vi_cv_path_perl -V:usethreads` + eval `$vi_cv_path_perl -V:libperl` if test "X$usethreads" = "XUNKNOWN" -o "X$usethreads" = "Xundef"; then badthreads=no else @@ -722,6 +723,12 @@ if test "$enable_perlinterp" = "yes"; then PERL_LIBS="-L$darwindir/CORE -lperl" fi fi + if test "$enable_perlinterp" = "dynamic"; then + if test "$perl_ok" = "yes" -a "X$libperl" != "X"; then + AC_DEFINE(DYNAMIC_PERL) + PERL_CFLAGS="-DDYNAMIC_PERL_DLL=\\\"$libperl\\\" $PERL_CFLAGS" + fi + fi fi AC_SUBST(shrpenv) AC_SUBST(PERL_SRC) diff --git a/src/if_perl.xs b/src/if_perl.xs index 1a83de45d..636e704c3 100644 --- a/src/if_perl.xs +++ b/src/if_perl.xs @@ -84,9 +84,32 @@ static void VIM_init __ARGS((void)); EXTERN_C void boot_DynaLoader __ARGS((pTHX_ CV*)); /* - * For dynamic linked perl. (Windows) + * For dynamic linked perl. */ #if defined(DYNAMIC_PERL) || defined(PROTO) + +#ifndef DYNAMIC_PERL /* just generating prototypes */ +#ifdef _MSWIN +typedef int HANDLE; +#endif +typedef int XSINIT_t; +typedef int XSUBADDR_t; +typedef int perl_key; +#endif + +#ifndef _MSWIN +#include <dlfcn.h> +#define HANDLE void* +#define PERL_PROC void* +#define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL) +#define symbol_from_dll dlsym +#define close_dll dlclose +#else +#define PERL_PROC FARPROC +#define load_dll LoadLibrary +#define symbol_from_dll GetProcAddress +#define close_dll FreeLibrary +#endif /* * Wrapper defines */ @@ -173,6 +196,7 @@ EXTERN_C void boot_DynaLoader __ARGS((pTHX_ CV*)); # define Perl_Ierrgv_ptr dll_Perl_Ierrgv_ptr # define Perl_Isv_yes_ptr dll_Perl_Isv_yes_ptr # define boot_DynaLoader dll_boot_DynaLoader +# define Perl_Gthr_key_ptr dll_Perl_Gthr_key_ptr # define Perl_sys_init dll_Perl_sys_init # define Perl_sys_term dll_Perl_sys_term @@ -191,12 +215,6 @@ EXTERN_C void boot_DynaLoader __ARGS((pTHX_ CV*)); # define Perl_Iscopestack_ix_ptr dll_Perl_Iscopestack_ix_ptr # define Perl_Iunitcheckav_ptr dll_Perl_Iunitcheckav_ptr -#ifndef DYNAMIC_PERL /* just generating prototypes */ -typedef int HANDLE; -typedef int XSINIT_t; -typedef int XSUBADDR_t; -#endif - /* * Declare HANDLE for perl.dll and function pointers. */ @@ -265,6 +283,7 @@ static void (*Perl_sv_setsv_flags)(pTHX_ SV*, SV*, I32); static void (*Perl_sv_setsv)(pTHX_ SV*, SV*); #endif static bool (*Perl_sv_upgrade)(pTHX_ SV*, U32); +#if (PERL_REVISION == 5) && (PERL_VERSION < 10) static SV*** (*Perl_Tstack_sp_ptr)(register PerlInterpreter*); static OP** (*Perl_Top_ptr)(register PerlInterpreter*); static SV*** (*Perl_Tstack_base_ptr)(register PerlInterpreter*); @@ -276,12 +295,7 @@ static I32** (*Perl_Tmarkstack_max_ptr)(register PerlInterpreter*); static SV** (*Perl_TSv_ptr)(register PerlInterpreter*); static XPV** (*Perl_TXpv_ptr)(register PerlInterpreter*); static STRLEN* (*Perl_Tna_ptr)(register PerlInterpreter*); -static GV** (*Perl_Idefgv_ptr)(register PerlInterpreter*); -static GV** (*Perl_Ierrgv_ptr)(register PerlInterpreter*); -static SV* (*Perl_Isv_yes_ptr)(register PerlInterpreter*); -static void (*boot_DynaLoader)_((pTHX_ CV*)); - -#if (PERL_REVISION == 5) && (PERL_VERSION >= 10) +#else static void (*Perl_sv_free2)(pTHX_ SV*); static void (*Perl_sys_init)(int* argc, char*** argv); static void (*Perl_sys_term)(void); @@ -301,10 +315,15 @@ static I32* (*Perl_Iscopestack_ix_ptr)(register PerlInterpreter*); static AV** (*Perl_Iunitcheckav_ptr)(register PerlInterpreter*); #endif +static GV** (*Perl_Idefgv_ptr)(register PerlInterpreter*); +static GV** (*Perl_Ierrgv_ptr)(register PerlInterpreter*); +static SV* (*Perl_Isv_yes_ptr)(register PerlInterpreter*); +static void (*boot_DynaLoader)_((pTHX_ CV*)); +static perl_key* (*Perl_Gthr_key_ptr)_((pTHX)); + /* * Table of name to function pointer of perl. */ -#define PERL_PROC FARPROC static struct { char* name; PERL_PROC* ptr; @@ -389,17 +408,16 @@ static struct { {"Perl_sys_init", (PERL_PROC*)&Perl_sys_init}, {"Perl_sys_term", (PERL_PROC*)&Perl_sys_term}, {"Perl_ISv_ptr", (PERL_PROC*)&Perl_ISv_ptr}, - {"Perl_Istack_sp_ptr", (PERL_PROC*)&Perl_Istack_sp_ptr}, - {"Perl_Iop_ptr", (PERL_PROC*)&Perl_Iop_ptr}, - {"Perl_Istack_base_ptr", (PERL_PROC*)&Perl_Istack_base_ptr}, {"Perl_Istack_max_ptr", (PERL_PROC*)&Perl_Istack_max_ptr}, + {"Perl_Istack_base_ptr", (PERL_PROC*)&Perl_Istack_base_ptr}, + {"Perl_IXpv_ptr", (PERL_PROC*)&Perl_IXpv_ptr}, {"Perl_Itmps_ix_ptr", (PERL_PROC*)&Perl_Itmps_ix_ptr}, {"Perl_Itmps_floor_ptr", (PERL_PROC*)&Perl_Itmps_floor_ptr}, + {"Perl_Ina_ptr", (PERL_PROC*)&Perl_Ina_ptr}, {"Perl_Imarkstack_ptr_ptr", (PERL_PROC*)&Perl_Imarkstack_ptr_ptr}, {"Perl_Imarkstack_max_ptr", (PERL_PROC*)&Perl_Imarkstack_max_ptr}, - {"Perl_ISv_ptr", (PERL_PROC*)&Perl_ISv_ptr}, - {"Perl_IXpv_ptr", (PERL_PROC*)&Perl_IXpv_ptr}, - {"Perl_Ina_ptr", (PERL_PROC*)&Perl_Ina_ptr}, + {"Perl_Istack_sp_ptr", (PERL_PROC*)&Perl_Istack_sp_ptr}, + {"Perl_Iop_ptr", (PERL_PROC*)&Perl_Iop_ptr}, {"Perl_call_list", (PERL_PROC*)&Perl_call_list}, {"Perl_Iscopestack_ix_ptr", (PERL_PROC*)&Perl_Iscopestack_ix_ptr}, {"Perl_Iunitcheckav_ptr", (PERL_PROC*)&Perl_Iunitcheckav_ptr}, @@ -408,6 +426,7 @@ static struct { {"Perl_Ierrgv_ptr", (PERL_PROC*)&Perl_Ierrgv_ptr}, {"Perl_Isv_yes_ptr", (PERL_PROC*)&Perl_Isv_yes_ptr}, {"boot_DynaLoader", (PERL_PROC*)&boot_DynaLoader}, + {"Perl_Gthr_key_ptr", (PERL_PROC*)&Perl_Gthr_key_ptr}, {"", NULL}, }; @@ -428,7 +447,7 @@ perl_runtime_link_init(char *libname, int verbose) if (hPerlLib != NULL) return OK; - if (!(hPerlLib = LoadLibraryEx(libname, NULL, 0))) + if ((hPerlLib = load_dll(libname)) == NULL) { if (verbose) EMSG2(_("E370: Could not load library %s"), libname); @@ -436,10 +455,10 @@ perl_runtime_link_init(char *libname, int verbose) } for (i = 0; perl_funcname_table[i].ptr; ++i) { - if (!(*perl_funcname_table[i].ptr = GetProcAddress(hPerlLib, + if (!(*perl_funcname_table[i].ptr = symbol_from_dll(hPerlLib, perl_funcname_table[i].name))) { - FreeLibrary(hPerlLib); + close_dll(hPerlLib); hPerlLib = NULL; if (verbose) EMSG2(_(e_loadfunc), perl_funcname_table[i].name); @@ -508,7 +527,7 @@ perl_end() #ifdef DYNAMIC_PERL if (hPerlLib) { - FreeLibrary(hPerlLib); + close_dll(hPerlLib); hPerlLib = NULL; } #endif diff --git a/src/link.sh b/src/link.sh index 6e161684c..3d90f3cac 100755 --- a/src/link.sh +++ b/src/link.sh @@ -41,7 +41,7 @@ else if sh link.cmd; then touch auto/link.sed cp link.cmd linkit.sh - for libname in SM ICE nsl dnet dnet_stub inet socket dir elf iconv Xt Xmu Xp Xpm X11 Xdmcp x w dl pthread thread readline m perl crypt attr; do + for libname in SM ICE nsl dnet dnet_stub inet socket dir elf iconv Xt Xmu Xp Xpm X11 Xdmcp x w perl dl pthread thread readline m crypt attr; do cont=yes while test -n "$cont"; do if grep "l$libname " linkit.sh >/dev/null; then |