Compare commits

...

10 Commits

Author SHA1 Message Date
Bram Moolenaar
d6e256c31a updated for version 7.3.377
Problem:    No support for bitwise AND, OR, XOR and invert.
Solution:   Add add(), or(), invert() and xor() functions.
2011-12-14 15:32:50 +01:00
Bram Moolenaar
2787ab91b0 updated for version 7.3.376
Problem:    Win32: Toolbar repainting does not work when the mouse pointer
            hovers over a button.
Solution:   Call DefWindowProc() when not hanlding an event. (Sergiu Dotenco)
2011-12-14 15:23:59 +01:00
Bram Moolenaar
68dfcdf725 updated for version 7.3.375
Problem:    Duplicate return statement.
Solution:   Remove the superfluous one. (Dominique Pelle)
2011-12-14 15:07:29 +01:00
Bram Moolenaar
b38e9ab4af updated for version 7.3.374
Problem:    ++encoding does not work properly.
Solution:   Recognize ++encoding before ++enc. (Charles Cooper)
2011-12-14 14:49:45 +01:00
Bram Moolenaar
08fc756582 updated for version 7.3.373
Problem:    A tags file with an extremely long name may cause an infinite loop.
Solution:   When encountering a long name switch to linear search.
2011-12-14 14:15:16 +01:00
Bram Moolenaar
96a8964564 updated for version 7.3.372
Problem:    When using a command line mapping to <Up> with file name
            completion to go one directory up, 'wildchar' is inserted.
            (Yasuhiro Matsumoto)
Solution:   Set the KeyTyped flag.
2011-12-08 18:44:51 +01:00
Bram Moolenaar
b9ba403542 updated for version 7.3.371
Problem:    Crash in autocomplete. (Greg Weber)
Solution:   Check not going over allocated buffer size.
2011-12-08 17:49:35 +01:00
Bram Moolenaar
fa263a517b updated for version 7.3.370
Problem:    Compiler warns for unused variable in Lua interface.
Solution:   Remove the variable.
2011-12-08 16:00:16 +01:00
Bram Moolenaar
f4120a8964 updated for version 7.3.369
Problem:    When compiled with Gnome get an error message when using --help.
Solution:   Don't fork. (Ivan Krasilnikov)
2011-12-08 15:57:59 +01:00
Bram Moolenaar
aeabe0545d updated for version 7.3.368
Problem:    Gcc complains about redefining _FORTIFY_SOURCE.
Solution:   Undefine it before redefining it.
2011-12-08 15:17:34 +01:00
16 changed files with 194 additions and 22 deletions

View File

