From b01f357791f88c7083e58cf2b36509dd83f21ea2 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 15 Jan 2016 15:17:04 +0100 Subject: [PATCH 01/18] patch 7.4.1091 Problem: When making a change while need_wait_return is set there is a two second delay. Solution: Do not assume the ATTENTION prompt was given when need_wait_return was set already. --- src/misc1.c | 5 +++++ src/version.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/misc1.c b/src/misc1.c index d1e762c9a7..4f36fd80d1 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -2778,6 +2778,9 @@ changed() #endif ) { + int save_need_wait_return = need_wait_return; + + need_wait_return = FALSE; ml_open_file(curbuf); /* The ml_open_file() can cause an ATTENTION message. @@ -2791,6 +2794,8 @@ changed() wait_return(TRUE); msg_scroll = save_msg_scroll; } + else + need_wait_return = save_need_wait_return; } changed_int(); } diff --git a/src/version.c b/src/version.c index 80a0693b2f..3c196ad12f 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1091, /**/ 1090, /**/ From a803c7f94070f94b831fdfd1984f288c8b825b5d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 15 Jan 2016 15:31:39 +0100 Subject: [PATCH 02/18] patch 7.4.1092 Problem: It is not simple to test for an exception and give a proper error message. Solution: Add assert_exception(). --- runtime/doc/eval.txt | 32 +++++++++++++++++++++++--------- src/eval.c | 31 +++++++++++++++++++++++++++++++ src/version.c | 2 ++ 3 files changed, 56 insertions(+), 9 deletions(-) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 4746527388..906a8691e2 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1750,9 +1750,10 @@ arglistid( [{winnr} [, {tabnr}]]) Number argument list id argv( {nr}) String {nr} entry of the argument list argv( ) List the argument list -assert_equal( {exp}, {act} [, {msg}]) none assert that {exp} equals {act} -assert_false( {actual} [, {msg}]) none assert that {actual} is false -assert_true( {actual} [, {msg}]) none assert that {actual} is true +assert_equal( {exp}, {act} [, {msg}]) none assert {exp} equals {act} +assert_exception({error} [, {msg}]) none assert {error} is in v:exception +assert_false( {actual} [, {msg}]) none assert {actual} is false +assert_true( {actual} [, {msg}]) none assert {actual} is true asin( {expr}) Float arc sine of {expr} atan( {expr}) Float arc tangent of {expr} atan2( {expr}, {expr}) Float arc tangent of {expr1} / {expr2} @@ -2179,7 +2180,7 @@ argv([{nr}]) The result is the {nr}th file in the argument list of the returned. *assert_equal()* -assert_equal({expected}, {actual}, [, {msg}]) +assert_equal({expected}, {actual} [, {msg}]) When {expected} and {actual} are not equal an error message is added to |v:errors|. There is no automatic conversion, the String "4" is different @@ -2193,18 +2194,31 @@ assert_equal({expected}, {actual}, [, {msg}]) < Will result in a string to be added to |v:errors|: test.vim line 12: Expected 'foo' but got 'bar' ~ -assert_false({actual}, [, {msg}]) *assert_false()* +assert_exception({error} [, {msg}]) *assert_exception()* + When v:exception does not contain the string {error} an error + message is added to |v:errors|. + This can be used to assert that a command throws an exception. + Using the error number, followed by a colon, avoids problems + with translations: > + try + commandthatfails + call assert_false(1, 'command should have failed') + catch + call assert_exception('E492:') + endtry + +assert_false({actual} [, {msg}]) *assert_false()* When {actual} is not false an error message is added to - |v:errors|, like with |assert_equal()|.. + |v:errors|, like with |assert_equal()|. A value is false when it is zero. When "{actual}" is not a number the assert fails. When {msg} is omitted an error in the form "Expected False but got {actual}" is produced. -assert_true({actual}, [, {msg}]) *assert_true()* +assert_true({actual} [, {msg}]) *assert_true()* When {actual} is not true an error message is added to - |v:errors|, like with |assert_equal()|.. - A value is true when it is a non-zeron number. When {actual} + |v:errors|, like with |assert_equal()|. + A value is true when it is a non-zero number. When {actual} is not a number the assert fails. When {msg} is omitted an error in the form "Expected True but got {actual}" is produced. diff --git a/src/eval.c b/src/eval.c index dd19492286..34f2bde852 100644 --- a/src/eval.c +++ b/src/eval.c @@ -475,6 +475,7 @@ static void f_argidx __ARGS((typval_T *argvars, typval_T *rettv)); static void f_arglistid __ARGS((typval_T *argvars, typval_T *rettv)); static void f_argv __ARGS((typval_T *argvars, typval_T *rettv)); static void f_assert_equal __ARGS((typval_T *argvars, typval_T *rettv)); +static void f_assert_exception __ARGS((typval_T *argvars, typval_T *rettv)); static void f_assert_false __ARGS((typval_T *argvars, typval_T *rettv)); static void f_assert_true __ARGS((typval_T *argvars, typval_T *rettv)); #ifdef FEAT_FLOAT @@ -8088,6 +8089,7 @@ static struct fst {"asin", 1, 1, f_asin}, /* WJMc */ #endif {"assert_equal", 2, 3, f_assert_equal}, + {"assert_exception", 1, 2, f_assert_exception}, {"assert_false", 1, 2, f_assert_false}, {"assert_true", 1, 2, f_assert_true}, #ifdef FEAT_FLOAT @@ -9269,6 +9271,35 @@ f_assert_equal(argvars, rettv) } } +/* + * "assert_exception(string[, msg])" function + */ + static void +f_assert_exception(argvars, rettv) + typval_T *argvars; + typval_T *rettv UNUSED; +{ + garray_T ga; + char *error; + + error = (char *)get_tv_string_chk(&argvars[0]); + if (vimvars[VV_EXCEPTION].vv_str == NULL) + { + prepare_assert_error(&ga); + ga_concat(&ga, (char_u *)"v:exception is not set"); + assert_error(&ga); + ga_clear(&ga); + } + else if (strstr((char *)vimvars[VV_EXCEPTION].vv_str, error) == NULL) + { + prepare_assert_error(&ga); + fill_assert_error(&ga, &argvars[1], NULL, &argvars[0], + &vimvars[VV_EXCEPTION].vv_tv); + assert_error(&ga); + ga_clear(&ga); + } +} + /* * Common for assert_true() and assert_false(). */ diff --git a/src/version.c b/src/version.c index 3c196ad12f..599de704ca 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1092, /**/ 1091, /**/ From 24c4d539eed33e8073f8f9fe2bee497bbba935a4 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 15 Jan 2016 15:37:20 +0100 Subject: [PATCH 03/18] patch 7.4.1093 Problem: Typo in test goes unnoticed. Solution: Fix the typo. Give error for wrong arguments to cursor(). (partly by Hirohito Higashi) Add a test for cursor(). --- src/eval.c | 6 +++++- src/testdir/test_alot.vim | 1 + src/testdir/test_searchpos.vim | 4 ++-- src/version.c | 2 ++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/eval.c b/src/eval.c index 34f2bde852..5eddf2368e 100644 --- a/src/eval.c +++ b/src/eval.c @@ -10243,7 +10243,8 @@ f_cscope_connection(argvars, rettv) } /* - * "cursor(lnum, col)" function + * "cursor(lnum, col)" function, or + * "cursor(list)" * * Moves the cursor to the specified line and column. * Returns 0 when the position could be set, -1 otherwise. @@ -10266,7 +10267,10 @@ f_cursor(argvars, rettv) colnr_T curswant = -1; if (list2fpos(argvars, &pos, NULL, &curswant) == FAIL) + { + EMSG(_(e_invarg)); return; + } line = pos.lnum; col = pos.col; #ifdef FEAT_VIRTUALEDIT diff --git a/src/testdir/test_alot.vim b/src/testdir/test_alot.vim index 413e71b543..87bd26b458 100644 --- a/src/testdir/test_alot.vim +++ b/src/testdir/test_alot.vim @@ -2,6 +2,7 @@ " This makes testing go faster, since Vim doesn't need to restart. source test_backspace_opt.vim +source test_cursor_func.vim source test_lispwords.vim source test_menu.vim source test_searchpos.vim diff --git a/src/testdir/test_searchpos.vim b/src/testdir/test_searchpos.vim index 4a1e024ce7..8dffddc094 100644 --- a/src/testdir/test_searchpos.vim +++ b/src/testdir/test_searchpos.vim @@ -15,10 +15,10 @@ func Test_searchpos() call assert_equal([1, 3, 1], searchpos('\%(\([a-z]\)\|\_.\)\{-}xyz', 'pcW')) " Now with \zs, first match is in column 0, "a" is matched. - call cursor(1. 3) + call cursor(1, 3) call assert_equal([2, 4, 2], searchpos('\%(\([a-z]\)\|\_.\)\{-}\zsxyz', 'pcW')) " With z flag start at cursor column, don't see the "a". - call cursor(1. 3) + call cursor(1, 3) call assert_equal([2, 4, 1], searchpos('\%(\([a-z]\)\|\_.\)\{-}\zsxyz', 'pcWz')) set cpo+=c diff --git a/src/version.c b/src/version.c index 599de704ca..2567cb5819 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1093, /**/ 1092, /**/ From ccb80989f2779c8441f7f15d160fb2141bd1676d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 15 Jan 2016 15:56:35 +0100 Subject: [PATCH 04/18] patch 7.4.1094 Problem: Test for :hardcopy fails on MS-Windows. Solution: Check for the +postscript feature. --- src/testdir/test_hardcopy.vim | 18 ++++++++++-------- src/version.c | 2 ++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/testdir/test_hardcopy.vim b/src/testdir/test_hardcopy.vim index c2145c13fc..4629d17dd2 100644 --- a/src/testdir/test_hardcopy.vim +++ b/src/testdir/test_hardcopy.vim @@ -45,12 +45,14 @@ endfunc " Test that :hardcopy produces a non-empty file. " We don't check much of the contents. func Test_with_syntax() - set printoptions=syntax:y - syn on - hardcopy > Xhardcopy - let lines = readfile('Xhardcopy') - call assert_true(len(lines) > 20) - call assert_true(lines[0] =~ 'PS-Adobe') - call delete('Xhardcopy') - set printoptions& + if has('postscript') + set printoptions=syntax:y + syn on + hardcopy > Xhardcopy + let lines = readfile('Xhardcopy') + call assert_true(len(lines) > 20) + call assert_true(lines[0] =~ 'PS-Adobe') + call delete('Xhardcopy') + set printoptions& + endif endfunc diff --git a/src/version.c b/src/version.c index 2567cb5819..e0d94fda3f 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1094, /**/ 1093, /**/ From 5a46a58eb6e50cb5204909cc2202e3400761263f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 15 Jan 2016 15:56:58 +0100 Subject: [PATCH 05/18] Add missing test file. --- src/testdir/test_cursor_func.vim | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/testdir/test_cursor_func.vim diff --git a/src/testdir/test_cursor_func.vim b/src/testdir/test_cursor_func.vim new file mode 100644 index 0000000000..684391e2a5 --- /dev/null +++ b/src/testdir/test_cursor_func.vim @@ -0,0 +1,35 @@ +" Tests for cursor(). + +func Test_wrong_arguments() + try + call cursor(1. 3) + " not reached + call assert_false(1) + catch + call assert_exception('E474:') + endtry +endfunc + +func Test_move_cursor() + new + call setline(1, ['aaa', 'bbb', 'ccc', 'ddd']) + + call cursor([1, 1, 0, 1]) + call assert_equal([1, 1, 0, 1], getcurpos()[1:]) + call cursor([4, 3, 0, 3]) + call assert_equal([4, 3, 0, 3], getcurpos()[1:]) + + call cursor(2, 2) + call assert_equal([2, 2, 0, 3], getcurpos()[1:]) + " line number zero keeps the line number + call cursor(0, 1) + call assert_equal([2, 1, 0, 3], getcurpos()[1:]) + " col number zero keeps the column + call cursor(3, 0) + call assert_equal([3, 1, 0, 3], getcurpos()[1:]) + " below last line goes to last line + call cursor(9, 1) + call assert_equal([4, 1, 0, 3], getcurpos()[1:]) + + quit! +endfunc From 3d6d5cc3a417c04d9772596ea83f8e6b41321781 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 15 Jan 2016 18:03:32 +0100 Subject: [PATCH 06/18] patch 7.4.1095 Problem: Can't build GvimExt with SDK 7.1. Solution: Support using setenv.bat instead of vcvars32.bat. (Ken Takata) --- src/GvimExt/Makefile | 3 +++ src/Make_mvc.mak | 3 +++ src/version.c | 2 ++ 3 files changed, 8 insertions(+) diff --git a/src/GvimExt/Makefile b/src/GvimExt/Makefile index b451981448..a57840fa1f 100644 --- a/src/GvimExt/Makefile +++ b/src/GvimExt/Makefile @@ -16,6 +16,9 @@ NODEBUG = 1 # On Windows NT ! ifndef CPU CPU = i386 +! if !defined(PLATFORM) && defined(TARGET_CPU) +PLATFORM = $(TARGET_CPU) +! endif ! ifdef PLATFORM ! if ("$(PLATFORM)" == "x64") || ("$(PLATFORM)" == "X64") CPU = AMD64 diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index f51fbfcde4..6f0b84391c 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -216,6 +216,9 @@ CPU = i386 ! endif ! else # !CPU CPU = i386 +! if !defined(PLATFORM) && defined(TARGET_CPU) +PLATFORM = $(TARGET_CPU) +! endif ! ifdef PLATFORM ! if ("$(PLATFORM)" == "x64") || ("$(PLATFORM)" == "X64") CPU = AMD64 diff --git a/src/version.c b/src/version.c index e0d94fda3f..2c92c175fc 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1095, /**/ 1094, /**/ From a260b87d9da17f605666630f18c1ed909c2b8bae Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 15 Jan 2016 20:48:22 +0100 Subject: [PATCH 07/18] patch 7.4.1096 Problem: Need several lines to verify a command produces an error. Solution: Add assert_fails(). (suggested by Nikolay Pavlov) Make the quickfix alloc test actually work. --- runtime/doc/eval.txt | 6 +++++ src/alloc.h | 1 + src/eval.c | 50 +++++++++++++++++++++++++++++++++++ src/misc2.c | 10 ++++--- src/testdir/test_quickfix.vim | 30 ++++----------------- src/version.c | 2 ++ 6 files changed, 71 insertions(+), 28 deletions(-) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 906a8691e2..8340bf2fee 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1752,6 +1752,7 @@ argv( {nr}) String {nr} entry of the argument list argv( ) List the argument list assert_equal( {exp}, {act} [, {msg}]) none assert {exp} equals {act} assert_exception({error} [, {msg}]) none assert {error} is in v:exception +assert_fails( {cmd} [, {error}]) none assert {cmd} fails assert_false( {actual} [, {msg}]) none assert {actual} is false assert_true( {actual} [, {msg}]) none assert {actual} is true asin( {expr}) Float arc sine of {expr} @@ -2207,6 +2208,11 @@ assert_exception({error} [, {msg}]) *assert_exception()* call assert_exception('E492:') endtry +assert_fails({cmd} [, {error}]) *assert_fails()* + Run {cmd} and add an error message to |v:errors| if it does + NOT produce an error. + When {error} is given it must match |v:errmsg|. + assert_false({actual} [, {msg}]) *assert_false()* When {actual} is not false an error message is added to |v:errors|, like with |assert_equal()|. diff --git a/src/alloc.h b/src/alloc.h index c237ef348c..7a992c689f 100644 --- a/src/alloc.h +++ b/src/alloc.h @@ -17,4 +17,5 @@ typedef enum { aid_qf_namebuf, aid_qf_errmsg, aid_qf_pattern, + aid_last, } alloc_id_T; diff --git a/src/eval.c b/src/eval.c index 5eddf2368e..ac1058cf0c 100644 --- a/src/eval.c +++ b/src/eval.c @@ -476,6 +476,7 @@ static void f_arglistid __ARGS((typval_T *argvars, typval_T *rettv)); static void f_argv __ARGS((typval_T *argvars, typval_T *rettv)); static void f_assert_equal __ARGS((typval_T *argvars, typval_T *rettv)); static void f_assert_exception __ARGS((typval_T *argvars, typval_T *rettv)); +static void f_assert_fails __ARGS((typval_T *argvars, typval_T *rettv)); static void f_assert_false __ARGS((typval_T *argvars, typval_T *rettv)); static void f_assert_true __ARGS((typval_T *argvars, typval_T *rettv)); #ifdef FEAT_FLOAT @@ -8090,6 +8091,7 @@ static struct fst #endif {"assert_equal", 2, 3, f_assert_equal}, {"assert_exception", 1, 2, f_assert_exception}, + {"assert_fails", 1, 2, f_assert_fails}, {"assert_false", 1, 2, f_assert_false}, {"assert_true", 1, 2, f_assert_true}, #ifdef FEAT_FLOAT @@ -9009,8 +9011,11 @@ f_alloc_fail(argvars, rettv) else { alloc_fail_id = argvars[0].vval.v_number; + if (alloc_fail_id >= aid_last) + EMSG(_(e_invarg)); alloc_fail_countdown = argvars[1].vval.v_number; alloc_fail_repeat = argvars[2].vval.v_number; + did_outofmem_msg = FALSE; } } @@ -9300,6 +9305,51 @@ f_assert_exception(argvars, rettv) } } +/* + * "assert_fails(cmd [, error])" function + */ + static void +f_assert_fails(argvars, rettv) + typval_T *argvars; + typval_T *rettv UNUSED; +{ + char_u *cmd = get_tv_string_chk(&argvars[0]); + garray_T ga; + + called_emsg = FALSE; + suppress_errthrow = TRUE; + emsg_silent = TRUE; + do_cmdline_cmd(cmd); + if (!called_emsg) + { + prepare_assert_error(&ga); + ga_concat(&ga, (char_u *)"command did not fail: "); + ga_concat(&ga, cmd); + assert_error(&ga); + ga_clear(&ga); + } + else if (argvars[1].v_type != VAR_UNKNOWN) + { + char_u buf[NUMBUFLEN]; + char *error = (char *)get_tv_string_buf_chk(&argvars[1], buf); + + if (strstr((char *)vimvars[VV_ERRMSG].vv_str, error) == NULL) + { + prepare_assert_error(&ga); + fill_assert_error(&ga, &argvars[2], NULL, &argvars[1], + &vimvars[VV_ERRMSG].vv_tv); + assert_error(&ga); + ga_clear(&ga); + } + } + + called_emsg = FALSE; + suppress_errthrow = FALSE; + emsg_silent = FALSE; + emsg_on_display = FALSE; + set_vim_var_string(VV_ERRMSG, NULL, 0); +} + /* * Common for assert_true() and assert_false(). */ diff --git a/src/misc2.c b/src/misc2.c index 8540212554..0ee57fc4a6 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -798,13 +798,17 @@ vim_mem_profile_dump() #endif /* MEM_PROFILE */ #ifdef FEAT_EVAL +static int alloc_does_fail __ARGS((long_u size)); + static int -alloc_does_fail() +alloc_does_fail(size) + long_u size; { if (alloc_fail_countdown == 0) { if (--alloc_fail_repeat <= 0) alloc_fail_id = 0; + do_outofmem_msg(size); return TRUE; } --alloc_fail_countdown; @@ -844,7 +848,7 @@ alloc_id(size, id) alloc_id_T id UNUSED; { #ifdef FEAT_EVAL - if (alloc_fail_id == id && alloc_does_fail()) + if (alloc_fail_id == id && alloc_does_fail((long_u)size)) return NULL; #endif return (lalloc((long_u)size, TRUE)); @@ -1008,7 +1012,7 @@ lalloc_id(size, message, id) alloc_id_T id UNUSED; { #ifdef FEAT_EVAL - if (alloc_fail_id == id && alloc_does_fail()) + if (alloc_fail_id == id && alloc_does_fail(size)) return NULL; #endif return (lalloc((long_u)size, message)); diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim index b9f3f7bbbe..b2fc9683a0 100644 --- a/src/testdir/test_quickfix.vim +++ b/src/testdir/test_quickfix.vim @@ -279,39 +279,19 @@ endfunction function Test_nomem() call alloc_fail(GetAllocId('qf_dirname_start'), 0, 0) - try - vimgrep vim runtest.vim - catch - call assert_true(v:exception =~ 'E342') - endtry + call assert_fails('vimgrep vim runtest.vim', 'E342:') call alloc_fail(GetAllocId('qf_dirname_now'), 0, 0) - try - vimgrep vim runtest.vim - catch - call assert_true(v:exception =~ 'E342') - endtry + call assert_fails('vimgrep vim runtest.vim', 'E342:') call alloc_fail(GetAllocId('qf_namebuf'), 0, 0) - try - cfile runtest.vim - catch - call assert_true(v:exception =~ 'E342') - endtry + call assert_fails('cfile runtest.vim', 'E342:') call alloc_fail(GetAllocId('qf_errmsg'), 0, 0) - try - cfile runtest.vim - catch - call assert_true(v:exception =~ 'E342') - endtry + call assert_fails('cfile runtest.vim', 'E342:') call alloc_fail(GetAllocId('qf_pattern'), 0, 0) - try - cfile runtest.vim - catch - call assert_true(v:exception =~ 'E342') - endtry + call assert_fails('cfile runtest.vim', 'E342:') endfunc diff --git a/src/version.c b/src/version.c index 2c92c175fc..b842116808 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1096, /**/ 1095, /**/ From 065ee9aebf9abe08ae8c0dba7d05cbdcc423c8e0 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 15 Jan 2016 20:53:38 +0100 Subject: [PATCH 08/18] patch 7.4.1097 Problem: Looking up the alloc ID for tests fails. Solution: Fix the line computation. Use assert_fails() for unlet test. --- src/testdir/runtest.vim | 8 +++++--- src/testdir/test_unlet.vim | 21 ++++----------------- src/version.c | 2 ++ 3 files changed, 11 insertions(+), 20 deletions(-) diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim index 72b21d5ae8..fd64c98fc3 100644 --- a/src/testdir/runtest.vim +++ b/src/testdir/runtest.vim @@ -48,14 +48,16 @@ let s:srcdir = expand('%:p:h:h') " Support function: get the alloc ID by name. function GetAllocId(name) exe 'split ' . s:srcdir . '/alloc.h' - /typedef enum/ - let top = getline('.') + let top = search('typedef enum') + if top == 0 + call add(v:errors, 'typedef not found in alloc.h') + endif let lnum = search('aid_' . a:name . ',') if lnum == 0 call add(v:errors, 'Alloc ID ' . a:name . ' not defined') endif close - return lnum - top + return lnum - top - 1 endfunc diff --git a/src/testdir/test_unlet.vim b/src/testdir/test_unlet.vim index 13ec66b103..4c58785f20 100644 --- a/src/testdir/test_unlet.vim +++ b/src/testdir/test_unlet.vim @@ -1,18 +1,9 @@ " Tests for :unlet func Test_read_only() - try - " this caused a crash - unlet count - catch - call assert_true(v:exception =~ ':E795:') - endtry - try - " this caused a crash - unlet errmsg - catch - call assert_true(v:exception =~ ':E795:') - endtry + " these caused a crash + call assert_fails('unlet count', 'E795:') + call assert_fails('unlet errmsg', 'E795:') endfunc func Test_existing() @@ -24,9 +15,5 @@ endfunc func Test_not_existing() unlet! does_not_exist - try - unlet does_not_exist - catch - call assert_true(v:exception =~ ':E108:') - endtry + call assert_fails('unlet does_not_exist', 'E108:') endfunc diff --git a/src/version.c b/src/version.c index b842116808..a3d0146a6c 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1097, /**/ 1096, /**/ From 345efa013dc6d1754ba06e5596a26c48c9935937 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 15 Jan 2016 20:57:49 +0100 Subject: [PATCH 09/18] Update runtime files --- runtime/doc/eval.txt | 4 +- runtime/doc/help.txt | 12 +- runtime/doc/map.txt | 16 +-- runtime/doc/tags | 9 ++ runtime/doc/todo.txt | 42 +++--- runtime/doc/usr_02.txt | 253 ++++++++++++++++++++++++++-------- runtime/doc/various.txt | 3 +- runtime/syntax/aptconf.vim | 135 +++++++++++++----- runtime/syntax/rst.vim | 6 +- runtime/syntax/sshconfig.vim | 18 ++- runtime/syntax/sshdconfig.vim | 11 +- 11 files changed, 362 insertions(+), 147 deletions(-) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 8340bf2fee..35a12df6e4 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.4. Last change: 2016 Jan 09 +*eval.txt* For Vim version 7.4. Last change: 2016 Jan 15 VIM REFERENCE MANUAL by Bram Moolenaar @@ -3497,7 +3497,7 @@ getcmdwintype() *getcmdwintype()* *getcurpos()* getcurpos() Get the position of the cursor. This is like getpos('.'), but includes an extra item in the list: - [bufnum, lnum, col, off, curswant] + [bufnum, lnum, col, off, curswant] ~ The "curswant" number is the preferred column when moving the cursor vertically. This can be used to save and restore the cursor position: > diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt index 62aab3a679..23ad1dc9a3 100644 --- a/runtime/doc/help.txt +++ b/runtime/doc/help.txt @@ -1,4 +1,4 @@ -*help.txt* For Vim version 7.4. Last change: 2016 Jan 09 +*help.txt* For Vim version 7.4. Last change: 2016 Jan 10 VIM - main help file k @@ -10,14 +10,14 @@ Close this window: Use ":q". Jump to a subject: Position the cursor on a tag (e.g. |bars|) and hit CTRL-]. With the mouse: ":set mouse=a" to enable the mouse (in xterm or GUI). Double-click the left mouse button on a tag, e.g. |bars|. - Jump back: Type CTRL-T or CTRL-O (repeat to go further back). + Jump back: Type CTRL-T or CTRL-O. Repeat to go further back. Get specific help: It is possible to go directly to whatever you want help on, by giving an argument to the |:help| command. - It is possible to further specify the context: - *help-context* + Prepend something to specify the context: *help-context* + WHAT PREPEND EXAMPLE ~ - Normal mode command (nothing) :help x + Normal mode command :help x Visual mode command v_ :help v_u Insert mode command i_ :help i_ Command-line command : :help :quit @@ -25,7 +25,7 @@ Get specific help: It is possible to go directly to whatever you want help Vim command argument - :help -r Option ' :help 'textwidth' Regular expression / :help /[ - Also see |help-summary| for a verbose explanation. + See |help-summary| for more contexts and an explanation. Search for help: Type ":help word", then hit CTRL-D to see matching help entries for "word". diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index fb041c6a5e..4e7a784fab 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1,4 +1,4 @@ -*map.txt* For Vim version 7.4. Last change: 2014 Dec 08 +*map.txt* For Vim version 7.4. Last change: 2016 Jan 10 VIM REFERENCE MANUAL by Bram Moolenaar @@ -483,7 +483,7 @@ internal code is written to the script file. 1.6 SPECIAL CHARACTERS *:map-special-chars* - *map_backslash* + *map_backslash* *map-backslash* Note that only CTRL-V is mentioned here as a special character for mappings and abbreviations. When 'cpoptions' does not contain 'B', a backslash can also be used like CTRL-V. The <> notation can be fully used then |<>|. But @@ -494,21 +494,21 @@ To map a backslash, or use a backslash literally in the {rhs}, the special sequence "" can be used. This avoids the need to double backslashes when using nested mappings. - *map_CTRL-C* + *map_CTRL-C* *map-CTRL-C* Using CTRL-C in the {lhs} is possible, but it will only work when Vim is waiting for a key, not when Vim is busy with something. When Vim is busy CTRL-C interrupts/breaks the command. When using the GUI version on MS-Windows CTRL-C can be mapped to allow a Copy command to the clipboard. Use CTRL-Break to interrupt Vim. - *map_space_in_lhs* + *map_space_in_lhs* *map-space_in_lhs* To include a space in {lhs} precede it with a CTRL-V (type two CTRL-Vs for each space). - *map_space_in_rhs* + *map_space_in_rhs* *map-space_in_rhs* If you want a {rhs} that starts with a space, use "". To be fully Vi compatible (but unreadable) don't use the |<>| notation, precede {rhs} with a single CTRL-V (you have to type CTRL-V two times). - *map_empty_rhs* + *map_empty_rhs* *map-empty-rhs* You can create an empty {rhs} by typing nothing after a single CTRL-V (you have to type CTRL-V two times). Unfortunately, you cannot do this in a vimrc file. @@ -583,7 +583,7 @@ Upper and lowercase differences are ignored. It is not possible to put a comment after these commands, because the '"' character is considered to be part of the {lhs} or {rhs}. - *map_bar* + *map_bar* *map-bar* Since the '|' character is used to separate a map command from the next command, you will have to do something special to include a '|' in {rhs}. There are three methods: @@ -601,7 +601,7 @@ When 'b' is present in 'cpoptions', "\|" will be recognized as a mapping ending in a '\' and then another command. This is Vi compatible, but illogical when compared to other commands. - *map_return* + *map_return* *map-return* When you have a mapping that contains an Ex command, you need to put a line terminator after it to have it executed. The use of is recommended for this (see |<>|). Example: > diff --git a/runtime/doc/tags b/runtime/doc/tags index 45333c827e..b3d67baa7f 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -4903,6 +4903,8 @@ asm.vim syntax.txt /*asm.vim* asm68k syntax.txt /*asm68k* asmh8300.vim syntax.txt /*asmh8300.vim* assert_equal() eval.txt /*assert_equal()* +assert_exception() eval.txt /*assert_exception()* +assert_fails() eval.txt /*assert_fails()* assert_false() eval.txt /*assert_false()* assert_true() eval.txt /*assert_true()* at motion.txt /*at* @@ -6923,9 +6925,13 @@ man.vim filetype.txt /*man.vim* manual-copyright usr_01.txt /*manual-copyright* map() eval.txt /*map()* map- map.txt /*map-* +map-CTRL-C map.txt /*map-CTRL-C* map-ambiguous map.txt /*map-ambiguous* +map-backslash map.txt /*map-backslash* map-backtick tips.txt /*map-backtick* +map-bar map.txt /*map-bar* map-comments map.txt /*map-comments* +map-empty-rhs map.txt /*map-empty-rhs* map-error map.txt /*map-error* map-examples map.txt /*map-examples* map-keys-fails map.txt /*map-keys-fails* @@ -6934,7 +6940,10 @@ map-modes map.txt /*map-modes* map-multibyte map.txt /*map-multibyte* map-overview map.txt /*map-overview* map-precedence map.txt /*map-precedence* +map-return map.txt /*map-return* map-self-destroy tips.txt /*map-self-destroy* +map-space_in_lhs map.txt /*map-space_in_lhs* +map-space_in_rhs map.txt /*map-space_in_rhs* map-typing map.txt /*map-typing* map-which-keys map.txt /*map-which-keys* map.txt map.txt /*map.txt* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index ab151f1454..a2fc617cf6 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.4. Last change: 2016 Jan 10 +*todo.txt* For Vim version 7.4. Last change: 2016 Jan 15 VIM REFERENCE MANUAL by Bram Moolenaar @@ -34,8 +34,6 @@ not be repeated below, unless there is extra information. *known-bugs* -------------------- Known bugs and current work ----------------------- -/tmp/test_increment_new_style.patch.2 - Regexp problems: - The regexp engines are not reentrant, causing havoc when interrupted by a remote expression or something else. Move global variables onto the stack @@ -78,8 +76,6 @@ Regexp problems: matches the empty string. (Dominique Pelle, 2015 Oct 2, Nov 24) - Search for \\~ causes error E874. -Help to build with interfaces. (Ken Takata, 2015 Jan 5) - Need to try out instructions in INSSTALLpc.txt about how to install all interfaces and how to build Vim with them. Appveyor build with self-installing executable, includes getting most @@ -101,8 +97,6 @@ Should use /usr/local/share/applications or /usr/share/applications. Or use $XDG_DATA_DIRS. Also need to run update-desktop-database (Kuriyama Kazunobu, 2015 Nov 4) -Patch to update the help summary. (Christian Brabandt, 2015 Jan 10) - Add has('crypt-blowfish') and has('crypt-blowfish2') (Smu Johnson) Access to uninitialized memory in match_backref() regexp_nda.c:4882 @@ -123,19 +117,11 @@ Illegal memory access, requires ASAN to see. (Dominique Pelle, 2015 Jul 28) Gvim: when both Tab and CTRL-I are mapped, use CTRL-I not for Tab. -Patch to fix "." after CTRL-A in Visual block mode. (Ozaki Kiichi, 2015 Oct -24) - -Patch to have CTRL-A and CTRL-X update the '[ and '] marks. -(Yukihiro Nakadaira, 2015 Aug 23) - -Patch for GVimExt building with VS2015. (Mike Williams, 2015 Jan 10) - Unexpected delay when using CTRL-O u. It's not timeoutlen. (Gary Johnson, 2015 Aug 28) -Instead of separately uploading patches to the ftp site, can we get them from -github? This URL works: +Instead of separately uploading patches to the ftp site, we can get them from +github with a URL like this: https://github.com/vim/vim/compare/v7.4.920%5E...v7.4.920.diff Diff for version.c contains more context, can't skip a patch. > @@ -148,6 +134,9 @@ set_color_count(). Python: ":py raw_input('prompt')" doesn't work. (Manu Hack) +Patch to fix cursor position in right-left mode with concealing. +(Hirohito Higashi, 2016 Jan 13) + Plugin to use Vim in MANPAGER. Konfekt, PR #491 Using uninitialized memory. (Dominique Pelle, 2015 Nov 4) @@ -161,8 +150,16 @@ Patch to recognize string slice for variable followed by colon. Patch to add debug backtrace. (Alberto Fanjul, 2015 Sep 27) Update 2016 Jan 2. Issue #433 +Patch to gvim.nsi for appveyor build. (Ken Takata, 2016 Jan 12) + +Patch to improve behavior of dead keys on MS-Windows. (John Wellesz, 2015 Aug +25) https://github.com/vim/vim/pull/399.diff + Patch to make mzscheme (racket) interface work. (Yukihiro Nakadaira, 2015 Jan -10) Doesn't work for me, need to build from source. +10) Doesn't work for me, need to build from source. Include anyway? +Additional patch by Ken Takata, 2016 Jan 13. +Merged patch by Yasuhiro Nakadaira,, 2016 Jan 14. +Update for INSSTALLpc.txt by Ken Takata, Jan 14. MS-Windows: When editing a file with a leading space, writing it uses the wrong name. (Aram, 2014 Nov 7) Vim 7.4. @@ -172,7 +169,7 @@ specifically? First try with the parens, then without. Half-finished patch to fix the Problem using cgn to change a search hit when replacement includes hit. Reported by John Beckett, fix by Christian Brabandt, -2015 Dec 14, Update Dec 15. +2016 Jan 11. Patch to fix pointer cast warning in VS2015. (Mike Williams, 2015 Dec 13) Patch to make building GVimExt with VS2015. (Mike Williams, 2015 Dec 13) @@ -199,6 +196,10 @@ library: http://userguide.icu-project.org/boundaryanalysis When complete() first argument is before where insert started and 'backspace' is Vi compatible, the completion fails. (Hirohito Higashi, 2015 Feb 19) +Patch to fix bug in searchpair(). (Christian Brabandt, 2016 Jan 11) +Problem reported by David Fishburn, using searchpair() with synID() used in +the skip expression. + Test 44 fails when [[=A=]] is changed to [[=À=]]. Caused by getcmdline() not handling the 0x80 as a second byte correctly? (Dominique Pelle, 2015 Jun 10) @@ -339,9 +340,6 @@ When two SIGWINCH arrive very quickly, the second one may be lost. Make comments in the test Makefile silent. (Kartik Agaram, 2014 Sep 24) -Patch to improve behavior of dead keys on MS-Windows. (John Wellesz, 2015 Aug -25) https://github.com/vim/vim/pull/399.diff - Result of systemlist() does not show whether text ended in line break. (Bjorn Linse, 2014 Nov 27) diff --git a/runtime/doc/usr_02.txt b/runtime/doc/usr_02.txt index da63640456..ba29dc0e9d 100644 --- a/runtime/doc/usr_02.txt +++ b/runtime/doc/usr_02.txt @@ -1,4 +1,4 @@ -*usr_02.txt* For Vim version 7.4. Last change: 2015 Apr 12 +*usr_02.txt* For Vim version 7.4. Last change: 2016 Jan 15 VIM USER MANUAL - by Bram Moolenaar @@ -408,7 +408,15 @@ original version of the file. Everything you always wanted to know can be found in the Vim help files. Don't be afraid to ask! - To get generic help use this command: > + +If you know what you are looking for, it is usually easier to search for it +using the help system, instead of using Google. Because the subjects follow +a certain style guide. + +Also the help has the advantage of belonging to your particular Vim version. +You won't see help for commands added later. These would not work for you. + +To get generic help use this command: > :help @@ -482,7 +490,7 @@ example, use the following command: > :help 'number' -The table with all mode prefixes can be found here: |help-context|. +The table with all mode prefixes can be found below: |help-summary|. Special keys are enclosed in angle brackets. To find help on the up-arrow key in Insert mode, for instance, use this command: > @@ -499,64 +507,187 @@ You can use the error ID at the start to find help about it: > Summary: *help-summary* > - :help -< Gives you very general help. Scroll down to see a list of all - helpfiles, including those added locally (i.e. not distributed - with Vim). > - :help user-toc.txt -< Table of contents of the User Manual. > - :help :subject -< Ex-command "subject", for instance the following: > - :help :help -< Help on getting help. > - :help abc -< normal-mode command "abc". > - :help CTRL-B -< Control key in Normal mode. > - :help i_abc - :help i_CTRL-B -< The same in Insert mode. > - :help v_abc - :help v_CTRL-B -< The same in Visual mode. > - :help c_abc - :help c_CTRL-B -< The same in Command-line mode. > - :help 'subject' -< Option 'subject'. > - :help subject() -< Function "subject". > - :help -subject -< Command-line argument "-subject". > - :help +subject -< Compile-time feature "+subject". > - :help /* -< Regular expression item "*" > - :help EventName -< Autocommand event "EventName". > - :help digraphs.txt -< The top of the helpfile "digraph.txt". - Similarly for any other helpfile. > - :help pattern -< Find a help tag starting with "pattern". Repeat for - others. > - :help pattern -< See all possible help tag matches "pattern" at once. > - :helpgrep pattern -< Search the whole text of all help files for pattern "pattern". - Jumps to the first match. Jump to other matches with: > - :cn -< next match > - :cprev - :cN -< previous match > - :cfirst - :clast -< first or last match > - :copen - :cclose -< open/close the quickfix window; press to jump - to the item under the cursor + +1) Use Ctrl-D after typing a topic and let Vim show all available topics. + Or press Tab to complete: > + :help some +< More information on how to use the help: > + :help helphelp + +2) Follow the links in bars to related help. You can go from the detailed + help to the user documentation, which describes certain commands more from + a user perspective and less detailed. E.g. after: > + :help pattern.txt +< You can see the user guide topics |03.9| and |usr_27.txt| in the + introduction. + +3) Options are enclosed in single apostrophes. To go to the help topic for the + list option: > + :help 'list' +< If you only know you are looking for a certain option, you can also do: > + :help options.txt +< to open the help page which describes all option handling and then search + using regular expressions, e.g. textwidth. + Certain options have their own namespace, e.g.: > + :help cpo- +< for the corresponding flag of the 'cpoptions' settings, substitute + by a specific flag, e.g.: > + :help cpo-; +< And for the guioption flags: > + :help go- + +4) Normal mode commands do not have a prefix. To go to the help page for the + "gt" command: > + :help gt + +5) Insert mode commands start with i_. Help for deleting a word: > + :help i_CTRL-W + +6) Visual mode commands start with v_. Help for jumping to the other side of + the Visual area: > + :help v_o + +7) Command line editing and arguments start with c_. Help for using the + command argument %: > + :help c_% + +8) Ex-commands always start with ":", so to go to the :s command help: > + :help :s + +9) Key combinations. They usually start with a single letter indicating + the mode for which they can be used. E.g.: > + :help i_CTRL-X +< takes you to the family of Ctrl-X commands for insert mode which can be + used to auto complete different things. Note, that certain keys will + always be written the same, e.g. Control will always be CTRL. + For normal mode commands there is no prefix and the topic is available at + :h CTRL-. E.g. > + :help CTRL-W +< In contrast > + :help c_CTRL-R +< will describe what the Ctrl-R does when entering commands in the Command + line and > + :help v_Ctrl-A +< talks about incrementing numbers in visual mode and > + :help g_CTRL-A +< talks about the g command (e.g. you have to press "g" then ). + Here the "g" stand for the normal command "g" which always expects a second + key before doing something similar to the commands starting with "z" + +10) Regexp items always start with /. So to get help for the "\+" quantifier + in Vim regexes: > + :help /\+ +< If you need to know everything about regular expressions, start reading + at: > + :help pattern.txt + +11) Registers always start with "quote". To find out about the special ":" + register: > + :help quote: + +12) Vim Script (VimL) is available at > + :help eval.txt +< Certain aspects of the language are available at :h expr-X where "X" is a + single letter. E.g. > + :help expr-! +< will take you to the topic describing the "!" (Not) operator for + VimScript. + Also important is > + :help function-list +< to find a short description of all functions available. Help topics for + VimL functions always include the "()", so: > + :help append() +< talks about the append VimL function rather than how to append text in the + current buffer. + +13) Mappings are talked about in the help page :h |map.txt|. Use > + :help mapmode-i +< to find out about the |:imap| command. Also use :map-topic + to find out about certain subtopics particular for mappings. e.g: > + :help :map-local +< for buffer-local mappings or > + :help map-bar +< for how the '|' is handled in mappings. + +14) Command definitions are talked about :h command-topic, so use > + :help command-bar +< to find out about the '!' argument for custom commands. + +15) Window management commands always start with CTRL-W, so you find the + corresponding help at :h CTRL-W_letter. E.g. > + :help CTRL-W_p +< for moving the previous accessed window). You can also access > + :help windows.txt +< and read your way through if you are looking for window handling + commands. + +16) Use |:helpgrep| to search in all help pages (and also of any installed + plugins). See |:helpgrep| for how to use it. + To search for a topic: > + :helpgrep topic +< This takes you to the first match. To go to the next one: > + :cnext +< All matches are available in the quickfix window which can be opened + with: > + :copen +< Move around to the match you like and press Enter to jump to that help. + +17) The user manual. This describes help topics for beginners in a rather + friendly way. Start at |usr_toc.txt| to find the table of content (as you + might have guessed): > + :help usr_toc.txt +< Skim over the contents to find interesting topics. The "Digraphs" and + "Entering special characters" items are in chapter 24, so to go to that + particular help page: > + :help usr_24.txt +< Also if you want to access a certain chapter in the help, the chapter + number can be accessed directly like this: > + :help 10.1 +< goes to chapter 10.1 in |usr_10.txt| and talks about recording macros. + +18) Highlighting groups. Always start with hl-groupname. E.g. > + :help hl-WarningMsg +< talks about the WarningMsg highlighting group. + +19) Syntax highlighting is namespaced to :syn-topic e.g. > + :help :syn-conceal +< talks about the conceal argument for the :syn command. + +20) Quickfix commands usually start with :c while location list commands + usually start with :l + +21) Autocommand events can be found by their name: > + :help BufWinLeave +< To see all possible events: > + :help autocommands-events + +22) Command-line switches always start with "-". So for the help of the -f + command switch of Vim use: > + :help -f + +23) Optional features always start with "+". To find out about the + conceal feature use: > + :help +conceal + +24) Documentation for included filetype specific functionality is usually + available in the form ft--. So > + :help ft-c-syntax +< talks about the C syntax file and the option it provides. Sometimes, + additional sections for omni completion > + :help ft-php-omni +< or filetype plugins > + :help ft-tex-plugin +< are available. + +25) Error and Warning codes can be looked up directly in the help. So > + :help E297 +< takes you exactly to the description of the swap error message and > + :help W10 +< talks about the warning "Changing a readonly file". + Sometimes however, those error codes are not described, but rather are + listed at the Vim command that usually causes this. So: > + :help E128 +< takes you to the |:function| command ============================================================================== diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index 282ccc694a..975dcf533b 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -1,4 +1,4 @@ -*various.txt* For Vim version 7.4. Last change: 2015 Nov 15 +*various.txt* For Vim version 7.4. Last change: 2016 Jan 10 VIM REFERENCE MANUAL by Bram Moolenaar @@ -647,6 +647,7 @@ K Run a program to lookup the keyword under the g CTRL-A Only when Vim was compiled with MEM_PROFILING defined (which is very rare): print memory usage statistics. Only useful for debugging Vim. + For incrementing in Visual mode see |v_g_CTRL-A|. ============================================================================== 2. Using Vim like less or more *less* diff --git a/runtime/syntax/aptconf.vim b/runtime/syntax/aptconf.vim index 0607ca10f5..7a31b2d15e 100644 --- a/runtime/syntax/aptconf.vim +++ b/runtime/syntax/aptconf.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: APT config file " Maintainer: Yann Amar -" Last Change: 2013 Apr 12 +" Last Change: 2015 Dec 22 " For version 5.x: Clear all syntax items " For version 6.x and 7.x: Quit when a syntax file was already loaded @@ -38,22 +38,22 @@ setlocal iskeyword+=/,-,.,_,+ " Incomplete keywords will be treated differently than completely bad strings: syn keyword aptconfGroupIncomplete - \ a[cquire] a[ptitude] d[ebtags] d[ebug] d[ir] d[pkg] d[select] - \ o[rderlist] p[ackagemanager] p[kgcachegen] q[uiet] r[pm] - \ u[nattended-upgrade] + \ a[cquire] a[dequate] a[ptitude] a[ptlistbugs] d[ebtags] d[ebug] + \ d[ir] d[pkg] d[select] o[rderlist] p[ackagemanager] p[kgcachegen] + \ q[uiet] r[pm] s[ynaptic] u[nattended-upgrade] w[hatmaps] " Only the following keywords can be used at toplevel (to begin an option): syn keyword aptconfGroup - \ acquire apt aptitude debtags debug dir dpkg dselect - \ orderlist packagemanager pkgcachegen quiet rpm - \ unattended-upgrade + \ acquire adequate apt aptitude aptlistbugs debtags debug + \ dir dpkg dselect orderlist packagemanager pkgcachegen + \ quiet rpm synaptic unattended-upgrade whatmaps " Possible options for each group: " Acquire: {{{ syn keyword aptconfAcquire contained - \ cdrom Check-Valid-Until CompressionTypes ForceHash ftp gpgv - \ GzipIndexes http https Languages Max-ValidTime Min-ValidTime PDiffs - \ Queue-Mode Retries Source-Symlinks + \ cdrom Check-Valid-Until CompressionTypes ForceHash ForceIPv4 + \ ForceIPv6 ftp gpgv GzipIndexes http https Languages Max-ValidTime + \ Min-ValidTime PDiffs Queue-Mode Retries Source-Symlinks syn keyword aptconfAcquireCDROM contained \ AutoDetect CdromOnly Mount UMount @@ -62,14 +62,15 @@ syn keyword aptconfAcquireCompressionTypes contained \ bz2 lzma gz Order syn keyword aptconfAcquireFTP contained - \ Passive Proxy ProxyLogin Timeout + \ ForceExtended Passive Proxy ProxyLogin Timeout syn keyword aptconfAcquireHTTP contained \ AllowRedirect Dl-Limit Max-Age No-Cache No-Store Pipeline-Depth - \ Proxy Timeout User-Agent + \ Proxy ProxyAutoDetect Proxy-Auto-Detect Timeout User-Agent syn keyword aptconfAcquireHTTPS contained - \ CaInfo CaPath CrlFile IssuerCert SslCert SslForceVersion SslKey + \ AllowRedirect CaInfo CaPath CrlFile Dl-Limit IssuerCert Max-Age + \ No-Cache No-Store Proxy SslCert SslForceVersion SslKey Timeout \ Verify-Host Verify-Peer syn keyword aptconfAcquireMaxValidTime contained @@ -83,14 +84,21 @@ syn cluster aptconfAcquire_ contains=aptconfAcquire, \ aptconfAcquireHTTP,aptconfAcquireHTTPS,aptconfAcquireMaxValidTime, \ aptconfAcquirePDiffs " }}} +" Adequate: {{{ +syn keyword aptconfAdequate contained + \ Enabled + +syn cluster aptconfAdequate_ contains=aptconfAdequate +" }}} " Apt: {{{ syn keyword aptconfApt contained \ Architecture Architectures Archive Authentication AutoRemove - \ Build-Essential Cache Cache-Grow Cache-Limit Cache-Start CDROM - \ Changelogs Clean-Installed Compressor Default-Release - \ Force-LoopBreak Get Ignore-Hold Immediate-Configure + \ Build-Essential Build-Profiles Cache Cache-Grow Cache-Limit + \ Cache-Start CDROM Changelogs Clean-Installed Compressor + \ Default-Release Force-LoopBreak Get Ignore-Hold Immediate-Configure \ Install-Recommends Install-Suggests Keep-Fds List-Cleanup - \ NeverAutoRemove Never-MarkAuto-Sections Periodic Status-Fd Update + \ Move-Autobit-Sections NeverAutoRemove Never-MarkAuto-Sections + \ Periodic Status-Fd Update VersionedKernelPackages syn keyword aptconfAptAuthentication contained \ TrustCDROM @@ -124,11 +132,12 @@ syn keyword aptconfAptGet contained syn keyword aptconfAptPeriodic contained \ AutocleanInterval BackupArchiveInterval BackupLevel - \ Download-Upgradeable-Packages MaxAge MaxSize MinAge - \ Unattended-Upgrade Update-Package-Lists Verbose + \ Download-Upgradeable-Packages Download-Upgradeable-Packages-Debdelta + \ Enable MaxAge MaxSize MinAge Unattended-Upgrade Update-Package-Lists + \ Verbose syn keyword aptconfAptUpdate contained - \ Pre-Invoke Post-Invoke Post-Invoke-Success + \ List-Refresh Pre-Invoke Post-Invoke Post-Invoke-Success syn cluster aptconfApt_ contains=aptconfApt, \ aptconfAptAuthentication,aptconfAptAutoRemove,aptconfAptCache, @@ -240,6 +249,12 @@ syn cluster aptconfAptitude_ contains=aptconfAptitude, \ aptconfAptitudeUIKeyBindings,aptconfAptitudeUIStyles, \ aptconfAptitudeUIStylesElements " }}} +" AptListbugs: {{{ +syn keyword aptconfAptListbugs contained + \ IgnoreRegexp Severities + +syn cluster aptconfAptListbugs_ contains=aptconfAptListbugs +" }}} " DebTags: {{{ syn keyword aptconfDebTags contained \ Vocabulary @@ -251,7 +266,8 @@ syn keyword aptconfDebug contained \ Acquire aptcdrom BuildDeps Hashes IdentCdrom Nolocking \ pkgAcquire pkgAutoRemove pkgCacheGen pkgDepCache pkgDPkgPM \ pkgDPkgProgressReporting pkgInitialize pkgOrderList - \ pkgPackageManager pkgPolicy pkgProblemResolver sourceList + \ pkgPackageManager pkgPolicy pkgProblemResolver RunScripts + \ sourceList syn keyword aptconfDebugAcquire contained \ cdrom Ftp gpgv Http Https netrc @@ -295,7 +311,7 @@ syn keyword aptconfDirMedia contained \ MountPath syn keyword aptconfDirState contained - \ cdroms extended_states Lists mirrors status + \ cdroms extended_states Lists mirrors preferences status syn cluster aptconfDir_ contains=aptconfDir, \ aptconfDirAptitude,aptconfDirBin,aptconfDirCache,aptconfDirEtc, @@ -303,15 +319,16 @@ syn cluster aptconfDir_ contains=aptconfDir, " }}} " DPkg: {{{ syn keyword aptconfDPkg contained - \ Build-Options Chroot-Directory ConfigurePending FlushSTDIN MaxArgs - \ MaxBytes NoTriggers options Pre-Install-Pkgs Pre-Invoke Post-Invoke + \ Build-Options Chroot-Directory ConfigurePending FlushSTDIN + \ MaxArgBytes MaxArgs MaxBytes NoTriggers options + \ Pre-Install-Pkgs Pre-Invoke Post-Invoke \ Run-Directory StopOnError Tools TriggersPending syn keyword aptconfDPkgTools contained - \ Options Version + \ adequate InfoFD Options Version syn cluster aptconfDPkg_ contains=aptconfDPkg, - \ aptconfDPkgOrderList,aptconfDPkgOrderListScore,aptconfDPkgTools + \ aptconfDPkgTools " }}} " DSelect: {{{ syn keyword aptconfDSelect contained @@ -353,23 +370,59 @@ syn keyword aptconfRpm contained syn cluster aptconfRpm_ contains=aptconfRpm " }}} -" Unattened Upgrade: {{{ +" Synaptic: {{{ +syn keyword aptconfSynaptic contained + \ AskQuitOnProceed AskRelated AutoCleanCache CleanCache DefaultDistro + \ delAction delHistory Download-Only ftpProxy ftpProxyPort httpProxy + \ httpProxyPort Install-Recommends LastSearchType Maximized noProxy + \ OneClickOnStatusActions ShowAllPkgInfoInMain showWelcomeDialog + \ ToolbarState undoStackSize update upgradeType useProxy UseStatusColors + \ UseTerminal useUserFont useUserTerminalFont ViewMode + \ availVerColumnPos availVerColumnVisible componentColumnPos + \ componentColumnVisible descrColumnPos descrColumnVisible + \ downloadSizeColumnPos downloadSizeColumnVisible hpanedPos + \ instVerColumnPos instVerColumnVisible instSizeColumnPos + \ instSizeColumnVisible nameColumnPos nameColumnVisible + \ sectionColumnPos sectionColumnVisible statusColumnPos + \ statusColumnVisible supportedColumnPos supportedColumnVisible + \ vpanedPos windowWidth windowHeight windowX windowY closeZvt + \ color-available color-available-locked color-broken color-downgrade + \ color-install color-installed-locked color-installed-outdated + \ color-installed-updated color-new color-purge color-reinstall + \ color-remove color-upgrade + +syn keyword aptconfSynapticUpdate contained + \ last type + +syn cluster aptconfSynaptic_ contains=aptconfSynaptic, + \ aptconfSynapticUpdate +" }}} +" Unattended Upgrade: {{{ syn keyword aptconfUnattendedUpgrade contained - \ AutoFixInterruptedDpkg Automatic-Reboot InstallOnShutdown Mail - \ MailOnlyOnError MinimalSteps Origins-Pattern Package-Blacklist + \ AutoFixInterruptedDpkg Automatic-Reboot Automatic-Reboot-Time + \ Automatic-Reboot-WithUsers InstallOnShutdown Mail MailOnlyOnError + \ MinimalSteps Origins-Pattern Package-Blacklist \ Remove-Unused-Dependencies syn cluster aptconfUnattendedUpgrade_ contains=aptconfUnattendedUpgrade " }}} +" Whatmaps: {{{ +syn keyword aptconfWhatmaps contained + \ Enable-Restart Security-Update-Origins + +syn cluster aptconfWhatmaps_ contains=aptconfWhatmaps +" }}} syn case match " Now put all the keywords (and 'valid' options) in a single cluster: syn cluster aptconfOptions contains=aptconfRegexpOpt, - \ @aptconfAcquire_,@aptconfApt_,@aptconfAptitude_,@aptconfDebTags_, - \ @aptconfDebug_,@aptconfDir_,@aptconfDPkg_,@aptconfDSelect_, - \ @aptconfOrderList_,@aptconfPackageManager_,@aptconfPkgCacheGen_, - \ @aptconfQuiet_,@aptconfRpm_,@aptconfUnattendedUpgrade_ + \ @aptconfAcquire_,@aptconfAdequate_,@aptconfApt_,@aptconfAptitude_, + \ @aptconfAptListbugs_,@aptconfDebTags_,@aptconfDebug_,@aptconfDir_, + \ @aptconfDPkg_,@aptconfDSelect_,@aptconfOrderList_, + \ @aptconfPackageManager_,@aptconfPkgCacheGen_,@aptconfQuiet_, + \ @aptconfRpm_,@aptconfSynaptic_,@aptconfUnattendedUpgrade_, + \ @aptconfWhatmaps_ " Syntax: syn match aptconfSemiColon ';' @@ -382,8 +435,11 @@ syn region aptconfInclude matchgroup=aptconfOperator start='::' end='::\|\s'me= " Basic Syntax Errors: XXX avoid to generate false positives !!! " -" * Invalid comment format (seems to not cause errors, but...): -syn match aptconfAsError display '^#.*' +" * Undocumented inline comment. Since it is currently largely used, and does +" not seem to cause trouble ('apt-config dump' never complains when # is used +" the same way than //) it has been moved to aptconfComment group. But it +" still needs to be defined here (i.e. before #clear and #include directives) +syn match aptconfComment '#.*' contains=@aptconfCommentSpecial " " * When a semicolon is missing after a double-quoted string: " There are some cases (for example in the Dir group of options, but not only) @@ -445,6 +501,8 @@ hi def link aptconfAcquireHTTPS aptconfOption hi def link aptconfAcquireMaxValidTime aptconfOption hi def link aptconfAcquirePDiffs aptconfOption +hi def link aptconfAdequate aptconfOption + hi def link aptconfApt aptconfOption hi def link aptconfAptAuthentication aptconfOption hi def link aptconfAptAutoRemove aptconfOption @@ -471,6 +529,8 @@ hi def link aptconfAptitudeUIKeyBindings aptconfOption hi def link aptconfAptitudeUIStyles aptconfOption hi def link aptconfAptitudeUIStylesElements aptconfOption +hi def link aptconfAptListbugs aptconfOption + hi def link aptconfDebTags aptconfOption hi def link aptconfDebug aptconfOption @@ -504,8 +564,13 @@ hi def link aptconfQuiet aptconfOption hi def link aptconfRpm aptconfOption +hi def link aptconfSynaptic aptconfOption +hi def link aptconfSynapticUpdate aptconfOption + hi def link aptconfUnattendedUpgrade aptconfOption +hi def link aptconfWhatmaps aptconfOption + let b:current_syntax = "aptconf" let &cpo = s:cpo_save diff --git a/runtime/syntax/rst.vim b/runtime/syntax/rst.vim index 8b17104be4..b3c89f8352 100644 --- a/runtime/syntax/rst.vim +++ b/runtime/syntax/rst.vim @@ -2,7 +2,7 @@ " Language: reStructuredText documentation format " Maintainer: Marshall Ward " Previous Maintainer: Nikolai Weibull -" Latest Revision: 2015-09-07 +" Latest Revision: 2016-01-05 if exists("b:current_syntax") finish @@ -13,8 +13,6 @@ set cpo&vim syn case ignore -syn match rstSections "^\%(\([=`:.'"~^_*+#-]\)\1\+\n\)\=.\+\n\([=`:.'"~^_*+#-]\)\2\+$" - syn match rstTransition /^[=`:.'"~^_*+#-]\{4,}\s*$/ syn cluster rstCruft contains=rstEmphasis,rstStrongEmphasis, @@ -123,6 +121,8 @@ call s:DefineInlineMarkup('InlineLiteral', '``', "", '``') call s:DefineInlineMarkup('SubstitutionReference', '|', '|', '|_\{0,2}') call s:DefineInlineMarkup('InlineInternalTargets', '_`', '`', '`') +syn match rstSections "^\%(\([=`:.'"~^_*+#-]\)\1\+\n\)\=.\+\n\([=`:.'"~^_*+#-]\)\2\+$" + " TODO: Can’t remember why these two can’t be defined like the ones above. execute 'syn match rstFootnoteReference contains=@NoSpell' . \ ' +\[\%(\d\+\|#\%(' . s:ReferenceName . '\)\=\|\*\)\]_+' diff --git a/runtime/syntax/sshconfig.vim b/runtime/syntax/sshconfig.vim index 479277e17f..ef2ca07976 100644 --- a/runtime/syntax/sshconfig.vim +++ b/runtime/syntax/sshconfig.vim @@ -2,9 +2,10 @@ " Language: OpenSSH client configuration file (ssh_config) " Author: David Necas (Yeti) " Maintainer: Dominik Fischer -" Contributor: Leonard Ehrenfried -" Last Change: 2015 Dec 3 -" SSH Version: 7.0 +" Contributor: Leonard Ehrenfried +" Contributor: Karsten Hopp +" Last Change: 2016 Jan 15 +" SSH Version: 7.1 " " Setup @@ -69,8 +70,8 @@ syn keyword sshconfigSysLogFacility DAEMON USER AUTH AUTHPRIV LOCAL0 LOCAL1 syn keyword sshconfigSysLogFacility LOCAL2 LOCAL3 LOCAL4 LOCAL5 LOCAL6 LOCAL7 syn keyword sshconfigAddressFamily inet inet6 -syn match sshconfigIPQoS "af1[1234]" -syn match sshconfigIPQoS "af2[23]" +syn match sshconfigIPQoS "af1[123]" +syn match sshconfigIPQoS "af2[123]" syn match sshconfigIPQoS "af3[123]" syn match sshconfigIPQoS "af4[123]" syn match sshconfigIPQoS "cs[0-7]" @@ -106,6 +107,10 @@ syn keyword sshconfigMatch canonical exec host originalhost user localuser all syn keyword sshconfigKeyword AddressFamily syn keyword sshconfigKeyword BatchMode syn keyword sshconfigKeyword BindAddress +syn keyword sshconfigKeyword CanonicalDomains +syn keyword sshconfigKeyword CanonicalizeFallbackLocal +syn keyword sshconfigKeyword CanonicalizeHostname +syn keyword sshconfigKeyword CanonicalizeMaxDots syn keyword sshconfigKeyword ChallengeResponseAuthentication syn keyword sshconfigKeyword CheckHostIP syn keyword sshconfigKeyword Cipher @@ -145,6 +150,8 @@ syn keyword sshconfigKeyword HostbasedKeyTypes syn keyword sshconfigKeyword IPQoS syn keyword sshconfigKeyword IdentitiesOnly syn keyword sshconfigKeyword IdentityFile +syn keyword sshconfigKeyword IgnoreUnknown +syn keyword sshconfigKeyword IPQoS syn keyword sshconfigKeyword KbdInteractiveAuthentication syn keyword sshconfigKeyword KbdInteractiveDevices syn keyword sshconfigKeyword KexAlgorithms @@ -182,6 +189,7 @@ syn keyword sshconfigKeyword UseBlacklistedKeys syn keyword sshconfigKeyword UsePrivilegedPort syn keyword sshconfigKeyword User syn keyword sshconfigKeyword UserKnownHostsFile +syn keyword sshconfigKeyword UseRoaming syn keyword sshconfigKeyword VerifyHostKeyDNS syn keyword sshconfigKeyword VisualHostKey syn keyword sshconfigKeyword XAuthLocation diff --git a/runtime/syntax/sshdconfig.vim b/runtime/syntax/sshdconfig.vim index ac90a80aa5..4203047d2c 100644 --- a/runtime/syntax/sshdconfig.vim +++ b/runtime/syntax/sshdconfig.vim @@ -4,9 +4,10 @@ " Maintainer: Dominik Fischer " Contributor: Thilo Six " Contributor: Leonard Ehrenfried +" Contributor: Karsten Hopp " Originally: 2009-07-09 -" Last Change: 2015 Dec 3 -" SSH Version: 7.0 +" Last Change: 2016 Jan 12 +" SSH Version: 7.1 " " Setup @@ -65,8 +66,8 @@ syn keyword sshdconfigSysLogFacility LOCAL2 LOCAL3 LOCAL4 LOCAL5 LOCAL6 LOCAL7 syn keyword sshdconfigCompression delayed -syn match sshdconfigIPQoS "af1[1234]" -syn match sshdconfigIPQoS "af2[23]" +syn match sshdconfigIPQoS "af1[123]" +syn match sshdconfigIPQoS "af2[123]" syn match sshdconfigIPQoS "af3[123]" syn match sshdconfigIPQoS "af4[123]" syn match sshdconfigIPQoS "cs[0-7]" @@ -109,6 +110,7 @@ syn keyword sshdconfigKeyword AllowGroups syn keyword sshdconfigKeyword AllowStreamLocalForwarding syn keyword sshdconfigKeyword AllowTcpForwarding syn keyword sshdconfigKeyword AllowUsers +syn keyword sshdconfigKeyword AuthenticationMethods syn keyword sshdconfigKeyword AuthorizedKeysFile syn keyword sshdconfigKeyword AuthorizedKeysCommand syn keyword sshdconfigKeyword AuthorizedKeysCommandUser @@ -132,6 +134,7 @@ syn keyword sshdconfigKeyword GSSAPIStrictAcceptorCheck syn keyword sshdconfigKeyword GatewayPorts syn keyword sshdconfigKeyword HostCertificate syn keyword sshdconfigKeyword HostKey +syn keyword sshdconfigKeyword HostKeyAgent syn keyword sshdconfigKeyword HostKeyAlgorithms syn keyword sshdconfigKeyword HostbasedAcceptedKeyTypes syn keyword sshdconfigKeyword HostbasedAuthentication From b7604cc19fa1db6a8182546bf662aa13d4574d7a Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 15 Jan 2016 21:23:22 +0100 Subject: [PATCH 10/18] patch 7.4.1098 Problem: Still using old style C function declarations. Solution: Always define __ARGS() to include types. Turn a few functions into ANSI style to find out if this causes problems for anyone. --- src/eval.c | 32 ++++++++++++-------------------- src/main.c | 12 +++++------- src/os_unix.h | 12 +----------- src/version.c | 2 ++ src/vim.h | 18 +----------------- 5 files changed, 21 insertions(+), 55 deletions(-) diff --git a/src/eval.c b/src/eval.c index ac1058cf0c..ecf7a9a2f0 100644 --- a/src/eval.c +++ b/src/eval.c @@ -973,8 +973,7 @@ eval_clear() * Return the name of the executed function. */ char_u * -func_name(cookie) - void *cookie; +func_name(void *cookie) { return ((funccall_T *)cookie)->func->uf_name; } @@ -993,8 +992,7 @@ func_breakpoint(cookie) * Return the address holding the debug tick for a funccall cookie. */ int * -func_dbg_tick(cookie) - void *cookie; +func_dbg_tick(void *cookie) { return &((funccall_T *)cookie)->dbg_tick; } @@ -1003,8 +1001,7 @@ func_dbg_tick(cookie) * Return the nesting level for a funccall cookie. */ int -func_level(cookie) - void *cookie; +func_level(void *cookie) { return ((funccall_T *)cookie)->level; } @@ -1031,9 +1028,7 @@ current_func_returned() * not already exist. */ void -set_internal_string_var(name, value) - char_u *name; - char_u *value; +set_internal_string_var(char_u *name, char_u *value) { char_u *val; typval_T *tvp; @@ -1057,12 +1052,11 @@ static char_u *redir_varname = NULL; /* * Start recording command output to a variable + * When "append" is TRUE append to an existing variable. * Returns OK if successfully completed the setup. FAIL otherwise. */ int -var_redir_start(name, append) - char_u *name; - int append; /* append to an existing variable */ +var_redir_start(char_u *name, int append) { int save_emsg; int err; @@ -1139,9 +1133,7 @@ var_redir_start(name, append) * :redir END */ void -var_redir_str(value, value_len) - char_u *value; - int value_len; +var_redir_str(char_u *value, int value_len) { int len; @@ -1201,11 +1193,11 @@ var_redir_stop() # if defined(FEAT_MBYTE) || defined(PROTO) int -eval_charconvert(enc_from, enc_to, fname_from, fname_to) - char_u *enc_from; - char_u *enc_to; - char_u *fname_from; - char_u *fname_to; +eval_charconvert( + char_u *enc_from, + char_u *enc_to, + char_u *fname_from, + char_u *fname_to) { int err = FALSE; diff --git a/src/main.c b/src/main.c index 584687eb61..d7723d2e38 100644 --- a/src/main.c +++ b/src/main.c @@ -1064,9 +1064,9 @@ vim_main2(int argc UNUSED, char **argv UNUSED) * commands, return when entering Ex mode. "noexmode" is TRUE then. */ void -main_loop(cmdwin, noexmode) - int cmdwin; /* TRUE when working in the command-line window */ - int noexmode; /* TRUE when return on entering Ex mode */ +main_loop( + int cmdwin, /* TRUE when working in the command-line window */ + int noexmode) /* TRUE when return on entering Ex mode */ { oparg_T oa; /* operator arguments */ volatile int previous_got_int = FALSE; /* "got_int" was TRUE */ @@ -1360,8 +1360,7 @@ main_loop(cmdwin, noexmode) * Exit, but leave behind swap files for modified buffers. */ void -getout_preserve_modified(exitval) - int exitval; +getout_preserve_modified(int exitval) { # if defined(SIGHUP) && defined(SIG_IGN) /* Ignore SIGHUP, because a dropped connection causes a read error, which @@ -1380,8 +1379,7 @@ getout_preserve_modified(exitval) /* Exit properly */ void -getout(exitval) - int exitval; +getout(int exitval) { #ifdef FEAT_AUTOCMD buf_T *buf; diff --git a/src/os_unix.h b/src/os_unix.h index 0dd75cf7f3..4504cce063 100644 --- a/src/os_unix.h +++ b/src/os_unix.h @@ -75,13 +75,7 @@ #endif #ifndef __ARGS - /* The AIX VisualAge cc compiler defines __EXTENDED__ instead of __STDC__ - * because it includes pre-ansi features. */ -# if defined(__STDC__) || defined(__GNUC__) || defined(__EXTENDED__) -# define __ARGS(x) x -# else -# define __ARGS(x) () -# endif +# define __ARGS(x) x #endif /* always use unlink() to remove files */ @@ -181,10 +175,6 @@ # include #endif -#ifdef __COHERENT__ -# undef __ARGS -#endif - #if (defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT)) \ || (defined(HAVE_SYS_SYSINFO_H) && defined(HAVE_SYSINFO)) \ || defined(HAVE_SYSCTL) || defined(HAVE_SYSCONF) diff --git a/src/version.c b/src/version.c index a3d0146a6c..475b4d6e8a 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1098, /**/ 1097, /**/ diff --git a/src/vim.h b/src/vim.h index 81d0929116..a8a6eadfef 100644 --- a/src/vim.h +++ b/src/vim.h @@ -255,26 +255,18 @@ */ #ifdef AZTEC_C # include -# define __ARGS(x) x #endif #ifdef SASC # include -# define __ARGS(x) x #endif #ifdef _DCC # include -# define __ARGS(x) x -#endif - -#ifdef __TURBOC__ -# define __ARGS(x) x #endif #ifdef __BEOS__ # include "os_beos.h" -# define __ARGS(x) x #endif #if (defined(UNIX) || defined(__EMX__) || defined(VMS)) \ @@ -282,16 +274,8 @@ # include "os_unix.h" /* bring lots of system header files */ #endif -#if defined(MACOS) && (defined(__MRC__) || defined(__SC__)) - /* Apple's Compilers support prototypes */ -# define __ARGS(x) x -#endif #ifndef __ARGS -# if defined(__STDC__) || defined(__GNUC__) || defined(WIN3264) -# define __ARGS(x) x -# else -# define __ARGS(x) () -# endif +# define __ARGS(x) x #endif /* __ARGS and __PARMS are the same thing. */ From 36d7cd8965bc4027d420c7d70c56ac95d83d3bfa Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 15 Jan 2016 22:08:23 +0100 Subject: [PATCH 11/18] patch 7.4.1099 Problem: It's not easy to know if Vim supports blowfish. (Smu Johnson) Solution: Add has('crypt-blowfish') and has('crypt-blowfish2'). --- src/eval.c | 2 ++ src/version.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/eval.c b/src/eval.c index ecf7a9a2f0..e97ddc4781 100644 --- a/src/eval.c +++ b/src/eval.c @@ -12994,6 +12994,8 @@ f_has(argvars, rettv) #endif #ifdef FEAT_CRYPT "cryptv", + "crypt-blowfish", + "crypt-blowfish2", #endif #ifdef FEAT_CSCOPE "cscope", diff --git a/src/version.c b/src/version.c index 475b4d6e8a..ab4e51f899 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1099, /**/ 1098, /**/ From abfa9efb983c6fe9f5c4c342ff4d7017ce9a2c4b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 15 Jan 2016 22:34:45 +0100 Subject: [PATCH 12/18] patch 7.4.1100 Problem: Cygwin makefiles are unused. Solution: Remove them. --- src/GvimExt/Make_cyg.mak | 77 --------------------------------------- src/GvimExt/Make_ming.mak | 2 +- src/version.c | 2 + src/xxd/Make_cyg.mak | 28 -------------- src/xxd/Make_ming.mak | 2 +- 5 files changed, 4 insertions(+), 107 deletions(-) delete mode 100644 src/GvimExt/Make_cyg.mak delete mode 100644 src/xxd/Make_cyg.mak diff --git a/src/GvimExt/Make_cyg.mak b/src/GvimExt/Make_cyg.mak deleted file mode 100644 index a638688b7a..0000000000 --- a/src/GvimExt/Make_cyg.mak +++ /dev/null @@ -1,77 +0,0 @@ -# Project: gvimext -# Generates gvimext.dll with gcc. -# To be used with Cygwin. -# -# Originally, the DLL base address was fixed: -Wl,--image-base=0x1C000000 -# Now it is allocated dymanically by the linker by evaluating all DLLs -# already loaded in memory. The binary image contains as well information -# for automatic pseudo-rebasing, if needed by the system. ALV 2004-02-29 - -# If cross-compiling set this to yes, else set it to no -CROSS = no -#CROSS = yes -# For the old MinGW 2.95 (the one you get e.g. with debian woody) -# set the following variable to yes and check if the executables are -# really named that way. -# If you have a newer MinGW or you are using cygwin set it to no and -# check also the executables -MINGWOLD = no - -# Link against the shared versions of libgcc/libstdc++ by default. Set -# STATIC_STDCPLUS to "yes" to link against static versions instead. -STATIC_STDCPLUS=no -#STATIC_STDCPLUS=yes - -# Note: -static-libstdc++ is not available until gcc 4.5.x. -LDFLAGS += -shared -ifeq (yes, $(STATIC_STDCPLUS)) -LDFLAGS += -static-libgcc -static-libstdc++ -endif - -ifeq ($(CROSS),yes) -DEL = rm -ifeq ($(MINGWOLD),yes) -CXXFLAGS := -O2 -fvtable-thunks -else -CXXFLAGS := -O2 -endif -else -CXXFLAGS := -O2 -ifneq (sh.exe, $(SHELL)) -DEL = rm -else -DEL = del -endif -endif -CXX := $(CROSS_COMPILE)g++ -WINDRES := $(CROSS_COMPILE)windres -WINDRES_CXX = $(CXX) -WINDRES_FLAGS = --preprocessor="$(WINDRES_CXX) -E -xc" -DRC_INVOKED -LIBS := -luuid -RES := gvimext.res -DEFFILE = gvimext_ming.def -OBJ := gvimext.o - -DLL := gvimext.dll - -.PHONY: all all-before all-after clean clean-custom - -all: all-before $(DLL) all-after - -$(DLL): $(OBJ) $(RES) $(DEFFILE) - $(CXX) $(LDFLAGS) $(CXXFLAGS) -s -o $@ \ - -Wl,--enable-auto-image-base \ - -Wl,--enable-auto-import \ - -Wl,--whole-archive \ - $^ \ - -Wl,--no-whole-archive \ - $(LIBS) - -gvimext.o: gvimext.cpp - $(CXX) $(CXXFLAGS) -DFEAT_GETTEXT -c $? -o $@ - -$(RES): gvimext_ming.rc - $(WINDRES) $(WINDRES_FLAGS) --input-format=rc --output-format=coff -DMING $? -o $@ - -clean: clean-custom - -$(DEL) $(OBJ) $(RES) $(DLL) diff --git a/src/GvimExt/Make_ming.mak b/src/GvimExt/Make_ming.mak index d1d060bfac..2976ea05cf 100644 --- a/src/GvimExt/Make_ming.mak +++ b/src/GvimExt/Make_ming.mak @@ -1,6 +1,6 @@ # Project: gvimext # Generates gvimext.dll with gcc. -# To be used with MingW. +# To be used with MingW and Cygwin. # # Originally, the DLL base address was fixed: -Wl,--image-base=0x1C000000 # Now it is allocated dymanically by the linker by evaluating all DLLs diff --git a/src/version.c b/src/version.c index ab4e51f899..5fdc45733b 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1100, /**/ 1099, /**/ diff --git a/src/xxd/Make_cyg.mak b/src/xxd/Make_cyg.mak deleted file mode 100644 index 4f344f0383..0000000000 --- a/src/xxd/Make_cyg.mak +++ /dev/null @@ -1,28 +0,0 @@ -# The most simplistic Makefile, for Cygnus gcc on MS-DOS - -ifndef USEDLL -USEDLL = no -endif - -ifeq (yes, $(USEDLL)) -DEFINES = -LIBS = -lc -else -DEFINES = -LIBS = -endif - -CC = gcc -CFLAGS = -O2 -Wall -DWIN32 $(DEFINES) - -ifneq (sh.exe, $(SHELL)) -DEL = rm -else -DEL = del -endif - -xxd.exe: xxd.c - $(CC) $(CFLAGS) -s -o xxd.exe xxd.c $(LIBS) - -clean: - -$(DEL) xxd.exe diff --git a/src/xxd/Make_ming.mak b/src/xxd/Make_ming.mak index 5147e89c15..2d32261314 100644 --- a/src/xxd/Make_ming.mak +++ b/src/xxd/Make_ming.mak @@ -1,4 +1,4 @@ -# The most simplistic Makefile, for MinGW gcc on MS-DOS +# The most simplistic Makefile, for MinGW and Cygwin gcc on MS-DOS ifndef USEDLL USEDLL = no From e39b3d9fb4e4006684c33847d1ef6a0d742699dd Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 15 Jan 2016 22:52:22 +0100 Subject: [PATCH 13/18] patch 7.4.1101 Problem: With 'rightleft' and concealing the cursor may move to the wrong position. Solution: Compute the column differently when 'rightleft' is set. (Hirohito Higashi) --- src/screen.c | 7 ++++++- src/version.c | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/screen.c b/src/screen.c index 5610d8a963..d34c4b2f20 100644 --- a/src/screen.c +++ b/src/screen.c @@ -4976,7 +4976,12 @@ win_line(wp, lnum, startrow, endrow, nochange) && conceal_cursor_line(wp) && (int)wp->w_virtcol <= vcol + n_skip) { - wp->w_wcol = col - boguscols; +# ifdef FEAT_RIGHTLEFT + if (wp->w_p_rl) + wp->w_wcol = W_WIDTH(wp) - col + boguscols - 1; + else +# endif + wp->w_wcol = col - boguscols; wp->w_wrow = row; did_wcol = TRUE; } diff --git a/src/version.c b/src/version.c index 5fdc45733b..1abb93e0f9 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1101, /**/ 1100, /**/ From f1f60f859cdbb2638b3662ccf7b1d179865fe7dc Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 16 Jan 2016 15:40:53 +0100 Subject: [PATCH 14/18] patch 7.4.1102 Problem: Debugger has no stack backtrace support. Solution: Add "backtrace", "frame", "up" and "down" commands. (Alberto Fanjul, closes #433) --- runtime/doc/repeat.txt | 32 ++++++++- src/eval.c | 33 ++++++++- src/ex_cmds2.c | 150 ++++++++++++++++++++++++++++++++++++++- src/globals.h | 1 + src/testdir/Make_all.mak | 1 + src/testdir/test108.in | 87 +++++++++++++++++++++++ src/testdir/test108.ok | 84 ++++++++++++++++++++++ src/version.c | 2 + 8 files changed, 382 insertions(+), 8 deletions(-) create mode 100644 src/testdir/test108.in create mode 100644 src/testdir/test108.ok diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index 50431d352a..b3132a9002 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -1,4 +1,4 @@ -*repeat.txt* For Vim version 7.4. Last change: 2015 Apr 13 +*repeat.txt* For Vim version 7.4. Last change: 2016 Jan 16 VIM REFERENCE MANUAL by Bram Moolenaar @@ -483,16 +483,44 @@ Additionally, these commands can be used: finish Finish the current script or user function and come back to debug mode for the command after the one that sourced or called it. + *>bt* + *>backtrace* + *>where* + backtrace Show the call stacktrace for current debugging session. + bt + where + *>frame* + frame N Goes to N bactrace level. + and - signs make movement + relative. E.g., ":frame +3" goes three frames up. + *>up* + up Goes one level up from call stacktrace. + *>down* + down Goes one level down from call stacktrace. About the additional commands in debug mode: - There is no command-line completion for them, you get the completion for the normal Ex commands only. -- You can shorten them, up to a single character: "c", "n", "s" and "f". +- You can shorten them, up to a single character, unless more then one command + starts with the same letter. "f" stands for "finish", use "fr" for "frame". - Hitting will repeat the previous one. When doing another command, this is reset (because it's not clear what you want to repeat). - When you want to use the Ex command with the same name, prepend a colon: ":cont", ":next", ":finish" (or shorter). +The backtrace shows the hierarchy of function calls, e.g.: + >bt ~ + 3 function One[3] ~ + 2 Two[3] ~ + ->1 Three[3] ~ + 0 Four ~ + line 1: let four = 4 ~ + +The "->" points to the current frame. Use "up", "down" and "frame N" to +select another frame. + +In the current frame you can evaluate the local function variables. There is +no way to see the command at the current line yet. + DEFINING BREAKPOINTS *:breaka* *:breakadd* diff --git a/src/eval.c b/src/eval.c index e97ddc4781..1e2a0419e6 100644 --- a/src/eval.c +++ b/src/eval.c @@ -812,6 +812,7 @@ static char_u *get_tv_string_buf_chk __ARGS((typval_T *varp, char_u *buf)); static dictitem_T *find_var __ARGS((char_u *name, hashtab_T **htp, int no_autoload)); static dictitem_T *find_var_in_ht __ARGS((hashtab_T *ht, int htname, char_u *varname, int no_autoload)); static hashtab_T *find_var_ht __ARGS((char_u *name, char_u **varname)); +static funccall_T *get_funccal __ARGS((void)); static void vars_clear_ext __ARGS((hashtab_T *ht, int free_val)); static void delete_var __ARGS((hashtab_T *ht, hashitem_T *hi)); static void list_one_var __ARGS((dictitem_T *v, char_u *prefix, int *first)); @@ -21735,7 +21736,7 @@ find_var_ht(name, varname) if (current_funccal == NULL) return &globvarht; /* global variable */ - return ¤t_funccal->l_vars.dv_hashtab; /* l: variable */ + return &get_funccal()->l_vars.dv_hashtab; /* l: variable */ } *varname = name + 2; if (*name == 'g') /* global variable */ @@ -21756,15 +21757,41 @@ find_var_ht(name, varname) if (*name == 'v') /* v: variable */ return &vimvarht; if (*name == 'a' && current_funccal != NULL) /* function argument */ - return ¤t_funccal->l_avars.dv_hashtab; + return &get_funccal()->l_avars.dv_hashtab; if (*name == 'l' && current_funccal != NULL) /* local function variable */ - return ¤t_funccal->l_vars.dv_hashtab; + return &get_funccal()->l_vars.dv_hashtab; if (*name == 's' /* script variable */ && current_SID > 0 && current_SID <= ga_scripts.ga_len) return &SCRIPT_VARS(current_SID); return NULL; } +/* + * Get function call environment based on bactrace debug level + */ + static funccall_T * +get_funccal() +{ + int i; + funccall_T *funccal; + funccall_T *temp_funccal; + + funccal = current_funccal; + if (debug_backtrace_level > 0) + { + for (i = 0; i < debug_backtrace_level; i++) + { + temp_funccal = funccal->caller; + if (temp_funccal) + funccal = temp_funccal; + else + /* backtrace level overflow. reset to max */ + debug_backtrace_level = i; + } + } + return funccal; +} + /* * Get the string value of a (global/local) variable. * Note: see get_tv_string() for how long the pointer remains valid. diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 05baa7e99e..676cf117b4 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -68,6 +68,10 @@ typedef struct sn_prl_S #if defined(FEAT_EVAL) || defined(PROTO) static int debug_greedy = FALSE; /* batch mode debugging: don't save and restore typeahead. */ +static int get_maxbacktrace_level(void); +static void do_setdebugtracelevel(char_u *arg); +static void do_checkbacktracelevel(void); +static void do_showbacktrace(char_u *cmd); /* * do_debug(): Debug mode. @@ -101,6 +105,10 @@ do_debug(cmd) #define CMD_FINISH 4 #define CMD_QUIT 5 #define CMD_INTERRUPT 6 +#define CMD_BACKTRACE 7 +#define CMD_FRAME 8 +#define CMD_UP 9 +#define CMD_DOWN 10 #ifdef ALWAYS_USE_GUI /* Can't do this when there is no terminal for input/output. */ @@ -178,6 +186,7 @@ do_debug(cmd) # endif cmdline_row = msg_row; + msg_starthere(); if (cmdline != NULL) { /* If this is a debug command, set "last_cmd". @@ -197,8 +206,18 @@ do_debug(cmd) case 's': last_cmd = CMD_STEP; tail = "tep"; break; - case 'f': last_cmd = CMD_FINISH; - tail = "inish"; + case 'f': + last_cmd = 0; + if (p[1] == 'r') + { + last_cmd = CMD_FRAME; + tail = "rame"; + } + else + { + last_cmd = CMD_FINISH; + tail = "inish"; + } break; case 'q': last_cmd = CMD_QUIT; tail = "uit"; @@ -206,6 +225,21 @@ do_debug(cmd) case 'i': last_cmd = CMD_INTERRUPT; tail = "nterrupt"; break; + case 'b': last_cmd = CMD_BACKTRACE; + if (p[1] == 't') + tail = "t"; + else + tail = "acktrace"; + break; + case 'w': last_cmd = CMD_BACKTRACE; + tail = "here"; + break; + case 'u': last_cmd = CMD_UP; + tail = "p"; + break; + case 'd': last_cmd = CMD_DOWN; + tail = "own"; + break; default: last_cmd = 0; } if (last_cmd != 0) @@ -217,7 +251,7 @@ do_debug(cmd) ++p; ++tail; } - if (ASCII_ISALPHA(*p)) + if (ASCII_ISALPHA(*p) && last_cmd != CMD_FRAME) last_cmd = 0; } } @@ -250,7 +284,31 @@ do_debug(cmd) /* Do not repeat ">interrupt" cmd, continue stepping. */ last_cmd = CMD_STEP; break; + case CMD_BACKTRACE: + do_showbacktrace(cmd); + continue; + case CMD_FRAME: + if (*p == NUL) + { + do_showbacktrace(cmd); + } + else + { + p = skipwhite(p); + do_setdebugtracelevel(p); + } + continue; + case CMD_UP: + debug_backtrace_level++; + do_checkbacktracelevel(); + continue; + case CMD_DOWN: + debug_backtrace_level--; + do_checkbacktracelevel(); + continue; } + /* Going out reset backtrace_level */ + debug_backtrace_level = 0; break; } @@ -285,6 +343,92 @@ do_debug(cmd) debug_did_msg = TRUE; } + static int +get_maxbacktrace_level(void) +{ + char *p, *q; + int maxbacktrace = 1; + + maxbacktrace = 0; + if (sourcing_name != NULL) + { + p = (char *)sourcing_name; + while ((q = strstr(p, "..")) != NULL) + { + p = q + 2; + maxbacktrace++; + } + } + return maxbacktrace; +} + + static void +do_setdebugtracelevel(char_u *arg) +{ + int level; + + level = atoi((char *)arg); + if (*arg == '+' || level < 0) + debug_backtrace_level += level; + else + debug_backtrace_level = level; + + do_checkbacktracelevel(); +} + + static void +do_checkbacktracelevel(void) +{ + if (debug_backtrace_level < 0) + { + debug_backtrace_level = 0; + MSG(_("frame is zero")); + } + else + { + int max = get_maxbacktrace_level(); + + if (debug_backtrace_level > max) + { + debug_backtrace_level = max; + smsg((char_u *)_("frame at highest level: %d"), max); + } + } +} + + static void +do_showbacktrace(char_u *cmd) +{ + char *cur; + char *next; + int i = 0; + int max = get_maxbacktrace_level(); + + if (sourcing_name != NULL) + { + cur = (char *)sourcing_name; + while (!got_int) + { + next = strstr(cur, ".."); + if (next != NULL) + *next = NUL; + if (i == max - debug_backtrace_level) + smsg((char_u *)"->%d %s", max - i, cur); + else + smsg((char_u *)" %d %s", max - i, cur); + ++i; + if (next == NULL) + break; + *next = '.'; + cur = next + 2; + } + } + if (sourcing_lnum != 0) + smsg((char_u *)_("line %ld: %s"), (long)sourcing_lnum, cmd); + else + smsg((char_u *)_("cmd: %s"), cmd); +} + /* * ":debug". */ diff --git a/src/globals.h b/src/globals.h index 0931466e94..d6abc67eda 100644 --- a/src/globals.h +++ b/src/globals.h @@ -231,6 +231,7 @@ EXTERN int ex_nesting_level INIT(= 0); /* nesting level */ EXTERN int debug_break_level INIT(= -1); /* break below this level */ EXTERN int debug_did_msg INIT(= FALSE); /* did "debug mode" message */ EXTERN int debug_tick INIT(= 0); /* breakpoint change count */ +EXTERN int debug_backtrace_level INIT(= 0); /* breakpoint backtrace level */ # ifdef FEAT_PROFILE EXTERN int do_profiling INIT(= PROF_NONE); /* PROF_ values */ # endif diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index 6af9b84b04..33fc3451b7 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -89,6 +89,7 @@ SCRIPTS_ALL = \ test105.out \ test106.out \ test107.out \ + test108.out \ test_argument_0count.out \ test_argument_count.out \ test_autocmd_option.out \ diff --git a/src/testdir/test108.in b/src/testdir/test108.in new file mode 100644 index 0000000000..b442cf7fcf --- /dev/null +++ b/src/testdir/test108.in @@ -0,0 +1,87 @@ +Tests for backtrace debug commands. vim: set ft=vim : + +STARTTEST +:so small.vim +:function! Foo() +: let var1 = 1 +: let var2 = Bar(var1) + 9 +: return var2 +:endfunction +: +:function! Bar(var) +: let var1 = 2 + a:var +: let var2 = Bazz(var1) + 4 +: return var2 +:endfunction +: +:function! Bazz(var) +: let var1 = 3 + a:var +: let var3 = "another var" +: return var1 +:endfunction +:new +:debuggreedy +:redir => out +:debug echo Foo() +step +step +step +step +step +step +echo "- show backtrace:\n" +backtrace +echo "\nshow variables on different levels:\n" +echo var1 +up +back +echo var1 +u +bt +echo var1 +echo "\n- undefined vars:\n" +step +frame 2 +echo "undefined var3 on former level:" +echo var3 +fr 0 +echo "here var3 is defined with \"another var\":" +echo var3 +step +step +step +up +echo "\nundefined var2 on former level" +echo var2 +down +echo "here var2 is defined with 10:" +echo var2 +echo "\n- backtrace movements:\n" +b +echo "\nnext command cannot go down, we are on bottom\n" +down +up +echo "\nnext command cannot go up, we are on top\n" +up +b +echo "fil is not frame or finish, it is file" +fil +echo "\n- relative backtrace movement\n" +fr -1 +frame +fra +1 +fram +echo "\n- go beyond limits does not crash\n" +fr 100 +fra +frame -40 +fram +echo "\n- final result 19:" +cont +:0debuggreedy +:redir END +:$put =out +:w! test.out +:qa! +ENDTEST + diff --git a/src/testdir/test108.ok b/src/testdir/test108.ok new file mode 100644 index 0000000000..6315edcc21 --- /dev/null +++ b/src/testdir/test108.ok @@ -0,0 +1,84 @@ + + + +- show backtrace: + + 2 function Foo[2] + 1 Bar[2] +->0 Bazz +line 2: let var3 = "another var" + +show variables on different levels: + +6 + 2 function Foo[2] +->1 Bar[2] + 0 Bazz +line 2: let var3 = "another var" +3 +->2 function Foo[2] + 1 Bar[2] + 0 Bazz +line 2: let var3 = "another var" +1 + +- undefined vars: + +undefined var3 on former level: +Error detected while processing function Foo[2]..Bar[2]..Bazz: +line 3: +E121: Undefined variable: var3 +E15: Invalid expression: var3 +here var3 is defined with "another var": +another var + +undefined var2 on former level +Error detected while processing function Foo[2]..Bar: +line 3: +E121: Undefined variable: var2 +E15: Invalid expression: var2 +here var2 is defined with 10: +10 + +- backtrace movements: + + 1 function Foo[2] +->0 Bar +line 3: End of function + +next command cannot go down, we are on bottom + +frame is zero + +next command cannot go up, we are on top + +frame at highest level: 1 +->1 function Foo[2] + 0 Bar +line 3: End of function +fil is not frame or finish, it is file +"[No Name]" --No lines in buffer-- + +- relative backtrace movement + + 1 function Foo[2] +->0 Bar +line 3: End of function +->1 function Foo[2] + 0 Bar +line 3: End of function + +- go beyond limits does not crash + +frame at highest level: 1 +->1 function Foo[2] + 0 Bar +line 3: End of function +frame is zero + 1 function Foo[2] +->0 Bar +line 3: End of function + +- final result 19: +19 + diff --git a/src/version.c b/src/version.c index 1abb93e0f9..947d3c8749 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1102, /**/ 1101, /**/ From d125001297ac76e0ed4759a9320ffb7872cf6242 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 16 Jan 2016 15:45:15 +0100 Subject: [PATCH 15/18] patch 7.4.1103 Problem: Removed file still in distribution. Solution: Remove Make_cyg.mak from the list of files. --- Filelist | 1 - src/version.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Filelist b/Filelist index a1ed826d25..34ff0bd26c 100644 --- a/Filelist +++ b/Filelist @@ -351,7 +351,6 @@ SRC_DOS = \ src/xpm_w32.h \ src/xxd/Make_bc3.mak \ src/xxd/Make_bc5.mak \ - src/xxd/Make_cyg.mak \ src/xxd/Make_djg.mak \ src/xxd/Make_ming.mak \ src/xxd/Make_mvc.mak \ diff --git a/src/version.c b/src/version.c index 947d3c8749..72c4497fb0 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1103, /**/ 1102, /**/ From 4e640bd930d133889dbc9f9a77e29bab902e3b7d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 16 Jan 2016 16:20:38 +0100 Subject: [PATCH 16/18] patch 7.4.1104 Problem: Various problems building with MzScheme/Racket. Solution: Make it work with new versions of Racket. (Yukihiro Nakadaira, Ken Takata) --- runtime/doc/if_mzsch.txt | 23 +++ src/INSTALLpc.txt | 73 ++++++-- src/Make_cyg_ming.mak | 36 +++- src/Make_mvc.mak | 57 +++--- src/auto/configure | 187 +++++++++++++------- src/configure.in | 168 +++++++++++------- src/if_mzsch.c | 374 +++++++++++++++++++++++++++------------ src/version.c | 2 + 8 files changed, 641 insertions(+), 279 deletions(-) diff --git a/runtime/doc/if_mzsch.txt b/runtime/doc/if_mzsch.txt index b42570a75a..f1a0bd7aa5 100644 --- a/runtime/doc/if_mzsch.txt +++ b/runtime/doc/if_mzsch.txt @@ -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: diff --git a/src/INSTALLpc.txt b/src/INSTALLpc.txt index 3777784d14..071ede44a2 100644 --- a/src/INSTALLpc.txt +++ b/src/INSTALLpc.txt @@ -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 ) @@ -451,31 +453,75 @@ 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 + 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. - LUA_VER: Lua version. E.g. 53 for Lua 5.3.X. +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 diff --git a/src/Make_cyg_ming.mak b/src/Make_cyg_ming.mak index d89ba29594..79628a823c 100644 --- a/src/Make_cyg_ming.mak +++ b/src/Make_cyg_ming.mak @@ -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 diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index 6f0b84391c..df5a748ce9 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -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 \ - -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" \ - -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\" +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 diff --git a/src/auto/configure b/src/auto/configure index e07d7ecf38..ed8ca6aa95 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -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,54 +5287,63 @@ $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 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 - SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { $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: no" >&5 -$as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt" >&5 -$as_echo_n "checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt... " >&6; } - if test -f "$vi_cv_path_mzscheme_pfx/include/plt/scheme.h"; then + { $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 + SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket" >&5 -$as_echo_n "checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket... " >&6; } - if test -f "$vi_cv_path_mzscheme_pfx/include/racket/scheme.h"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt" >&5 +$as_echo_n "checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt... " >&6; } + if test -f "$vi_cv_path_mzscheme_pfx/include/plt/scheme.h"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/racket + SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in /usr/include/plt/" >&5 -$as_echo_n "checking if scheme.h can be found in /usr/include/plt/... " >&6; } - if test -f /usr/include/plt/scheme.h; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket" >&5 +$as_echo_n "checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket... " >&6; } + if test -f "$vi_cv_path_mzscheme_pfx/include/racket/scheme.h"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - SCHEME_INC=/usr/include/plt + SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/racket else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in /usr/include/racket/" >&5 -$as_echo_n "checking if scheme.h can be found in /usr/include/racket/... " >&6; } - if test -f /usr/include/racket/scheme.h; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in /usr/include/plt/" >&5 +$as_echo_n "checking if scheme.h can be found in /usr/include/plt/... " >&6; } + if test -f /usr/include/plt/scheme.h; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - SCHEME_INC=/usr/include/racket + SCHEME_INC=/usr/include/plt else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - vi_cv_path_mzscheme_pfx= + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in /usr/include/racket/" >&5 +$as_echo_n "checking if scheme.h can be found in /usr/include/racket/... " >&6; } + if test -f /usr/include/racket/scheme.h; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SCHEME_INC=/usr/include/racket + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + vi_cv_path_mzscheme_pfx= + fi fi fi fi @@ -5341,52 +5352,101 @@ $as_echo "no" >&6; } fi if test "X$vi_cv_path_mzscheme_pfx" != "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" - 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" - 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" + + { $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 - if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.so"; then - MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -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" - 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" - else - MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc" + { $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 "${path}/libmzscheme3m.a"; then + MZSCHEME_LIBS="${path}/libmzscheme3m.a" + MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" + elif test -f "${path}/libracket3m.a"; then + MZSCHEME_LIBS="${path}/libracket3m.a" + MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" + 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 "${path}/libmzscheme3m.so"; then + MZSCHEME_LIBS="-L${path} -lmzscheme3m" + MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" + elif test -f "${path}/libracket3m.so"; then + MZSCHEME_LIBS="-L${path} -lracket3m" + MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" + elif test -f "${path}/libracket.so"; then + MZSCHEME_LIBS="-L${path} -lracket -lmzgc" + else + 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,${path}" + elif test "`(uname) 2>/dev/null`" = SunOS && + uname -r | grep '^5' >/dev/null; then + MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${path}" + fi + fi fi - if test "$GCC" = yes; then - MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${vi_cv_path_mzscheme_pfx}/lib" - 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" + 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; } - if test -d "$vi_cv_path_mzscheme_pfx/lib/plt/collects"; then - SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/plt/ - else - if test -d "$vi_cv_path_mzscheme_pfx/lib/racket/collects"; then - SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/racket/ + 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 - if test -d "$vi_cv_path_mzscheme_pfx/share/racket/collects"; then - SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/share/racket/ + if test -d "$vi_cv_path_mzscheme_pfx/lib/racket/collects"; then + SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/racket/ else - if test -d "$vi_cv_path_mzscheme_pfx/collects"; then - SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/ + 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 @@ -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 diff --git a/src/configure.in b/src/configure.in index 6048e8f9c0..adb30c4299 100644 --- a/src/configure.in +++ b/src/configure.in @@ -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,39 +733,45 @@ if test "$enable_mzschemeinterp" = "yes"; then fi fi - SCHEME_INC= if test "X$vi_cv_path_mzscheme_pfx" != "X"; then - 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 - AC_MSG_RESULT(yes) + 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(no) - AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt) - if test -f "$vi_cv_path_mzscheme_pfx/include/plt/scheme.h"; then + 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 AC_MSG_RESULT(yes) - SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt else AC_MSG_RESULT(no) - AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket) - if test -f "$vi_cv_path_mzscheme_pfx/include/racket/scheme.h"; then + AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt) + if test -f "$vi_cv_path_mzscheme_pfx/include/plt/scheme.h"; then AC_MSG_RESULT(yes) - SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/racket + SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt else AC_MSG_RESULT(no) - AC_MSG_CHECKING(if scheme.h can be found in /usr/include/plt/) - if test -f /usr/include/plt/scheme.h; then + AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket) + if test -f "$vi_cv_path_mzscheme_pfx/include/racket/scheme.h"; then AC_MSG_RESULT(yes) - SCHEME_INC=/usr/include/plt + SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/racket else AC_MSG_RESULT(no) - AC_MSG_CHECKING(if scheme.h can be found in /usr/include/racket/) - if test -f /usr/include/racket/scheme.h; then + AC_MSG_CHECKING(if scheme.h can be found in /usr/include/plt/) + if test -f /usr/include/plt/scheme.h; then AC_MSG_RESULT(yes) - SCHEME_INC=/usr/include/racket + SCHEME_INC=/usr/include/plt else AC_MSG_RESULT(no) - vi_cv_path_mzscheme_pfx= + AC_MSG_CHECKING(if scheme.h can be found in /usr/include/racket/) + if test -f /usr/include/racket/scheme.h; then + AC_MSG_RESULT(yes) + SCHEME_INC=/usr/include/racket + else + AC_MSG_RESULT(no) + vi_cv_path_mzscheme_pfx= + fi fi fi fi @@ -772,54 +780,95 @@ if test "$enable_mzschemeinterp" = "yes"; then fi if test "X$vi_cv_path_mzscheme_pfx" != "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" - 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" - 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" + + 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 - 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" - 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" - 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" - else - MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc" + 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 "${path}/libmzscheme3m.a"; then + MZSCHEME_LIBS="${path}/libmzscheme3m.a" + MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" + elif test -f "${path}/libracket3m.a"; then + MZSCHEME_LIBS="${path}/libracket3m.a" + MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" + 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 "${path}/libmzscheme3m.so"; then + MZSCHEME_LIBS="-L${path} -lmzscheme3m" + MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" + elif test -f "${path}/libracket3m.so"; then + MZSCHEME_LIBS="-L${path} -lracket3m" + MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" + elif test -f "${path}/libracket.so"; then + MZSCHEME_LIBS="-L${path} -lracket -lmzgc" + else + 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,${path}" + elif test "`(uname) 2>/dev/null`" = SunOS && + uname -r | grep '^5' >/dev/null; then + MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${path}" + fi + fi 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" - 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" + 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) - if test -d "$vi_cv_path_mzscheme_pfx/lib/plt/collects"; then - SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/plt/ - else - if test -d "$vi_cv_path_mzscheme_pfx/lib/racket/collects"; then - SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/racket/ + 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 - if test -d "$vi_cv_path_mzscheme_pfx/share/racket/collects"; then - SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/share/racket/ + if test -d "$vi_cv_path_mzscheme_pfx/lib/racket/collects"; then + SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/racket/ else - if test -d "$vi_cv_path_mzscheme_pfx/collects"; then - SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/ + 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 @@ -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) diff --git a/src/if_mzsch.c b/src/if_mzsch.c index 287ab1a1c3..ea04705459 100644 --- a/src/if_mzsch.c +++ b/src/if_mzsch.c @@ -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 */ -# define scheme_current_thread (*dll_scheme_current_thread_ptr) +#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_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(); - } + /* invoke function from generated and included mzscheme_base.c */ + declare_modules(environment); #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; + 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); - 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(); - } -# else - { - 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); - 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(); - } + /* workaround for dynamic loading on windows */ + s = vim_getenv("PLTCOLLECTS", &mustfree); + if (s != NULL) + { + coll_path = scheme_make_path(s); + MZ_GC_CHECK(); + if (mustfree) + vim_free(s); + } +# ifdef MZSCHEME_COLLECTS + if (coll_path == NULL) + { + coll_path = scheme_make_path(MZSCHEME_COLLECTS); + MZ_GC_CHECK(); + } # 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; } { diff --git a/src/version.c b/src/version.c index 72c4497fb0..baecfc7d00 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1104, /**/ 1103, /**/ From 9bbf63dbf8286fadc0cd6b3428010abb67b1b64d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 16 Jan 2016 16:49:28 +0100 Subject: [PATCH 17/18] patch 7.4.1105 Problem: When using slices there is a mixup of variable name and namespace. Solution: Recognize variables that can't be a namespace. (Hirohito Higashi) --- src/eval.c | 24 +++++++++++++++++++++++- src/testdir/test_eval.in | 18 ++++++++++++++++++ src/testdir/test_eval.ok | Bin 11246 -> 11279 bytes src/version.c | 2 ++ 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/eval.c b/src/eval.c index 1e2a0419e6..d4e3b9ef59 100644 --- a/src/eval.c +++ b/src/eval.c @@ -115,6 +115,8 @@ static char *e_illvar = N_("E461: Illegal variable name: %s"); static char *e_float_as_string = N_("E806: using Float as a String"); #endif +#define NAMESPACE_CHAR (char_u *)"abglstvw" + static dictitem_T globvars_var; /* variable used for g: */ #define globvarht globvardict.dv_hashtab @@ -20666,7 +20668,17 @@ get_id_len(arg) /* Find the end of the name. */ for (p = *arg; eval_isnamec(*p); ++p) - ; + { + if (*p == ':') + { + /* "s:" is start of "s:var", but "n:" is not and can be used in + * slice "[n:]". Also "xx:" is not a namespace. */ + len = (int)(p - *arg); + if ((len == 1 && vim_strchr(NAMESPACE_CHAR, **arg) == NULL) + || len > 1) + break; + } + } if (p == *arg) /* no name found */ return 0; @@ -20766,6 +20778,7 @@ find_name_end(arg, expr_start, expr_end, flags) int mb_nest = 0; int br_nest = 0; char_u *p; + int len; if (expr_start != NULL) { @@ -20801,6 +20814,15 @@ find_name_end(arg, expr_start, expr_end, flags) if (*p == NUL) break; } + else if (br_nest == 0 && mb_nest == 0 && *p == ':') + { + /* "s:" is start of "s:var", but "n:" is not and can be used in + * slice "[n:]". Also "xx:" is not a namespace. */ + len = (int)(p - arg); + if ((len == 1 && vim_strchr(NAMESPACE_CHAR, *arg) == NULL) + || len > 1) + break; + } if (mb_nest == 0) { diff --git a/src/testdir/test_eval.in b/src/testdir/test_eval.in index 087e6099ac..84f26bafc1 100644 --- a/src/testdir/test_eval.in +++ b/src/testdir/test_eval.in @@ -218,6 +218,24 @@ endfun 0:call setpos('.', sp) jyl:$put :" +:" substring and variable name +:let str = 'abcdef' +:let n = 3 +:$put =str[n:] +:$put =str[:n] +:$put =str[n:n] +:unlet n +:let nn = 3 +:$put =str[nn:] +:$put =str[:nn] +:$put =str[nn:nn] +:unlet nn +:let b:nn = 4 +:$put =str[b:nn:] +:$put =str[:b:nn] +:$put =str[b:nn:b:nn] +:unlet b:nn +:" :/^start:/+1,$wq! test.out :" vim: et ts=4 isk-=\: fmr=???,??? :call getchar() diff --git a/src/testdir/test_eval.ok b/src/testdir/test_eval.ok index cda425c92e30762a9c5949964be411a517884f0d..9ffa54157fabaf710b0af4f13d191292d206e785 100644 GIT binary patch delta 41 hcmaDC-XF2yowj01Y8qE!QgR9x5F(gRRw`F27XU`c4axuj delta 7 OcmeB=co)9moi+dv83XnJ diff --git a/src/version.c b/src/version.c index baecfc7d00..f74281d797 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1105, /**/ 1104, /**/ From 286eacd3f6631e985089176fb1dff1bcf1a1d6b5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 16 Jan 2016 18:05:50 +0100 Subject: [PATCH 18/18] patch 7.4.1106 Problem: The nsis script can't be used from the appveyor build. Solution: Add "ifndef" to allow for variables to be set from the command line. Remove duplicate SetCompressor command. Support using other gettext binaries. (Ken Takata) Update build instructions to use libintl-8.dll. --- Makefile | 6 +++++- nsis/gvim.nsi | 22 ++++++++++++++-------- src/main.c | 2 +- src/os_w32exe.c | 2 +- src/os_win32.c | 7 +++++-- src/proto/os_win32.pro | 2 +- src/version.c | 2 ++ 7 files changed, 29 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 710e59f525..8e54a32bdf 100644 --- a/Makefile +++ b/Makefile @@ -131,6 +131,9 @@ MINOR = 4 # # MS-Windows: # - Run make on Unix to update the ".mo" files. +# - Get libintl-8.dll and libiconv-2.dll. E.g. from +# https://mlocati.github.io/gettext-iconv-windows/ . +# Put them in the top directory, "make dosrt" uses them. # - > make dossrc # > make dosrt # Unpack dist/vim##rt.zip and dist/vim##src.zip on an MS-Windows PC. @@ -493,7 +496,8 @@ dosrt_files: dist prepare no_title.vim cp $$i dist/vim/$(VIMRTDIR)/lang/$$n/LC_MESSAGES/vim.mo; \ fi \ done - cp libintl.dll dist/vim/$(VIMRTDIR)/ + cp libintl-8.dll dist/vim/$(VIMRTDIR)/ + cp libiconv-2.dll dist/vim/$(VIMRTDIR)/ # Used before uploading. Don't delete the AAPDIR/sign files! diff --git a/nsis/gvim.nsi b/nsis/gvim.nsi index 7c8d4ba878..0bc9d4c6a6 100644 --- a/nsis/gvim.nsi +++ b/nsis/gvim.nsi @@ -6,13 +6,19 @@ # because uninstall deletes most files in $0. # Location of gvim_ole.exe, vimw32.exe, GvimExt/*, etc. -!define VIMSRC "..\src" +!ifndef VIMSRC + !define VIMSRC "..\src" +!endif # Location of runtime files -!define VIMRT ".." +!ifndef VIMRT + !define VIMRT ".." +!endif # Location of extra tools: diff.exe -!define VIMTOOLS ..\.. +!ifndef VIMTOOLS + !define VIMTOOLS ..\.. +!endif # Comment the next line if you don't have UPX. # Get it at http://upx.sourceforge.net @@ -32,9 +38,10 @@ Name "Vim ${VER_MAJOR}.${VER_MINOR}" OutFile gvim${VER_MAJOR}${VER_MINOR}.exe CRCCheck force -SetCompressor lzma +SetCompressor /SOLID lzma SetDatablockOptimize on RequestExecutionLevel highest +XPStyle on ComponentText "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer." DirText "Choose a directory to install Vim (should contain 'vim')" @@ -55,9 +62,6 @@ LicenseData ${VIMRT}\doc\uganda.nsis.txt !packhdr temp.dat "upx --best --compress-icons=1 temp.dat" !endif -SetCompressor /SOLID lzma -XPStyle on - # This adds '\vim' to the user choice automagically. The actual value is # obtained below with ReadINIStr. InstallDir "$PROGRAMFILES\Vim" @@ -355,7 +359,9 @@ SectionEnd File ${VIMRT}\keymap\README.txt File ${VIMRT}\keymap\*.vim SetOutPath $0 - File ${VIMRT}\libintl.dll + File ${VIMRT}\libintl-8.dll + File ${VIMRT}\libiconv-2.dll + File /nonfatal ${VIMRT}\libwinpthread-1.dll SectionEnd !endif diff --git a/src/main.c b/src/main.c index d7723d2e38..175bbde11c 100644 --- a/src/main.c +++ b/src/main.c @@ -1580,7 +1580,7 @@ init_locale() # ifdef DYNAMIC_GETTEXT /* Initialize the gettext library */ - dyn_libintl_init(NULL); + dyn_libintl_init(); # endif /* expand_env() doesn't work yet, because chartab[] is not initialized * yet, call vim_getenv() directly */ diff --git a/src/os_w32exe.c b/src/os_w32exe.c index 93a13899c2..d8fa2bffcd 100644 --- a/src/os_w32exe.c +++ b/src/os_w32exe.c @@ -69,7 +69,7 @@ WinMain( #ifdef DYNAMIC_GETTEXT /* Initialize gettext library */ - dyn_libintl_init(NULL); + dyn_libintl_init(); #endif #ifdef VIMDLL diff --git a/src/os_win32.c b/src/os_win32.c index 69623f9808..c5b23ca7db 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -463,6 +463,7 @@ vimLoadLib(char *name) #if defined(DYNAMIC_GETTEXT) || defined(PROTO) # ifndef GETTEXT_DLL # define GETTEXT_DLL "libintl.dll" +# define GETTEXT_DLL_ALT "libintl-8.dll" # endif /* Dummy functions */ static char *null_libintl_gettext(const char *); @@ -479,7 +480,7 @@ char *(*dyn_libintl_bind_textdomain_codeset)(const char *, const char *) = null_libintl_bind_textdomain_codeset; int -dyn_libintl_init(char *libname) +dyn_libintl_init() { int i; static struct @@ -498,7 +499,9 @@ dyn_libintl_init(char *libname) if (hLibintlDLL) return 1; /* Load gettext library (libintl.dll) */ - hLibintlDLL = vimLoadLib(libname != NULL ? libname : GETTEXT_DLL); + hLibintlDLL = vimLoadLib(GETTEXT_DLL); + if (!hLibintlDLL) + hLibintlDLL = vimLoadLib(GETTEXT_DLL_ALT); if (!hLibintlDLL) { if (p_verbose > 0) diff --git a/src/proto/os_win32.pro b/src/proto/os_win32.pro index 5816fc91c4..e6fce88a3b 100644 --- a/src/proto/os_win32.pro +++ b/src/proto/os_win32.pro @@ -1,6 +1,6 @@ /* os_win32.c */ HINSTANCE vimLoadLib __ARGS((char *name)); -int dyn_libintl_init __ARGS((char *libname)); +int dyn_libintl_init __ARGS((void)); void dyn_libintl_end __ARGS((void)); void PlatformId __ARGS((void)); int mch_windows95 __ARGS((void)); diff --git a/src/version.c b/src/version.c index f74281d797..efc77c0aa8 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1106, /**/ 1105, /**/