@@ -801,11 +801,12 @@ expr6 . expr6 .. String concatenation *expr-.*
For |Lists| only "+" is possible and then both expr6 must be a list. The
result is a new list with the two lists Concatenated.
expr7 * expr7 .. number multiplication *expr-star*
expr7 / expr7 .. number division *expr-/*
expr7 % expr7 .. number modulo *expr-%*
expr7 * expr7 .. Number multiplication *expr-star*
expr7 / expr7 .. Number division *expr-/*
expr7 % expr7 .. Number modulo *expr-%*
For all, except ".", Strings are converted to Numbers.
For bitwise operators see |and()|, |or()| and |xor()|.
Note the difference between "+" and ".":
"123" + "456" = 579
@@ -1687,6 +1688,7 @@ USAGE RESULT DESCRIPTION ~
abs( {expr}) Float or Number absolute value of {expr}
acos( {expr}) Float arc cosine of {expr}
add( {list}, {item}) List append {item} to |List| {list}
and( {expr}, {expr}) Number bitwise AND
append( {lnum}, {string}) Number append {string} below line {lnum}
append( {lnum}, {list}) Number append lines {list} below line {lnum}
argc() Number number of files in the argument list
@@ -1825,6 +1827,7 @@ inputrestore() Number restore typeahead
inputsave() Number save and clear typeahead
inputsecret( {prompt} [, {text}]) String like input() but hiding the text
insert( {list}, {item} [, {idx}]) List insert {item} in {list} [before {idx}]
invert( {expr}) Number bitwise invert
isdirectory( {directory}) Number TRUE if {directory} is a directory
islocked( {expr}) Number TRUE if {expr} is locked
items( {dict}) List key-value pairs in {dict}
@@ -1864,6 +1867,7 @@ mode( [expr]) String current editing mode
mzeval( {expr}) any evaluate |MzScheme| expression
nextnonblank( {lnum}) Number line nr of non-blank line >= {lnum}
nr2char( {expr}) String single char with ASCII value {expr}
or( {expr}, {expr}) Number bitwise OR
pathshorten( {expr}) String shorten directory names in a path
pow( {x}, {y}) Float {x} to the power of {y}
prevnonblank( {lnum}) Number line nr of non-blank line <= {lnum}
@@ -1987,6 +1991,7 @@ winsaveview() Dict save view of current window
winwidth( {nr}) Number width of window {nr}
writefile( {list}, {fname} [, {binary}])
Number write list of lines to file {fname}
xor( {expr}, {expr}) Number bitwise XOR
abs({expr}) *abs()*
Return the absolute value of {expr}. When {expr} evaluates to
@@ -2026,6 +2031,13 @@ add({list}, {expr}) *add()*
Use |insert()| to add an item at another position.
and({expr}, {expr}) *and()*
Bitwise AND on the two arguments. The arguments are converted
to a number. A List, Dict or Float argument causes an error.
Example: >
:let flag = and(bits, 0x80)
append({lnum}, {expr}) *append()*
When {expr} is a |List|: Append each item of the |List| as a
text line below line {lnum} in the current buffer.
@@ -3782,6 +3794,11 @@ insert({list}, {item} [, {idx}]) *insert()*
Note that when {item} is a |List| it is inserted as a single
item. Use |extend()| to concatenate |Lists|.
invert({expr}) *invert()*
Bitwise invert. The argument is converted to a number. A
List, Dict or Float argument causes an error. Example: >
:let bits = invert(bits)
isdirectory({directory}) *isdirectory()*
The result is a Number, which is non-zero when a directory
with the name {directory} exists. If {directory} doesn't
@@ -4347,6 +4364,13 @@ getpos({expr}) Get the position for {expr}. For possible values of {expr}
call setpos('.', save_cursor)
< Also see |setpos()|.
or({expr}, {expr}) *or()*
Bitwise OR on the two arguments. The arguments are converted
to a number. A List, Dict or Float argument causes an error.
Example: >
:let bits = or(bits, 0x80)
pathshorten({expr}) *pathshorten()*
Shorten directory names in the path {expr} and return the
result. The tail, the file name, is kept as-is. The other
@@ -6121,7 +6145,15 @@ writefile({list}, {fname} [, {binary}])
To copy a file byte for byte: >
:let fl = readfile("foo", "b")
:call writefile(fl, "foocopy", "b")
<
xor({expr}, {expr}) *xor()*
Bitwise XOR on the two arguments. The arguments are converted
to a number. A List, Dict or Float argument causes an error.
Example: >
:let bits = xor(bits, 0x80)
*feature-list*
There are three types of features:

View File

@@ -561,8 +561,8 @@ CClink = $(CC)
#CFLAGS = -g -O2 '-DSTARTUPTIME="vimstartup"' -fno-strength-reduce -Wall -Wmissing-prototypes
# Use this with GCC to check for mistakes, unused arguments, etc.
#CFLAGS = -g -Wall -Wextra -Wmissing-prototypes -Wunreachable-code -D_FORTIFY_SOURCE=1
#CFLAGS = -g -O2 -Wall -Wextra -Wmissing-prototypes -D_FORTIFY_SOURCE=1 -DU_DEBUG
#CFLAGS = -g -Wall -Wextra -Wmissing-prototypes -Wunreachable-code -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
#CFLAGS = -g -O2 -Wall -Wextra -Wmissing-prototypes -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DU_DEBUG
#PYTHON_CFLAGS_EXTRA = -Wno-missing-field-initializers
#MZSCHEME_CFLAGS_EXTRA = -Wno-unreachable-code -Wno-unused-parameter

4
src/auto/configure vendored
View File

@@ -12483,10 +12483,10 @@ $as_echo "yes" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -D_FORTIFY_SOURCE=1" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -D_FORTIFY_SOURCE=1" >&5
$as_echo_n "checking whether we need -D_FORTIFY_SOURCE=1... " >&6; }
if test "$gccmajor" -gt "3"; then
CFLAGS=`echo "$CFLAGS" | sed -e 's/-Wp,-D_FORTIFY_SOURCE=.//g' -e 's/-D_FORTIFY_SOURCE=.//g' -e 's/$/ -D_FORTIFY_SOURCE=1/'`
CFLAGS=`echo "$CFLAGS" | sed -e 's/-Wp,-D_FORTIFY_SOURCE=.//g' -e 's/-D_FORTIFY_SOURCE=.//g' -e 's/$/ -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1/'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else

View File

@@ -3584,9 +3584,10 @@ if test "$GCC" = yes; then
dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
dnl declared as char x[1] but actually longer. Introduced in gcc 4.0.
dnl Also remove duplicate _FORTIFY_SOURCE arguments.
dnl And undefine it first to avoid a warning.
AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
if test "$gccmajor" -gt "3"; then
CFLAGS=`echo "$CFLAGS" | sed -e 's/-Wp,-D_FORTIFY_SOURCE=.//g' -e 's/-D_FORTIFY_SOURCE=.//g' -e 's/$/ -D_FORTIFY_SOURCE=1/'`
CFLAGS=`echo "$CFLAGS" | sed -e 's/-Wp,-D_FORTIFY_SOURCE=.//g' -e 's/-D_FORTIFY_SOURCE=.//g' -e 's/$/ -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1/'`
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)

View File

@@ -474,6 +474,7 @@ static void f_abs __ARGS((typval_T *argvars, typval_T *rettv));
static void f_acos __ARGS((typval_T *argvars, typval_T *rettv));
#endif
static void f_add __ARGS((typval_T *argvars, typval_T *rettv));
static void f_and __ARGS((typval_T *argvars, typval_T *rettv));
static void f_append __ARGS((typval_T *argvars, typval_T *rettv));
static void f_argc __ARGS((typval_T *argvars, typval_T *rettv));
static void f_argidx __ARGS((typval_T *argvars, typval_T *rettv));
@@ -602,6 +603,7 @@ static void f_inputrestore __ARGS((typval_T *argvars, typval_T *rettv));
static void f_inputsave __ARGS((typval_T *argvars, typval_T *rettv));
static void f_inputsecret __ARGS((typval_T *argvars, typval_T *rettv));
static void f_insert __ARGS((typval_T *argvars, typval_T *rettv));
static void f_invert __ARGS((typval_T *argvars, typval_T *rettv));
static void f_isdirectory __ARGS((typval_T *argvars, typval_T *rettv));
static void f_islocked __ARGS((typval_T *argvars, typval_T *rettv));
static void f_items __ARGS((typval_T *argvars, typval_T *rettv));
@@ -640,6 +642,7 @@ static void f_mzeval __ARGS((typval_T *argvars, typval_T *rettv));
#endif
static void f_nextnonblank __ARGS((typval_T *argvars, typval_T *rettv));
static void f_nr2char __ARGS((typval_T *argvars, typval_T *rettv));
static void f_or __ARGS((typval_T *argvars, typval_T *rettv));
static void f_pathshorten __ARGS((typval_T *argvars, typval_T *rettv));
#ifdef FEAT_FLOAT
static void f_pow __ARGS((typval_T *argvars, typval_T *rettv));
@@ -751,6 +754,7 @@ static void f_winrestview __ARGS((typval_T *argvars, typval_T *rettv));
static void f_winsaveview __ARGS((typval_T *argvars, typval_T *rettv));
static void f_winwidth __ARGS((typval_T *argvars, typval_T *rettv));
static void f_writefile __ARGS((typval_T *argvars, typval_T *rettv));
static void f_xor __ARGS((typval_T *argvars, typval_T *rettv));
static int list2fpos __ARGS((typval_T *arg, pos_T *posp, int *fnump));
static pos_T *var2fpos __ARGS((typval_T *varp, int dollar_lnum, int *fnum));
@@ -7715,6 +7719,7 @@ static struct fst
{"acos", 1, 1, f_acos}, /* WJMc */
#endif
{"add", 2, 2, f_add},
{"and", 2, 2, f_and},
{"append", 2, 2, f_append},
{"argc", 0, 0, f_argc},
{"argidx", 0, 0, f_argidx},
@@ -7850,6 +7855,7 @@ static struct fst
{"inputsave", 0, 0, f_inputsave},
{"inputsecret", 1, 2, f_inputsecret},
{"insert", 2, 3, f_insert},
{"invert", 1, 1, f_invert},
{"isdirectory", 1, 1, f_isdirectory},
{"islocked", 1, 1, f_islocked},
{"items", 1, 1, f_items},
@@ -7888,6 +7894,7 @@ static struct fst
#endif
{"nextnonblank", 1, 1, f_nextnonblank},
{"nr2char", 1, 1, f_nr2char},
{"or", 2, 2, f_or},
{"pathshorten", 1, 1, f_pathshorten},
#ifdef FEAT_FLOAT
{"pow", 2, 2, f_pow},
@@ -7999,6 +8006,7 @@ static struct fst
{"winsaveview", 0, 0, f_winsaveview},
{"winwidth", 1, 1, f_winwidth},
{"writefile", 2, 3, f_writefile},
{"xor", 2, 2, f_xor},
};
#if defined(FEAT_CMDL_COMPL) || defined(PROTO)
@@ -8571,6 +8579,18 @@ f_add(argvars, rettv)
EMSG(_(e_listreq));
}
/*
* "and(expr, expr)" function
*/
static void
f_and(argvars, rettv)
typval_T *argvars;
typval_T *rettv;
{
rettv->vval.v_number = get_tv_number_chk(&argvars[0], NULL)
& get_tv_number_chk(&argvars[1], NULL);
}
/*
* "append(lnum, string/list)" function
*/
@@ -12957,6 +12977,17 @@ f_insert(argvars, rettv)
}
}
/*
* "invert(expr)" function
*/
static void
f_invert(argvars, rettv)
typval_T *argvars;
typval_T *rettv;
{
rettv->vval.v_number = ~get_tv_number_chk(&argvars[0], NULL);
}
/*
* "isdirectory()" function
*/
@@ -14107,6 +14138,18 @@ f_nr2char(argvars, rettv)
rettv->vval.v_string = vim_strsave(buf);
}
/*
* "or(expr, expr)" function
*/
static void
f_or(argvars, rettv)
typval_T *argvars;
typval_T *rettv;
{
rettv->vval.v_number = get_tv_number_chk(&argvars[0], NULL)
| get_tv_number_chk(&argvars[1], NULL);
}
/*
* "pathshorten()" function
*/
@@ -18393,6 +18436,19 @@ f_writefile(argvars, rettv)
rettv->vval.v_number = ret;
}
/*
* "xor(expr, expr)" function
*/
static void
f_xor(argvars, rettv)
typval_T *argvars;
typval_T *rettv;
{
rettv->vval.v_number = get_tv_number_chk(&argvars[0], NULL)
^ get_tv_number_chk(&argvars[1], NULL);
}
/*
* Translate a String variable into a position.
* Returns NULL when there is an error.

View File

@@ -4840,12 +4840,10 @@ getargopt(eap)
#ifdef FEAT_MBYTE
else if (STRNCMP(arg, "enc", 3) == 0)
{
arg += 3;
pp = &eap->force_enc;
}
else if (STRNCMP(arg, "encoding", 8) == 0)
{
arg += 8;
if (STRNCMP(arg, "encoding", 8) == 0)
arg += 8;
else
arg += 3;
pp = &eap->force_enc;
}
else if (STRNCMP(arg, "bad", 3) == 0)

View File

@@ -645,7 +645,11 @@ getcmdline(firstc, count, indent)
}
else if (ccline.cmdpos > i)
cmdline_del(i);
/* Now complete in the new directory. Set KeyTyped in case the
* Up key came from a mapping. */
c = p_wc;
KeyTyped = TRUE;
}
}

View File

@@ -3216,7 +3216,7 @@ gui_mch_new_colors(void)
{
/* TODO:
* This proc is called when Normal is set to a value
* so what msut be done? I don't know
* so what must be done? I don't know
*/
}
@@ -3303,7 +3303,6 @@ gui_mch_get_winpos(int *x, int *y)
*x = bounds.left;
*y = bounds.top;
return OK;
return FAIL;
}
/*

View File

@@ -1101,7 +1101,7 @@ _WndProc(
return MyWindowProc(hwnd, uMsg, wParam, lParam);
}
return 1;
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
/*

View File

@@ -1044,13 +1044,12 @@ luaV_window(lua_State *L)
static int
luaV_open(lua_State *L)
{
luaV_Buffer *b;
char_u *s = NULL;
#ifdef HAVE_SANDBOX
luaV_checksandbox(L);
#endif
if (lua_isstring(L, 1)) s = (char_u *) lua_tostring(L, 1);
b = luaV_pushbuffer(L, buflist_new(s, NULL, 1L, BLN_LISTED));
luaV_pushbuffer(L, buflist_new(s, NULL, 1L, BLN_LISTED));
return 1;
}

View File

@@ -3294,7 +3294,10 @@ usage()
#ifdef FEAT_GUI_GNOME
/* Gnome gives extra messages for --help if we continue, but not for -h. */
if (gui.starting)
{
mch_msg("\n");
gui.dofork = FALSE;
}
else
#endif
mch_exit(0);

View File

@@ -4293,6 +4293,8 @@ static ff_stack_T *ff_create_stack_element __ARGS((char_u *, int, int));
static int ff_path_in_stoplist __ARGS((char_u *, int, char_u **));
#endif
static char_u e_pathtoolong[] = N_("E854: path too long for completion");
#if 0
/*
* if someone likes findfirst/findnext, here are the functions
@@ -4589,6 +4591,11 @@ vim_findfile_init(path, filename, stopdirs, level, free_visited, find_what,
len = 0;
while (*wc_part != NUL)
{
if (len + 5 >= MAXPATHL)
{
EMSG(_(e_pathtoolong));
break;
}
if (STRNCMP(wc_part, "**", 2) == 0)
{
ff_expand_buffer[len++] = *wc_part++;
@@ -4634,6 +4641,12 @@ vim_findfile_init(path, filename, stopdirs, level, free_visited, find_what,
}
/* create an absolute path */
if (STRLEN(search_ctx->ffsc_start_dir)
+ STRLEN(search_ctx->ffsc_fix_path) + 3 >= MAXPATHL)
{
EMSG(_(e_pathtoolong));
goto error_return;
}
STRCPY(ff_expand_buffer, search_ctx->ffsc_start_dir);
add_pathsep(ff_expand_buffer);
STRCAT(ff_expand_buffer, search_ctx->ffsc_fix_path);

View File

@@ -1854,7 +1854,7 @@ line_read_in:
if (state == TS_BINARY && orgpat.regmatch.rm_ic && !sortic)
{
/* binary search won't work for ignoring case, use linear
/* Binary search won't work for ignoring case, use linear
* search. */
linear = TRUE;
state = TS_LINEAR;
@@ -1922,6 +1922,19 @@ line_read_in:
MSG(_("Ignoring long line in tags file"));
verbose_leave();
}
#ifdef FEAT_TAG_BINS
if (state != TS_LINEAR)
{
/* Avoid getting stuck. */
linear = TRUE;
state = TS_LINEAR;
# ifdef HAVE_FSEEKO
fseeko(fp, search_info.low_offset, SEEK_SET);
# else
fseek(fp, (long)search_info.low_offset, SEEK_SET);
# endif
}
#endif
continue;
}

View File

@@ -1,4 +1,4 @@
Test for floating point.
Test for floating point and logical operators.
STARTTEST
:so small.vim
@@ -72,6 +72,23 @@ STARTTEST
:$put ='float2nr'
:$put =float2nr(123.456)
:$put =float2nr(-123.456)
:$put ='AND'
:$put =and(127, 127)
:$put =and(127, 16)
:$put =and(127, 128)
:$put ='OR'
:$put =or(16, 7)
:$put =or(8, 7)
:$put =or(0, 123)
:$put ='XOR'
:$put =xor(127, 127)
:$put =xor(127, 16)
:$put =xor(127, 128)
:$put ='invert'
:$put =and(invert(127), 65535)
:$put =and(invert(16), 65535)
:$put =and(invert(128), 65535)
:$put =invert(1.0)
:/^Results/,$wq! test.out
ENDTEST

View File

@@ -54,3 +54,20 @@ trunc
float2nr
123
-123
AND
127
16
0
OR
23
15
123
XOR
0
111
255
invert
65408
65519
65407
0

View File

@@ -714,6 +714,26 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
377,
/**/
376,
/**/
375,
/**/
374,
/**/
373,
/**/
372,
/**/
371,
/**/
370,
/**/
369,
/**/
368,
/**/
367,
/**/