To: vim_dev@googlegroups.com Subject: Patch 7.4.1976 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1976 Problem: Number variables are not 64 bits while they could be. Solution: Add the num64 feature. (Ken Takata) Files: runtime/doc/eval.txt, runtime/doc/various.txt, src/Make_cyg_ming.mak, src/Make_mvc.mak, src/charset.c, src/eval.c, src/ex_cmds.c, src/ex_getln.c, src/feature.h, src/fileio.c, src/fold.c, src/json.c, src/message.c, src/misc1.c, src/misc2.c, src/ops.c, src/option.c, src/proto/charset.pro, src/proto/eval.pro, src/quickfix.c, src/structs.h, src/testdir/test_viml.vim, src/version.c *** ../vim-7.4.1975/runtime/doc/eval.txt 2016-06-04 18:49:15.386070039 +0200 --- runtime/doc/eval.txt 2016-07-01 18:02:49.378216033 +0200 *************** *** 37,57 **** 1.1 Variable types ~ *E712* ! There are six types of variables: Number A 32 or 64 bit signed number. |expr-number| *Number* Examples: -123 0x10 0177 Float A floating point number. |floating-point-format| *Float* {only when compiled with the |+float| feature} Examples: 123.456 1.15e-6 -1.1e3 String A NUL terminated string of 8-bit unsigned characters (bytes). |expr-string| Examples: "ab\txx\"--" 'x-z''a,c' - Funcref A reference to a function |Funcref|. - Example: function("strlen") - List An ordered sequence of items |List|. Example: [1, 2, ['a', 'b']] --- 37,57 ---- 1.1 Variable types ~ *E712* ! There are nine types of variables: Number A 32 or 64 bit signed number. |expr-number| *Number* + 64-bit Number is available only when compiled with the + |+num64| feature. Examples: -123 0x10 0177 Float A floating point number. |floating-point-format| *Float* {only when compiled with the |+float| feature} Examples: 123.456 1.15e-6 -1.1e3 + *E928* String A NUL terminated string of 8-bit unsigned characters (bytes). |expr-string| Examples: "ab\txx\"--" 'x-z''a,c' List An ordered sequence of items |List|. Example: [1, 2, ['a', 'b']] *************** *** 7681,7688 **** --- 7854,7863 ---- mzscheme Compiled with MzScheme interface |mzscheme|. netbeans_enabled Compiled with support for |netbeans| and connected. netbeans_intg Compiled with support for |netbeans|. + num64 Compiled with 64-bit |Number| support. ole Compiled with OLE automation support for Win32. os2 OS/2 version of Vim. + packages Compiled with |packages| support. path_extra Compiled with up/downwards search in 'path' and 'tags' perl Compiled with Perl interface. persistent_undo Compiled with support for persistent undo history. *** ../vim-7.4.1975/runtime/doc/various.txt 2016-04-29 22:58:25.610876772 +0200 --- runtime/doc/various.txt 2016-07-01 18:02:49.382215974 +0200 *************** *** 378,384 **** --- 390,398 ---- m *+mzscheme* Mzscheme interface |mzscheme| m *+mzscheme/dyn* Mzscheme interface |mzscheme-dynamic| |/dyn| m *+netbeans_intg* |netbeans| + *+num64* 64-bit Number support |Number| m *+ole* Win32 GUI only: |ole-interface| + N *+packages* Loading |packages| N *+path_extra* Up/downwards search in 'path' and 'tags' m *+perl* Perl interface |perl| m *+perl/dyn* Perl interface |perl-dynamic| |/dyn| *** ../vim-7.4.1975/src/Make_cyg_ming.mak 2016-06-26 20:37:24.563969023 +0200 --- src/Make_cyg_ming.mak 2016-07-01 18:02:49.382215974 +0200 *************** *** 379,385 **** # Any other defines can be included here. DEF_GUI=-DFEAT_GUI_W32 -DFEAT_CLIPBOARD DEFINES=-DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \ ! -DHAVE_PATHDEF -DFEAT_$(FEATURES) ifeq ($(ARCH),x86-64) DEFINES+=-DMS_WIN64 endif --- 379,385 ---- # Any other defines can be included here. DEF_GUI=-DFEAT_GUI_W32 -DFEAT_CLIPBOARD DEFINES=-DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \ ! -DHAVE_PATHDEF -DFEAT_$(FEATURES) -DHAVE_STDINT_H ifeq ($(ARCH),x86-64) DEFINES+=-DMS_WIN64 endif *** ../vim-7.4.1975/src/Make_mvc.mak 2016-06-26 20:37:24.567968951 +0200 --- src/Make_mvc.mak 2016-07-01 18:02:49.382215974 +0200 *************** *** 501,506 **** --- 501,511 ---- CFLAGS=$(CFLAGS) $(WP64CHECK) !endif + # VC10 or later has stdint.h. + !if $(MSVC_MAJOR) >= 10 + CFLAGS = $(CFLAGS) -DHAVE_STDINT_H + !endif + # Static code analysis generally available starting with VS2012 (VC11) or # Windows SDK 7.1 (VC10) !if ("$(ANALYZE)" == "yes") && ($(MSVC_MAJOR) >= 10) *** ../vim-7.4.1975/src/charset.c 2016-03-19 22:11:47.412675093 +0100 --- src/charset.c 2016-07-01 18:02:49.382215974 +0200 *************** *** 1836,1849 **** is bin */ int *len, /* return: detected length of number */ int what, /* what numbers to recognize */ ! long *nptr, /* return: signed result */ ! unsigned long *unptr, /* return: unsigned result */ int maxlen) /* max length of string to check */ { char_u *ptr = start; int pre = 0; /* default is decimal */ int negative = FALSE; ! unsigned long un = 0; int n; if (ptr[0] == '-') --- 1836,1849 ---- is bin */ int *len, /* return: detected length of number */ int what, /* what numbers to recognize */ ! varnumber_T *nptr, /* return: signed result */ ! uvarnumber_T *unptr, /* return: unsigned result */ int maxlen) /* max length of string to check */ { char_u *ptr = start; int pre = 0; /* default is decimal */ int negative = FALSE; ! uvarnumber_T un = 0; int n; if (ptr[0] == '-') *************** *** 1912,1918 **** /* octal */ while ('0' <= *ptr && *ptr <= '7') { ! un = 8 * un + (unsigned long)(*ptr - '0'); ++ptr; if (n++ == maxlen) break; --- 1912,1918 ---- /* octal */ while ('0' <= *ptr && *ptr <= '7') { ! un = 8 * un + (uvarnumber_T)(*ptr - '0'); ++ptr; if (n++ == maxlen) break; *************** *** 1925,1931 **** n += 2; /* skip over "0x" */ while (vim_isxdigit(*ptr)) { ! un = 16 * un + (unsigned long)hex2nr(*ptr); ++ptr; if (n++ == maxlen) break; --- 1925,1931 ---- n += 2; /* skip over "0x" */ while (vim_isxdigit(*ptr)) { ! un = 16 * un + (uvarnumber_T)hex2nr(*ptr); ++ptr; if (n++ == maxlen) break; *************** *** 1936,1942 **** /* decimal */ while (VIM_ISDIGIT(*ptr)) { ! un = 10 * un + (unsigned long)(*ptr - '0'); ++ptr; if (n++ == maxlen) break; --- 1936,1942 ---- /* decimal */ while (VIM_ISDIGIT(*ptr)) { ! un = 10 * un + (uvarnumber_T)(*ptr - '0'); ++ptr; if (n++ == maxlen) break; *************** *** 1950,1958 **** if (nptr != NULL) { if (negative) /* account for leading '-' for decimal numbers */ ! *nptr = -(long)un; else ! *nptr = (long)un; } if (unptr != NULL) *unptr = un; --- 1950,1958 ---- if (nptr != NULL) { if (negative) /* account for leading '-' for decimal numbers */ ! *nptr = -(varnumber_T)un; else ! *nptr = (varnumber_T)un; } if (unptr != NULL) *unptr = un; *** ../vim-7.4.1975/src/eval.c 2016-07-01 17:17:13.278266936 +0200 --- src/eval.c 2016-07-01 18:02:49.390215858 +0200 *************** *** 1376,1382 **** int skip) /* only parse, don't execute */ { typval_T tv; ! int retval = FALSE; if (skip) ++emsg_skip; --- 1376,1382 ---- int skip) /* only parse, don't execute */ { typval_T tv; ! varnumber_T retval = FALSE; if (skip) ++emsg_skip; *************** *** 1394,1400 **** if (skip) --emsg_skip; ! return retval; } /* --- 1394,1400 ---- if (skip) --emsg_skip; ! return (int)retval; } /* *************** *** 1519,1529 **** * Evaluates "expr" silently. * Returns -1 for an error. */ ! int eval_to_number(char_u *expr) { typval_T rettv; ! int retval; char_u *p = skipwhite(expr); ++emsg_off; --- 1519,1529 ---- * Evaluates "expr" silently. * Returns -1 for an error. */ ! varnumber_T eval_to_number(char_u *expr) { typval_T rettv; ! varnumber_T retval; char_u *p = skipwhite(expr); ++emsg_off; *************** *** 1628,1634 **** li = li->li_next; if (li == NULL) return -1; ! return get_tv_number(&li->li_tv); } #endif --- 1628,1634 ---- li = li->li_next; if (li == NULL) return -1; ! return (int)get_tv_number(&li->li_tv); } #endif *************** *** 1669,1675 **** typval_T *rettv) { typval_T *argvars; ! long n; int len; int i; int doesrange; --- 1669,1675 ---- typval_T *rettv) { typval_T *argvars; ! varnumber_T n; int len; int i; int doesrange; *************** *** 1735,1741 **** * Returns -1 when calling the function fails. * Uses argv[argc] for the function arguments. */ ! long call_func_retnr( char_u *func, int argc, --- 1735,1741 ---- * Returns -1 when calling the function fails. * Uses argv[argc] for the function arguments. */ ! varnumber_T call_func_retnr( char_u *func, int argc, *************** *** 1743,1749 **** int safe) /* use the sandbox */ { typval_T rettv; ! long retval; /* All arguments are passed as strings, no conversion to number. */ if (call_vim_function(func, argc, argv, safe, TRUE, &rettv) == FAIL) --- 1743,1749 ---- int safe) /* use the sandbox */ { typval_T rettv; ! varnumber_T retval; /* All arguments are passed as strings, no conversion to number. */ if (call_vim_function(func, argc, argv, safe, TRUE, &rettv) == FAIL) *************** *** 1880,1886 **** eval_foldexpr(char_u *arg, int *cp) { typval_T tv; ! int retval; char_u *s; int use_sandbox = was_set_insecurely((char_u *)"foldexpr", OPT_LOCAL); --- 1880,1886 ---- eval_foldexpr(char_u *arg, int *cp) { typval_T tv; ! varnumber_T retval; char_u *s; int use_sandbox = was_set_insecurely((char_u *)"foldexpr", OPT_LOCAL); *************** *** 1915,1921 **** --sandbox; --textlock; ! return retval; } #endif --- 1915,1921 ---- --sandbox; --textlock; ! return (int)retval; } #endif *************** *** 2480,2486 **** c1 = *p; *p = NUL; ! n = get_tv_number(tv); s = get_tv_string_chk(tv); /* != NULL if number or string */ if (s != NULL && op != NULL && *op != '=') { --- 2480,2486 ---- c1 = *p; *p = NUL; ! n = (long)get_tv_number(tv); s = get_tv_string_chk(tv); /* != NULL if number or string */ if (s != NULL && op != NULL && *op != '=') { *************** *** 2888,2894 **** lp->ll_n1 = 0; else { ! lp->ll_n1 = get_tv_number(&var1); /* is number or string */ clear_tv(&var1); } lp->ll_dict = NULL; --- 2888,2895 ---- lp->ll_n1 = 0; else { ! lp->ll_n1 = (long)get_tv_number(&var1); ! /* is number or string */ clear_tv(&var1); } lp->ll_dict = NULL; *************** *** 2919,2925 **** */ if (lp->ll_range && !lp->ll_empty2) { ! lp->ll_n2 = get_tv_number(&var2); /* is number or string */ clear_tv(&var2); if (lp->ll_n2 < 0) { --- 2920,2927 ---- */ if (lp->ll_range && !lp->ll_empty2) { ! lp->ll_n2 = (long)get_tv_number(&var2); ! /* is number or string */ clear_tv(&var2); if (lp->ll_n2 < 0) { *************** *** 3117,3123 **** static int tv_op(typval_T *tv1, typval_T *tv2, char_u *op) { ! long n; char_u numbuf[NUMBUFLEN]; char_u *s; --- 3119,3125 ---- static int tv_op(typval_T *tv1, typval_T *tv2, char_u *op) { ! varnumber_T n; char_u numbuf[NUMBUFLEN]; char_u *s; *************** *** 4468,4474 **** exptype_T type = TYPE_UNKNOWN; int type_is = FALSE; /* TRUE for "is" and "isnot" */ int len = 2; ! long n1, n2; char_u *s1, *s2; char_u buf1[NUMBUFLEN], buf2[NUMBUFLEN]; int ic; --- 4470,4476 ---- exptype_T type = TYPE_UNKNOWN; int type_is = FALSE; /* TRUE for "is" and "isnot" */ int len = 2; ! varnumber_T n1, n2; char_u *s1, *s2; char_u buf1[NUMBUFLEN], buf2[NUMBUFLEN]; int ic; *************** *** 4766,4772 **** typval_T var2; typval_T var3; int op; ! long n1, n2; #ifdef FEAT_FLOAT float_T f1 = 0, f2 = 0; #endif --- 4768,4774 ---- typval_T var2; typval_T var3; int op; ! varnumber_T n1, n2; #ifdef FEAT_FLOAT float_T f1 = 0, f2 = 0; #endif *************** *** 4951,4957 **** { typval_T var2; int op; ! long n1, n2; #ifdef FEAT_FLOAT int use_float = FALSE; float_T f1 = 0, f2; --- 4953,4959 ---- { typval_T var2; int op; ! varnumber_T n1, n2; #ifdef FEAT_FLOAT int use_float = FALSE; float_T f1 = 0, f2; *************** *** 5072,5083 **** --- 5074,5094 ---- { if (n2 == 0) /* give an error message? */ { + #ifdef FEAT_NUM64 + if (n1 == 0) + n1 = -0x7fffffffffffffff - 1; /* similar to NaN */ + else if (n1 < 0) + n1 = -0x7fffffffffffffff; + else + n1 = 0x7fffffffffffffff; + #else if (n1 == 0) n1 = -0x7fffffffL - 1L; /* similar to NaN */ else if (n1 < 0) n1 = -0x7fffffffL; else n1 = 0x7fffffffL; + #endif } else n1 = n1 / n2; *************** *** 5131,5137 **** int evaluate, int want_string UNUSED) /* after "." operator */ { ! long n; int len; char_u *s; char_u *start_leader, *end_leader; --- 5142,5148 ---- int evaluate, int want_string UNUSED) /* after "." operator */ { ! varnumber_T n; int len; char_u *s; char_u *start_leader, *end_leader; *************** *** 5356,5362 **** if (ret == OK && evaluate && end_leader > start_leader) { int error = FALSE; ! int val = 0; #ifdef FEAT_FLOAT float_T f = 0.0; --- 5367,5373 ---- if (ret == OK && evaluate && end_leader > start_leader) { int error = FALSE; ! varnumber_T val = 0; #ifdef FEAT_FLOAT float_T f = 0.0; *************** *** 6525,6531 **** *errorp = TRUE; return -1L; } ! return get_tv_number_chk(&li->li_tv, errorp); } /* --- 6536,6542 ---- *errorp = TRUE; return -1L; } ! return (long)get_tv_number_chk(&li->li_tv, errorp); } /* *************** *** 7770,7776 **** dict_add_nr_str( dict_T *d, char *key, ! long nr, char_u *str) { dictitem_T *item; --- 7781,7787 ---- dict_add_nr_str( dict_T *d, char *key, ! varnumber_T nr, char_u *str) { dictitem_T *item; *************** *** 7894,7900 **** * Get a number item from a dictionary. * Returns 0 if the entry doesn't exist. */ ! long get_dict_number(dict_T *d, char_u *key) { dictitem_T *di; --- 7905,7911 ---- * Get a number item from a dictionary. * Returns 0 if the entry doesn't exist. */ ! varnumber_T get_dict_number(dict_T *d, char_u *key) { dictitem_T *di; *************** *** 9612,9618 **** if (argvars[0].v_type != VAR_UNKNOWN) { ! idx = get_tv_number_chk(&argvars[0], NULL); if (idx >= 0 && idx < ARGCOUNT) rettv->vval.v_string = vim_strsave(alist_name(&ARGLIST[idx])); else --- 9623,9629 ---- if (argvars[0].v_type != VAR_UNKNOWN) { ! idx = (int)get_tv_number_chk(&argvars[0], NULL); if (idx >= 0 && idx < ARGCOUNT) rettv->vval.v_string = vim_strsave(alist_name(&ARGLIST[idx])); else *************** *** 10012,10018 **** char_u buf2[NUMBUFLEN]; int error = FALSE; ! save = get_tv_number_chk(&argvars[0], &error); title = get_tv_string_chk(&argvars[1]); initdir = get_tv_string_buf_chk(&argvars[2], buf); defname = get_tv_string_buf_chk(&argvars[3], buf2); --- 10023,10029 ---- char_u buf2[NUMBUFLEN]; int error = FALSE; ! save = (int)get_tv_number_chk(&argvars[0], &error); title = get_tv_string_chk(&argvars[1]); initdir = get_tv_string_buf_chk(&argvars[2], buf); defname = get_tv_string_buf_chk(&argvars[3], buf2); *************** *** 10290,10296 **** char_u *t; #endif char_u *str; ! long idx; str = get_tv_string_chk(&argvars[0]); idx = get_tv_number_chk(&argvars[1], NULL); --- 10301,10307 ---- char_u *t; #endif char_u *str; ! varnumber_T idx; str = get_tv_string_chk(&argvars[0]); idx = get_tv_number_chk(&argvars[1], NULL); *************** *** 10660,10666 **** int utf8 = 0; if (argvars[1].v_type != VAR_UNKNOWN) ! utf8 = get_tv_number_chk(&argvars[1], NULL); if (utf8) rettv->vval.v_number = (*utf_ptr2char)(get_tv_string(&argvars[0])); --- 10671,10677 ---- int utf8 = 0; if (argvars[1].v_type != VAR_UNKNOWN) ! utf8 = (int)get_tv_number_chk(&argvars[1], NULL); if (utf8) rettv->vval.v_number = (*utf_ptr2char)(get_tv_string(&argvars[0])); *************** *** 10783,10789 **** return; } ! startcol = get_tv_number_chk(&argvars[0], NULL); if (startcol <= 0) return; --- 10794,10800 ---- return; } ! startcol = (int)get_tv_number_chk(&argvars[0], NULL); if (startcol <= 0) return; *************** *** 10840,10846 **** error = TRUE; if (argvars[2].v_type != VAR_UNKNOWN) { ! def = get_tv_number_chk(&argvars[2], &error); if (argvars[3].v_type != VAR_UNKNOWN) { typestr = get_tv_string_buf_chk(&argvars[3], buf2); --- 10851,10857 ---- error = TRUE; if (argvars[2].v_type != VAR_UNKNOWN) { ! def = (int)get_tv_number_chk(&argvars[2], &error); if (argvars[3].v_type != VAR_UNKNOWN) { typestr = get_tv_string_buf_chk(&argvars[3], buf2); *************** *** 10933,10942 **** { int error = FALSE; ! ic = get_tv_number_chk(&argvars[2], &error); if (argvars[3].v_type != VAR_UNKNOWN) { ! idx = get_tv_number_chk(&argvars[3], &error); if (!error) { li = list_find(l, idx); --- 10944,10953 ---- { int error = FALSE; ! ic = (int)get_tv_number_chk(&argvars[2], &error); if (argvars[3].v_type != VAR_UNKNOWN) { ! idx = (long)get_tv_number_chk(&argvars[3], &error); if (!error) { li = list_find(l, idx); *************** *** 10965,10971 **** if (argvars[2].v_type != VAR_UNKNOWN) { ! ic = get_tv_number_chk(&argvars[2], &error); if (argvars[3].v_type != VAR_UNKNOWN) EMSG(_(e_invarg)); } --- 10976,10982 ---- if (argvars[2].v_type != VAR_UNKNOWN) { ! ic = (int)get_tv_number_chk(&argvars[2], &error); if (argvars[3].v_type != VAR_UNKNOWN) EMSG(_(e_invarg)); } *************** *** 11055,11064 **** else { line = get_tv_lnum(argvars); ! col = get_tv_number_chk(&argvars[1], NULL); #ifdef FEAT_VIRTUALEDIT if (argvars[2].v_type != VAR_UNKNOWN) ! coladd = get_tv_number_chk(&argvars[2], NULL); #endif } if (line < 0 || col < 0 --- 11066,11075 ---- else { line = get_tv_lnum(argvars); ! col = (long)get_tv_number_chk(&argvars[1], NULL); #ifdef FEAT_VIRTUALEDIT if (argvars[2].v_type != VAR_UNKNOWN) ! coladd = (long)get_tv_number_chk(&argvars[2], NULL); #endif } if (line < 0 || col < 0 *************** *** 11096,11102 **** int noref = 0; if (argvars[1].v_type != VAR_UNKNOWN) ! noref = get_tv_number_chk(&argvars[1], NULL); if (noref < 0 || noref > 1) EMSG(_(e_invarg)); else --- 11107,11113 ---- int noref = 0; if (argvars[1].v_type != VAR_UNKNOWN) ! noref = (int)get_tv_number_chk(&argvars[1], NULL); if (noref < 0 || noref > 1) EMSG(_(e_invarg)); else *************** *** 11604,11610 **** { if (argvars[2].v_type != VAR_UNKNOWN) { ! before = get_tv_number_chk(&argvars[2], &error); if (error) return; /* type error; errmsg already given */ --- 11615,11621 ---- { if (argvars[2].v_type != VAR_UNKNOWN) { ! before = (long)get_tv_number_chk(&argvars[2], &error); if (error) return; /* type error; errmsg already given */ *************** *** 11807,11813 **** path = p; if (argvars[2].v_type != VAR_UNKNOWN) ! count = get_tv_number_chk(&argvars[2], &error); } } --- 11818,11824 ---- path = p; if (argvars[2].v_type != VAR_UNKNOWN) ! count = (int)get_tv_number_chk(&argvars[2], &error); } } *************** *** 12043,12054 **** --- 12054,12074 ---- if (get_float_arg(argvars, &f) == OK) { + # ifdef FEAT_NUM64 + if (f < -0x7fffffffffffffff) + rettv->vval.v_number = -0x7fffffffffffffff; + else if (f > 0x7fffffffffffffff) + rettv->vval.v_number = 0x7fffffffffffffff; + else + rettv->vval.v_number = (varnumber_T)f; + # else if (f < -0x7fffffff) rettv->vval.v_number = -0x7fffffff; else if (f > 0x7fffffff) rettv->vval.v_number = 0x7fffffff; else rettv->vval.v_number = (varnumber_T)f; + # endif } } *************** *** 12511,12517 **** { int error = FALSE; ! li = list_find(l, get_tv_number_chk(&argvars[1], &error)); if (!error && li != NULL) tv = &li->li_tv; } --- 12531,12537 ---- { int error = FALSE; ! li = list_find(l, (long)get_tv_number_chk(&argvars[1], &error)); if (!error && li != NULL) tv = &li->li_tv; } *************** *** 13333,13341 **** error = strregname == NULL; if (argvars[1].v_type != VAR_UNKNOWN) { ! arg2 = get_tv_number_chk(&argvars[1], &error); if (!error && argvars[2].v_type != VAR_UNKNOWN) ! return_list = get_tv_number_chk(&argvars[2], &error); } } else --- 13353,13361 ---- error = strregname == NULL; if (argvars[1].v_type != VAR_UNKNOWN) { ! arg2 = (int)get_tv_number_chk(&argvars[1], &error); if (!error && argvars[2].v_type != VAR_UNKNOWN) ! return_list = (int)get_tv_number_chk(&argvars[2], &error); } } else *************** *** 13558,13564 **** #endif int nr; ! nr = get_tv_number_chk(vp, NULL); #ifdef FEAT_WINDOWS if (nr < 0) --- 13578,13584 ---- #endif int nr; ! nr = (int)get_tv_number_chk(vp, NULL); #ifdef FEAT_WINDOWS if (nr < 0) *************** *** 13601,13607 **** { if (tvp->v_type != VAR_UNKNOWN) { ! n = get_tv_number(tvp); if (n >= 0) tp = find_tabpage(n); } --- 13621,13627 ---- { if (tvp->v_type != VAR_UNKNOWN) { ! n = (long)get_tv_number(tvp); if (n >= 0) tp = find_tabpage(n); } *************** *** 14126,14131 **** --- 14146,14154 ---- "mzscheme", #endif #endif + #ifdef FEAT_NUM64 + "num64", + #endif #ifdef FEAT_OLE "ole", #endif *************** *** 14468,14474 **** { mode = get_tv_string_buf(&argvars[1], buf); if (argvars[2].v_type != VAR_UNKNOWN) ! abbr = get_tv_number(&argvars[2]); } if (map_to_exists(name, mode, abbr)) --- 14491,14497 ---- { mode = get_tv_string_buf(&argvars[1], buf); if (argvars[2].v_type != VAR_UNKNOWN) ! abbr = (int)get_tv_number(&argvars[2]); } if (map_to_exists(name, mode, abbr)) *************** *** 14696,14705 **** /* Start at specified item. Use the cached index that list_find() * sets, so that a negative number also works. */ ! item = list_find(l, get_tv_number_chk(&argvars[2], &error)); idx = l->lv_idx; if (argvars[3].v_type != VAR_UNKNOWN) ! ic = get_tv_number_chk(&argvars[3], &error); if (error) item = NULL; } --- 14719,14728 ---- /* Start at specified item. Use the cached index that list_find() * sets, so that a negative number also works. */ ! item = list_find(l, (long)get_tv_number_chk(&argvars[2], &error)); idx = l->lv_idx; if (argvars[3].v_type != VAR_UNKNOWN) ! ic = (int)get_tv_number_chk(&argvars[3], &error); if (error) item = NULL; } *************** *** 14983,14989 **** && !tv_check_lock(l->lv_lock, (char_u *)N_("insert() argument"), TRUE)) { if (argvars[2].v_type != VAR_UNKNOWN) ! before = get_tv_number_chk(&argvars[2], &error); if (error) return; /* type error; errmsg already given */ --- 15006,15012 ---- && !tv_check_lock(l->lv_lock, (char_u *)N_("insert() argument"), TRUE)) { if (argvars[2].v_type != VAR_UNKNOWN) ! before = (long)get_tv_number_chk(&argvars[2], &error); if (error) return; /* type error; errmsg already given */ *************** *** 15588,15596 **** which = get_tv_string_buf_chk(&argvars[1], buf); if (argvars[2].v_type != VAR_UNKNOWN) { ! abbr = get_tv_number(&argvars[2]); if (argvars[3].v_type != VAR_UNKNOWN) ! get_dict = get_tv_number(&argvars[3]); } } else --- 15611,15619 ---- which = get_tv_string_buf_chk(&argvars[1], buf); if (argvars[2].v_type != VAR_UNKNOWN) { ! abbr = (int)get_tv_number(&argvars[2]); if (argvars[3].v_type != VAR_UNKNOWN) ! get_dict = (int)get_tv_number(&argvars[3]); } } else *************** *** 15781,15787 **** { int error = FALSE; ! start = get_tv_number_chk(&argvars[2], &error); if (error) goto theend; if (l != NULL) --- 15804,15810 ---- { int error = FALSE; ! start = (long)get_tv_number_chk(&argvars[2], &error); if (error) goto theend; if (l != NULL) *************** *** 15810,15816 **** } if (argvars[3].v_type != VAR_UNKNOWN) ! nth = get_tv_number_chk(&argvars[3], &error); if (error) goto theend; } --- 15833,15839 ---- } if (argvars[3].v_type != VAR_UNKNOWN) ! nth = (long)get_tv_number_chk(&argvars[3], &error); if (error) goto theend; } *************** *** 15969,15978 **** return; if (argvars[2].v_type != VAR_UNKNOWN) { ! prio = get_tv_number_chk(&argvars[2], &error); if (argvars[3].v_type != VAR_UNKNOWN) { ! id = get_tv_number_chk(&argvars[3], &error); if (argvars[4].v_type != VAR_UNKNOWN) { if (argvars[4].v_type != VAR_DICT) --- 15992,16001 ---- return; if (argvars[2].v_type != VAR_UNKNOWN) { ! prio = (int)get_tv_number_chk(&argvars[2], &error); if (argvars[3].v_type != VAR_UNKNOWN) { ! id = (int)get_tv_number_chk(&argvars[3], &error); if (argvars[4].v_type != VAR_UNKNOWN) { if (argvars[4].v_type != VAR_DICT) *************** *** 16032,16041 **** if (argvars[2].v_type != VAR_UNKNOWN) { ! prio = get_tv_number_chk(&argvars[2], &error); if (argvars[3].v_type != VAR_UNKNOWN) { ! id = get_tv_number_chk(&argvars[3], &error); if (argvars[4].v_type != VAR_UNKNOWN) { if (argvars[4].v_type != VAR_DICT) --- 16055,16064 ---- if (argvars[2].v_type != VAR_UNKNOWN) { ! prio = (int)get_tv_number_chk(&argvars[2], &error); if (argvars[3].v_type != VAR_UNKNOWN) { ! id = (int)get_tv_number_chk(&argvars[3], &error); if (argvars[4].v_type != VAR_UNKNOWN) { if (argvars[4].v_type != VAR_DICT) *************** *** 16074,16080 **** if (rettv_list_alloc(rettv) == OK) { #ifdef FEAT_SEARCH_EXTRA ! int id = get_tv_number(&argvars[0]); matchitem_T *m; if (id >= 1 && id <= 3) --- 16097,16103 ---- if (rettv_list_alloc(rettv) == OK) { #ifdef FEAT_SEARCH_EXTRA ! int id = (int)get_tv_number(&argvars[0]); matchitem_T *m; if (id >= 1 && id <= 3) *************** *** 16148,16155 **** static void max_min(typval_T *argvars, typval_T *rettv, int domax) { ! long n = 0; ! long i; int error = FALSE; if (argvars[0].v_type == VAR_LIST) --- 16171,16178 ---- static void max_min(typval_T *argvars, typval_T *rettv, int domax) { ! varnumber_T n = 0; ! varnumber_T i; int error = FALSE; if (argvars[0].v_type == VAR_LIST) *************** *** 16285,16291 **** if (argvars[1].v_type != VAR_UNKNOWN) { if (argvars[2].v_type != VAR_UNKNOWN) ! prot = get_tv_number_chk(&argvars[2], NULL); if (prot != -1 && STRCMP(get_tv_string(&argvars[1]), "p") == 0) mkdir_recurse(dir, prot); } --- 16308,16314 ---- if (argvars[1].v_type != VAR_UNKNOWN) { if (argvars[2].v_type != VAR_UNKNOWN) ! prot = (int)get_tv_number_chk(&argvars[2], NULL); if (prot != -1 && STRCMP(get_tv_string(&argvars[1]), "p") == 0) mkdir_recurse(dir, prot); } *************** *** 16428,16434 **** int utf8 = 0; if (argvars[1].v_type != VAR_UNKNOWN) ! utf8 = get_tv_number_chk(&argvars[1], NULL); if (utf8) buf[(*utf_char2bytes)((int)get_tv_number(&argvars[0]), buf)] = NUL; else --- 16451,16457 ---- int utf8 = 0; if (argvars[1].v_type != VAR_UNKNOWN) ! utf8 = (int)get_tv_number_chk(&argvars[1], NULL); if (utf8) buf[(*utf_char2bytes)((int)get_tv_number(&argvars[0]), buf)] = NUL; else *************** *** 16610,16619 **** static void f_range(typval_T *argvars, typval_T *rettv) { ! long start; ! long end; ! long stride = 1; ! long i; int error = FALSE; start = get_tv_number_chk(&argvars[0], &error); --- 16633,16642 ---- static void f_range(typval_T *argvars, typval_T *rettv) { ! varnumber_T start; ! varnumber_T end; ! varnumber_T stride = 1; ! varnumber_T i; int error = FALSE; start = get_tv_number_chk(&argvars[0], &error); *************** *** 16671,16677 **** if (STRCMP(get_tv_string(&argvars[1]), "b") == 0) binary = TRUE; if (argvars[2].v_type != VAR_UNKNOWN) ! maxline = get_tv_number(&argvars[2]); } if (rettv_list_alloc(rettv) == FAIL) --- 16694,16700 ---- if (STRCMP(get_tv_string(&argvars[1]), "b") == 0) binary = TRUE; if (argvars[2].v_type != VAR_UNKNOWN) ! maxline = (long)get_tv_number(&argvars[2]); } if (rettv_list_alloc(rettv) == FAIL) *************** *** 17244,17250 **** { int error = FALSE; ! idx = get_tv_number_chk(&argvars[1], &error); if (error) ; /* type error: do nothing, errmsg already given */ else if ((item = list_find(l, idx)) == NULL) --- 17267,17273 ---- { int error = FALSE; ! idx = (long)get_tv_number_chk(&argvars[1], &error); if (error) ; /* type error: do nothing, errmsg already given */ else if ((item = list_find(l, idx)) == NULL) *************** *** 17261,17267 **** else { /* Remove range of items, return list with values. */ ! end = get_tv_number_chk(&argvars[2], &error); if (error) ; /* type error: do nothing */ else if ((item2 = list_find(l, end)) == NULL) --- 17284,17290 ---- else { /* Remove range of items, return list with values. */ ! end = (long)get_tv_number_chk(&argvars[2], &error); if (error) ; /* type error: do nothing */ else if ((item2 = list_find(l, end)) == NULL) *************** *** 17325,17331 **** char_u *r; int i; ! n = get_tv_number(&argvars[1]); if (argvars[0].v_type == VAR_LIST) { if (rettv_list_alloc(rettv) == OK && argvars[0].vval.v_list != NULL) --- 17348,17354 ---- char_u *r; int i; ! n = (int)get_tv_number(&argvars[1]); if (argvars[0].v_type == VAR_LIST) { if (rettv_list_alloc(rettv) == OK && argvars[0].vval.v_list != NULL) *************** *** 17696,17708 **** /* Optional arguments: line number to stop searching and timeout. */ if (argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN) { ! lnum_stop = get_tv_number_chk(&argvars[2], NULL); if (lnum_stop < 0) goto theend; #ifdef FEAT_RELTIME if (argvars[3].v_type != VAR_UNKNOWN) { ! time_limit = get_tv_number_chk(&argvars[3], NULL); if (time_limit < 0) goto theend; } --- 17719,17731 ---- /* Optional arguments: line number to stop searching and timeout. */ if (argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN) { ! lnum_stop = (long)get_tv_number_chk(&argvars[2], NULL); if (lnum_stop < 0) goto theend; #ifdef FEAT_RELTIME if (argvars[3].v_type != VAR_UNKNOWN) { ! time_limit = (long)get_tv_number_chk(&argvars[3], NULL); if (time_limit < 0) goto theend; } *************** *** 17798,17805 **** int col; int c; ! row = get_tv_number_chk(&argvars[0], NULL) - 1; ! col = get_tv_number_chk(&argvars[1], NULL) - 1; if (row < 0 || row >= screen_Rows || col < 0 || col >= screen_Columns) c = -1; --- 17821,17828 ---- int col; int c; ! row = (int)get_tv_number_chk(&argvars[0], NULL) - 1; ! col = (int)get_tv_number_chk(&argvars[1], NULL) - 1; if (row < 0 || row >= screen_Rows || col < 0 || col >= screen_Columns) c = -1; *************** *** 17819,17826 **** int off; int c; ! row = get_tv_number_chk(&argvars[0], NULL) - 1; ! col = get_tv_number_chk(&argvars[1], NULL) - 1; if (row < 0 || row >= screen_Rows || col < 0 || col >= screen_Columns) c = -1; --- 17842,17849 ---- int off; int c; ! row = (int)get_tv_number_chk(&argvars[0], NULL) - 1; ! col = (int)get_tv_number_chk(&argvars[1], NULL) - 1; if (row < 0 || row >= screen_Rows || col < 0 || col >= screen_Columns) c = -1; *************** *** 17884,17892 **** name = get_tv_string_chk(&argvars[0]); if (argvars[1].v_type != VAR_UNKNOWN) { ! locally = get_tv_number_chk(&argvars[1], &error) == 0; if (!error && argvars[2].v_type != VAR_UNKNOWN) ! thisblock = get_tv_number_chk(&argvars[2], &error) != 0; } if (!error && name != NULL) rettv->vval.v_number = find_decl(name, (int)STRLEN(name), --- 17907,17915 ---- name = get_tv_string_chk(&argvars[0]); if (argvars[1].v_type != VAR_UNKNOWN) { ! locally = (int)get_tv_number_chk(&argvars[1], &error) == 0; if (!error && argvars[2].v_type != VAR_UNKNOWN) ! thisblock = (int)get_tv_number_chk(&argvars[2], &error) != 0; } if (!error && name != NULL) rettv->vval.v_number = find_decl(name, (int)STRLEN(name), *************** *** 17946,17958 **** skip = get_tv_string_buf_chk(&argvars[4], nbuf3); if (argvars[5].v_type != VAR_UNKNOWN) { ! lnum_stop = get_tv_number_chk(&argvars[5], NULL); if (lnum_stop < 0) goto theend; #ifdef FEAT_RELTIME if (argvars[6].v_type != VAR_UNKNOWN) { ! time_limit = get_tv_number_chk(&argvars[6], NULL); if (time_limit < 0) goto theend; } --- 17969,17981 ---- skip = get_tv_string_buf_chk(&argvars[4], nbuf3); if (argvars[5].v_type != VAR_UNKNOWN) { ! lnum_stop = (long)get_tv_number_chk(&argvars[5], NULL); if (lnum_stop < 0) goto theend; #ifdef FEAT_RELTIME if (argvars[6].v_type != VAR_UNKNOWN) { ! time_limit = (long)get_tv_number_chk(&argvars[6], NULL); if (time_limit < 0) goto theend; } *************** *** 18267,18273 **** int error = FALSE; ++varname; ! numval = get_tv_number_chk(varp, &error); strval = get_tv_string_buf_chk(varp, nbuf); if (!error && strval != NULL) set_option_value(varname, numval, strval, OPT_LOCAL); --- 18290,18296 ---- int error = FALSE; ++varname; ! numval = (long)get_tv_number_chk(varp, &error); strval = get_tv_string_buf_chk(varp, nbuf); if (!error && strval != NULL) set_option_value(varname, numval, strval, OPT_LOCAL); *************** *** 18323,18329 **** di = dict_find(d, (char_u *)"forward", -1); if (di != NULL) ! set_csearch_direction(get_tv_number(&di->di_tv) ? FORWARD : BACKWARD); di = dict_find(d, (char_u *)"until", -1); --- 18346,18352 ---- di = dict_find(d, (char_u *)"forward", -1); if (di != NULL) ! set_csearch_direction((int)get_tv_number(&di->di_tv) ? FORWARD : BACKWARD); di = dict_find(d, (char_u *)"until", -1); *************** *** 18916,18922 **** int error = FALSE; ++varname; ! numval = get_tv_number_chk(varp, &error); strval = get_tv_string_buf_chk(varp, nbuf); if (!error && strval != NULL) set_option_value(varname, numval, strval, OPT_LOCAL); --- 18939,18945 ---- int error = FALSE; ++varname; ! numval = (long)get_tv_number_chk(varp, &error); strval = get_tv_string_buf_chk(varp, nbuf); if (!error && strval != NULL) set_option_value(varname, numval, strval, OPT_LOCAL); *************** *** 19083,19090 **** if (sortinfo->item_compare_numbers) { ! long v1 = get_tv_number(tv1); ! long v2 = get_tv_number(tv2); return v1 == v2 ? 0 : v1 > v2 ? 1 : -1; } --- 19106,19113 ---- if (sortinfo->item_compare_numbers) { ! varnumber_T v1 = get_tv_number(tv1); ! varnumber_T v2 = get_tv_number(tv2); return v1 == v2 ? 0 : v1 > v2 ? 1 : -1; } *************** *** 19190,19196 **** if (res == FAIL) res = ITEM_COMPARE_FAIL; else ! res = get_tv_number_chk(&rettv, &sortinfo->item_compare_func_err); if (sortinfo->item_compare_func_err) res = ITEM_COMPARE_FAIL; /* return value has wrong type */ clear_tv(&rettv); --- 19213,19219 ---- if (res == FAIL) res = ITEM_COMPARE_FAIL; else ! res = (int)get_tv_number_chk(&rettv, &sortinfo->item_compare_func_err); if (sortinfo->item_compare_func_err) res = ITEM_COMPARE_FAIL; /* return value has wrong type */ clear_tv(&rettv); *************** *** 19259,19265 **** { int error = FALSE; ! i = get_tv_number_chk(&argvars[1], &error); if (error) goto theend; /* type error; errmsg already given */ if (i == 1) --- 19282,19288 ---- { int error = FALSE; ! i = (long)get_tv_number_chk(&argvars[1], &error); if (error) goto theend; /* type error; errmsg already given */ if (i == 1) *************** *** 19516,19527 **** str = get_tv_string(&argvars[0]); if (argvars[1].v_type != VAR_UNKNOWN) { ! maxcount = get_tv_number_chk(&argvars[1], &typeerr); if (maxcount <= 0) return; if (argvars[2].v_type != VAR_UNKNOWN) { ! need_capital = get_tv_number_chk(&argvars[2], &typeerr); if (typeerr) return; } --- 19539,19550 ---- str = get_tv_string(&argvars[0]); if (argvars[1].v_type != VAR_UNKNOWN) { ! maxcount = (int)get_tv_number_chk(&argvars[1], &typeerr); if (maxcount <= 0) return; if (argvars[2].v_type != VAR_UNKNOWN) { ! need_capital = (int)get_tv_number_chk(&argvars[2], &typeerr); if (typeerr) return; } *************** *** 19576,19582 **** if (pat == NULL) typeerr = TRUE; if (argvars[2].v_type != VAR_UNKNOWN) ! keepempty = get_tv_number_chk(&argvars[2], &typeerr); } if (pat == NULL || *pat == NUL) pat = (char_u *)"[\\x01- ]\\+"; --- 19599,19605 ---- if (pat == NULL) typeerr = TRUE; if (argvars[2].v_type != VAR_UNKNOWN) ! keepempty = (int)get_tv_number_chk(&argvars[2], &typeerr); } if (pat == NULL || *pat == NUL) pat = (char_u *)"[\\x01- ]\\+"; *************** *** 19669,19680 **** { int base = 10; char_u *p; ! long n; int what; if (argvars[1].v_type != VAR_UNKNOWN) { ! base = get_tv_number(&argvars[1]); if (base != 2 && base != 8 && base != 10 && base != 16) { EMSG(_(e_invarg)); --- 19692,19703 ---- { int base = 10; char_u *p; ! varnumber_T n; int what; if (argvars[1].v_type != VAR_UNKNOWN) { ! base = (int)get_tv_number(&argvars[1]); if (base != 2 && base != 8 && base != 10 && base != 16) { EMSG(_(e_invarg)); *************** *** 19772,19778 **** if (str == NULL) return; len = (int)STRLEN(str); ! charidx = get_tv_number_chk(&argvars[1], &error); if (error) return; #ifdef FEAT_MBYTE --- 19795,19801 ---- if (str == NULL) return; len = (int)STRLEN(str); ! charidx = (int)get_tv_number_chk(&argvars[1], &error); if (error) return; #ifdef FEAT_MBYTE *************** *** 19819,19825 **** { int error = FALSE; ! start_idx = get_tv_number_chk(&argvars[2], &error); if (error || start_idx >= (int)STRLEN(haystack)) return; if (start_idx >= 0) --- 19842,19848 ---- { int error = FALSE; ! start_idx = (int)get_tv_number_chk(&argvars[2], &error); if (error || start_idx >= (int)STRLEN(haystack)) return; if (start_idx >= 0) *************** *** 19872,19878 **** #endif if (argvars[1].v_type != VAR_UNKNOWN) ! skipcc = get_tv_number_chk(&argvars[1], NULL); if (skipcc < 0 || skipcc > 1) EMSG(_(e_invarg)); else --- 19895,19901 ---- #endif if (argvars[1].v_type != VAR_UNKNOWN) ! skipcc = (int)get_tv_number_chk(&argvars[1], NULL); if (skipcc < 0 || skipcc > 1) EMSG(_(e_invarg)); else *************** *** 19901,19907 **** int col = 0; if (argvars[1].v_type != VAR_UNKNOWN) ! col = get_tv_number(&argvars[1]); rettv->vval.v_number = (varnumber_T)(linetabsize_col(col, s) - col); } --- 19924,19930 ---- int col = 0; if (argvars[1].v_type != VAR_UNKNOWN) ! col = (int)get_tv_number(&argvars[1]); rettv->vval.v_number = (varnumber_T)(linetabsize_col(col, s) - col); } *************** *** 19941,19947 **** p = get_tv_string(&argvars[0]); slen = (int)STRLEN(p); ! nchar = get_tv_number_chk(&argvars[1], &error); if (!error) { if (nchar > 0) --- 19964,19970 ---- p = get_tv_string(&argvars[0]); slen = (int)STRLEN(p); ! nchar = (int)get_tv_number_chk(&argvars[1], &error); if (!error) { if (nchar > 0) *************** *** 19954,19960 **** nbyte = nchar; if (argvars[2].v_type != VAR_UNKNOWN) { ! charlen = get_tv_number(&argvars[2]); while (charlen > 0 && nbyte + len < slen) { int off = nbyte + len; --- 19977,19983 ---- nbyte = nchar; if (argvars[2].v_type != VAR_UNKNOWN) { ! charlen = (int)get_tv_number(&argvars[2]); while (charlen > 0 && nbyte + len < slen) { int off = nbyte + len; *************** *** 20008,20018 **** p = get_tv_string(&argvars[0]); slen = (int)STRLEN(p); ! n = get_tv_number_chk(&argvars[1], &error); if (error) len = 0; else if (argvars[2].v_type != VAR_UNKNOWN) ! len = get_tv_number(&argvars[2]); else len = slen - n; /* default len: all bytes that are available. */ --- 20031,20041 ---- p = get_tv_string(&argvars[0]); slen = (int)STRLEN(p); ! n = (int)get_tv_number_chk(&argvars[1], &error); if (error) len = 0; else if (argvars[2].v_type != VAR_UNKNOWN) ! len = (int)get_tv_number(&argvars[2]); else len = slen - n; /* default len: all bytes that are available. */ *************** *** 20060,20066 **** if (argvars[2].v_type != VAR_UNKNOWN) { /* Third argument: upper limit for index */ ! end_idx = get_tv_number_chk(&argvars[2], NULL); if (end_idx < 0) return; /* can never find a match */ } --- 20083,20089 ---- if (argvars[2].v_type != VAR_UNKNOWN) { /* Third argument: upper limit for index */ ! end_idx = (int)get_tv_number_chk(&argvars[2], NULL); if (end_idx < 0) return; /* can never find a match */ } *************** *** 20114,20120 **** return; error = FALSE; if (argvars[1].v_type != VAR_UNKNOWN) ! retList = get_tv_number_chk(&argvars[1], &error); if (error) return; --- 20137,20143 ---- return; error = FALSE; if (argvars[1].v_type != VAR_UNKNOWN) ! retList = (int)get_tv_number_chk(&argvars[1], &error); if (error) return; *************** *** 20160,20173 **** { int id = 0; #ifdef FEAT_SYN_HL ! long lnum; ! long col; int trans; int transerr = FALSE; lnum = get_tv_lnum(argvars); /* -1 on type error */ ! col = get_tv_number(&argvars[1]) - 1; /* -1 on type error */ ! trans = get_tv_number_chk(&argvars[2], &transerr); if (!transerr && lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count && col >= 0 && col < (long)STRLEN(ml_get(lnum))) --- 20183,20196 ---- { int id = 0; #ifdef FEAT_SYN_HL ! linenr_T lnum; ! colnr_T col; int trans; int transerr = FALSE; lnum = get_tv_lnum(argvars); /* -1 on type error */ ! col = (linenr_T)get_tv_number(&argvars[1]) - 1; /* -1 on type error */ ! trans = (int)get_tv_number_chk(&argvars[2], &transerr); if (!transerr && lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count && col >= 0 && col < (long)STRLEN(ml_get(lnum))) *************** *** 20191,20197 **** char_u modebuf[NUMBUFLEN]; int modec; ! id = get_tv_number(&argvars[0]); what = get_tv_string(&argvars[1]); if (argvars[2].v_type != VAR_UNKNOWN) { --- 20214,20220 ---- char_u modebuf[NUMBUFLEN]; int modec; ! id = (int)get_tv_number(&argvars[0]); what = get_tv_string(&argvars[1]); if (argvars[2].v_type != VAR_UNKNOWN) { *************** *** 20275,20281 **** int id; #ifdef FEAT_SYN_HL ! id = get_tv_number(&argvars[0]); if (id > 0) id = syn_get_final_id(id); --- 20298,20304 ---- int id; #ifdef FEAT_SYN_HL ! id = (int)get_tv_number(&argvars[0]); if (id > 0) id = syn_get_final_id(id); *************** *** 20293,20300 **** f_synconcealed(typval_T *argvars UNUSED, typval_T *rettv) { #if defined(FEAT_SYN_HL) && defined(FEAT_CONCEAL) ! long lnum; ! long col; int syntax_flags = 0; int cchar; int matchid = 0; --- 20316,20323 ---- f_synconcealed(typval_T *argvars UNUSED, typval_T *rettv) { #if defined(FEAT_SYN_HL) && defined(FEAT_CONCEAL) ! linenr_T lnum; ! colnr_T col; int syntax_flags = 0; int cchar; int matchid = 0; *************** *** 20306,20312 **** #if defined(FEAT_SYN_HL) && defined(FEAT_CONCEAL) lnum = get_tv_lnum(argvars); /* -1 on type error */ ! col = get_tv_number(&argvars[1]) - 1; /* -1 on type error */ vim_memset(str, NUL, sizeof(str)); --- 20329,20335 ---- #if defined(FEAT_SYN_HL) && defined(FEAT_CONCEAL) lnum = get_tv_lnum(argvars); /* -1 on type error */ ! col = (colnr_T)get_tv_number(&argvars[1]) - 1; /* -1 on type error */ vim_memset(str, NUL, sizeof(str)); *************** *** 20353,20360 **** f_synstack(typval_T *argvars UNUSED, typval_T *rettv) { #ifdef FEAT_SYN_HL ! long lnum; ! long col; int i; int id; #endif --- 20376,20383 ---- f_synstack(typval_T *argvars UNUSED, typval_T *rettv) { #ifdef FEAT_SYN_HL ! linenr_T lnum; ! colnr_T col; int i; int id; #endif *************** *** 20364,20370 **** #ifdef FEAT_SYN_HL lnum = get_tv_lnum(argvars); /* -1 on type error */ ! col = get_tv_number(&argvars[1]) - 1; /* -1 on type error */ if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count && col >= 0 && col <= (long)STRLEN(ml_get(lnum)) --- 20387,20393 ---- #ifdef FEAT_SYN_HL lnum = get_tv_lnum(argvars); /* -1 on type error */ ! col = (colnr_T)get_tv_number(&argvars[1]) - 1; /* -1 on type error */ if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count && col >= 0 && col <= (long)STRLEN(ml_get(lnum)) *************** *** 20835,20841 **** static void f_test_disable_char_avail(typval_T *argvars, typval_T *rettv UNUSED) { ! disable_char_avail_for_testing = get_tv_number(&argvars[0]); } /* --- 20858,20864 ---- static void f_test_disable_char_avail(typval_T *argvars, typval_T *rettv UNUSED) { ! disable_char_avail_for_testing = (int)get_tv_number(&argvars[0]); } /* *************** *** 20933,20939 **** static void f_timer_start(typval_T *argvars, typval_T *rettv) { ! long msec = get_tv_number(&argvars[0]); timer_T *timer; int repeat = 0; char_u *callback; --- 20956,20962 ---- static void f_timer_start(typval_T *argvars, typval_T *rettv) { ! long msec = (long)get_tv_number(&argvars[0]); timer_T *timer; int repeat = 0; char_u *callback; *************** *** 20980,20986 **** EMSG(_(e_number_exp)); return; } ! timer = find_timer(get_tv_number(&argvars[0])); if (timer != NULL) stop_timer(timer); } --- 21003,21009 ---- EMSG(_(e_number_exp)); return; } ! timer = find_timer((int)get_tv_number(&argvars[0])); if (timer != NULL) stop_timer(timer); } *************** *** 21436,21464 **** else { if (dict_find(dict, (char_u *)"lnum", -1) != NULL) ! curwin->w_cursor.lnum = get_dict_number(dict, (char_u *)"lnum"); if (dict_find(dict, (char_u *)"col", -1) != NULL) ! curwin->w_cursor.col = get_dict_number(dict, (char_u *)"col"); #ifdef FEAT_VIRTUALEDIT if (dict_find(dict, (char_u *)"coladd", -1) != NULL) ! curwin->w_cursor.coladd = get_dict_number(dict, (char_u *)"coladd"); #endif if (dict_find(dict, (char_u *)"curswant", -1) != NULL) { ! curwin->w_curswant = get_dict_number(dict, (char_u *)"curswant"); curwin->w_set_curswant = FALSE; } if (dict_find(dict, (char_u *)"topline", -1) != NULL) ! set_topline(curwin, get_dict_number(dict, (char_u *)"topline")); #ifdef FEAT_DIFF if (dict_find(dict, (char_u *)"topfill", -1) != NULL) ! curwin->w_topfill = get_dict_number(dict, (char_u *)"topfill"); #endif if (dict_find(dict, (char_u *)"leftcol", -1) != NULL) ! curwin->w_leftcol = get_dict_number(dict, (char_u *)"leftcol"); if (dict_find(dict, (char_u *)"skipcol", -1) != NULL) ! curwin->w_skipcol = get_dict_number(dict, (char_u *)"skipcol"); check_cursor(); win_new_height(curwin, curwin->w_height); --- 21459,21487 ---- else { if (dict_find(dict, (char_u *)"lnum", -1) != NULL) ! curwin->w_cursor.lnum = (linenr_T)get_dict_number(dict, (char_u *)"lnum"); if (dict_find(dict, (char_u *)"col", -1) != NULL) ! curwin->w_cursor.col = (colnr_T)get_dict_number(dict, (char_u *)"col"); #ifdef FEAT_VIRTUALEDIT if (dict_find(dict, (char_u *)"coladd", -1) != NULL) ! curwin->w_cursor.coladd = (colnr_T)get_dict_number(dict, (char_u *)"coladd"); #endif if (dict_find(dict, (char_u *)"curswant", -1) != NULL) { ! curwin->w_curswant = (colnr_T)get_dict_number(dict, (char_u *)"curswant"); curwin->w_set_curswant = FALSE; } if (dict_find(dict, (char_u *)"topline", -1) != NULL) ! set_topline(curwin, (linenr_T)get_dict_number(dict, (char_u *)"topline")); #ifdef FEAT_DIFF if (dict_find(dict, (char_u *)"topfill", -1) != NULL) ! curwin->w_topfill = (int)get_dict_number(dict, (char_u *)"topfill"); #endif if (dict_find(dict, (char_u *)"leftcol", -1) != NULL) ! curwin->w_leftcol = (colnr_T)get_dict_number(dict, (char_u *)"leftcol"); if (dict_find(dict, (char_u *)"skipcol", -1) != NULL) ! curwin->w_skipcol = (colnr_T)get_dict_number(dict, (char_u *)"skipcol"); check_cursor(); win_new_height(curwin, curwin->w_height); *************** *** 22120,22126 **** * Set number v: variable to "val". */ void ! set_vim_var_nr(int idx, long val) { vimvars[idx].vv_nr = val; } --- 22143,22149 ---- * Set number v: variable to "val". */ void ! set_vim_var_nr(int idx, varnumber_T val) { vimvars[idx].vv_nr = val; } *************** *** 22128,22134 **** /* * Get number v: variable value. */ ! long get_vim_var_nr(int idx) { return vimvars[idx].vv_nr; --- 22151,22157 ---- /* * Get number v: variable value. */ ! varnumber_T get_vim_var_nr(int idx) { return vimvars[idx].vv_nr; *************** *** 22742,22748 **** * caller of incompatible types: it sets *denote to TRUE if "denote" * is not NULL or returns -1 otherwise. */ ! long get_tv_number(typval_T *varp) { int error = FALSE; --- 22765,22771 ---- * caller of incompatible types: it sets *denote to TRUE if "denote" * is not NULL or returns -1 otherwise. */ ! varnumber_T get_tv_number(typval_T *varp) { int error = FALSE; *************** *** 22750,22764 **** return get_tv_number_chk(varp, &error); /* return 0L on error */ } ! long get_tv_number_chk(typval_T *varp, int *denote) { ! long n = 0L; switch (varp->v_type) { case VAR_NUMBER: ! return (long)(varp->vval.v_number); case VAR_FLOAT: #ifdef FEAT_FLOAT EMSG(_("E805: Using a Float as a Number")); --- 22773,22787 ---- return get_tv_number_chk(varp, &error); /* return 0L on error */ } ! varnumber_T get_tv_number_chk(typval_T *varp, int *denote) { ! varnumber_T n = 0L; switch (varp->v_type) { case VAR_NUMBER: ! return varp->vval.v_number; case VAR_FLOAT: #ifdef FEAT_FLOAT EMSG(_("E805: Using a Float as a Number")); *************** *** 22858,22869 **** typval_T rettv; linenr_T lnum; ! lnum = get_tv_number_chk(&argvars[0], NULL); if (lnum == 0) /* no valid number, try using line() */ { rettv.v_type = VAR_NUMBER; f_line(argvars, &rettv); ! lnum = rettv.vval.v_number; clear_tv(&rettv); } return lnum; --- 22881,22892 ---- typval_T rettv; linenr_T lnum; ! lnum = (linenr_T)get_tv_number_chk(&argvars[0], NULL); if (lnum == 0) /* no valid number, try using line() */ { rettv.v_type = VAR_NUMBER; f_line(argvars, &rettv); ! lnum = (linenr_T)rettv.vval.v_number; clear_tv(&rettv); } return lnum; *************** *** 22882,22888 **** && argvars[0].vval.v_string[0] == '$' && buf != NULL) return buf->b_ml.ml_line_count; ! return get_tv_number_chk(&argvars[0], NULL); } /* --- 22905,22911 ---- && argvars[0].vval.v_string[0] == '$' && buf != NULL) return buf->b_ml.ml_line_count; ! return (linenr_T)get_tv_number_chk(&argvars[0], NULL); } /* *************** *** 22928,22934 **** switch (varp->v_type) { case VAR_NUMBER: ! sprintf((char *)buf, "%ld", (long)varp->vval.v_number); return buf; case VAR_FUNC: case VAR_PARTIAL: --- 22951,22958 ---- switch (varp->v_type) { case VAR_NUMBER: ! vim_snprintf((char *)buf, NUMBUFLEN, "%lld", ! (varnumber_T)varp->vval.v_number); return buf; case VAR_FUNC: case VAR_PARTIAL: *** ../vim-7.4.1975/src/ex_cmds.c 2016-07-01 17:17:13.278266936 +0200 --- src/ex_cmds.c 2016-07-01 18:02:49.390215858 +0200 *************** *** 289,298 **** union { struct { ! long start_col_nr; /* starting column number */ ! long end_col_nr; /* ending column number */ } line; ! long value; /* value if sorting by integer */ #ifdef FEAT_FLOAT float_T value_flt; /* value if sorting by float */ #endif --- 289,298 ---- union { struct { ! varnumber_T start_col_nr; /* starting column number */ ! varnumber_T end_col_nr; /* ending column number */ } line; ! varnumber_T value; /* value if sorting by integer */ #ifdef FEAT_FLOAT float_T value_flt; /* value if sorting by float */ #endif *** ../vim-7.4.1975/src/ex_getln.c 2016-06-13 22:47:57.723576003 +0200 --- src/ex_getln.c 2016-07-01 18:02:49.390215858 +0200 *************** *** 6005,6011 **** { int len; int first = FALSE; ! long num; *str = skipwhite(*str); if (**str == '-' || vim_isdigit(**str)) /* parse "from" part of range */ --- 6005,6011 ---- { int len; int first = FALSE; ! varnumber_T num; *str = skipwhite(*str); if (**str == '-' || vim_isdigit(**str)) /* parse "from" part of range */ *** ../vim-7.4.1975/src/feature.h 2016-04-29 22:58:25.618876680 +0200 --- src/feature.h 2016-07-01 18:02:49.390215858 +0200 *************** *** 362,373 **** --- 362,377 ---- * +eval Built-in script language and expression evaluation, * ":let", ":if", etc. * +float Floating point variables. + * +num64 64-bit Number. */ #ifdef FEAT_NORMAL # define FEAT_EVAL # if defined(HAVE_FLOAT_FUNCS) || defined(WIN3264) || defined(MACOS) # define FEAT_FLOAT # endif + # if defined(HAVE_STDINT_H) || defined(WIN3264) || (VIM_SIZEOF_LONG >= 8) + # define FEAT_NUM64 + # endif #endif /* *** ../vim-7.4.1975/src/fileio.c 2016-07-01 17:17:13.282266878 +0200 --- src/fileio.c 2016-07-01 18:02:49.394215800 +0200 *************** *** 9481,9487 **** #ifdef FEAT_EVAL /* set v:cmdarg (only when there is a matching pattern) */ ! save_cmdbang = get_vim_var_nr(VV_CMDBANG); if (eap != NULL) { save_cmdarg = set_cmdarg(eap, NULL); --- 9481,9487 ---- #ifdef FEAT_EVAL /* set v:cmdarg (only when there is a matching pattern) */ ! save_cmdbang = (long)get_vim_var_nr(VV_CMDBANG); if (eap != NULL) { save_cmdarg = set_cmdarg(eap, NULL); *** ../vim-7.4.1975/src/fold.c 2016-06-08 21:17:39.049193558 +0200 --- src/fold.c 2016-07-01 18:02:49.394215800 +0200 *************** *** 3032,3038 **** /* KeyTyped may be reset to 0 when calling a function which invokes * do_cmdline(). To make 'foldopen' work correctly restore KeyTyped. */ save_keytyped = KeyTyped; ! n = eval_foldexpr(flp->wp->w_p_fde, &c); KeyTyped = save_keytyped; switch (c) --- 3032,3038 ---- /* KeyTyped may be reset to 0 when calling a function which invokes * do_cmdline(). To make 'foldopen' work correctly restore KeyTyped. */ save_keytyped = KeyTyped; ! n = (int)eval_foldexpr(flp->wp->w_p_fde, &c); KeyTyped = save_keytyped; switch (c) *** ../vim-7.4.1975/src/json.c 2016-04-23 14:33:11.333175109 +0200 --- src/json.c 2016-07-01 18:02:49.394215800 +0200 *************** *** 201,208 **** break; case VAR_NUMBER: ! vim_snprintf((char *)numbuf, NUMBUFLEN, "%ld", ! (long)val->vval.v_number); ga_concat(gap, numbuf); break; --- 201,208 ---- break; case VAR_NUMBER: ! vim_snprintf((char *)numbuf, NUMBUFLEN, "%lld", ! val->vval.v_number); ga_concat(gap, numbuf); break; *************** *** 538,544 **** int len; char_u *p; int c; ! long nr; if (res != NULL) ga_init2(&ga, 1, 200); --- 538,544 ---- int len; char_u *p; int c; ! varnumber_T nr; if (res != NULL) ga_init2(&ga, 1, 200); *************** *** 600,606 **** && (int)(reader->js_end - p) >= 6 && *p == '\\' && *(p+1) == 'u') { ! long nr2 = 0; /* decode surrogate pair: \ud812\u3456 */ len = 0; --- 600,606 ---- && (int)(reader->js_end - p) >= 6 && *p == '\\' && *(p+1) == 'u') { ! varnumber_T nr2 = 0; /* decode surrogate pair: \ud812\u3456 */ len = 0; *************** *** 620,626 **** buf[utf_char2bytes((int)nr, buf)] = NUL; ga_concat(&ga, buf); #else ! ga_append(&ga, nr); #endif } break; --- 620,626 ---- buf[utf_char2bytes((int)nr, buf)] = NUL; ga_concat(&ga, buf); #else ! ga_append(&ga, (int)nr); #endif } break; *************** *** 766,772 **** else #endif { ! long nr; vim_str2nr(reader->js_buf + reader->js_used, NULL, &len, 0, /* what */ --- 766,772 ---- else #endif { ! varnumber_T nr; vim_str2nr(reader->js_buf + reader->js_used, NULL, &len, 0, /* what */ *** ../vim-7.4.1975/src/message.c 2016-06-02 18:37:00.776457146 +0200 --- src/message.c 2016-07-01 18:02:49.394215800 +0200 *************** *** 3846,3852 **** #if defined(FEAT_EVAL) static char *e_printf = N_("E766: Insufficient arguments for printf()"); ! static long tv_nr(typval_T *tvs, int *idxp); static char *tv_str(typval_T *tvs, int *idxp); # ifdef FEAT_FLOAT static double tv_float(typval_T *tvs, int *idxp); --- 3846,3852 ---- #if defined(FEAT_EVAL) static char *e_printf = N_("E766: Insufficient arguments for printf()"); ! static varnumber_T tv_nr(typval_T *tvs, int *idxp); static char *tv_str(typval_T *tvs, int *idxp); # ifdef FEAT_FLOAT static double tv_float(typval_T *tvs, int *idxp); *************** *** 3855,3865 **** /* * Get number argument from "idxp" entry in "tvs". First entry is 1. */ ! static long tv_nr(typval_T *tvs, int *idxp) { int idx = *idxp - 1; ! long n = 0; int err = FALSE; if (tvs[idx].v_type == VAR_UNKNOWN) --- 3855,3865 ---- /* * Get number argument from "idxp" entry in "tvs". First entry is 1. */ ! static varnumber_T tv_nr(typval_T *tvs, int *idxp) { int idx = *idxp - 1; ! varnumber_T n = 0; int err = FALSE; if (tvs[idx].v_type == VAR_UNKNOWN) *************** *** 3912,3918 **** if (tvs[idx].v_type == VAR_FLOAT) f = tvs[idx].vval.v_float; else if (tvs[idx].v_type == VAR_NUMBER) ! f = tvs[idx].vval.v_number; else EMSG(_("E807: Expected Float argument for printf()")); } --- 3912,3918 ---- if (tvs[idx].v_type == VAR_FLOAT) f = tvs[idx].vval.v_float; else if (tvs[idx].v_type == VAR_NUMBER) ! f = (double)tvs[idx].vval.v_number; else EMSG(_("E807: Expected Float argument for printf()")); } *************** *** 4170,4176 **** --- 4170,4180 ---- if (length_modifier == 'l' && *p == 'l') { /* double l = long long */ + # ifdef FEAT_NUM64 + length_modifier = 'L'; + # else length_modifier = 'l'; /* treat it as a single 'l' */ + # endif p++; } } *************** *** 4299,4304 **** --- 4303,4314 ---- long int long_arg = 0; unsigned long int ulong_arg = 0; + # ifdef FEAT_NUM64 + /* only defined for length modifier ll */ + varnumber_T llong_arg = 0; + uvarnumber_T ullong_arg = 0; + # endif + /* pointer argument value -only defined for p * conversion */ void *ptr_arg = NULL; *************** *** 4343,4348 **** --- 4353,4371 ---- else if (long_arg < 0) arg_sign = -1; break; + # ifdef FEAT_NUM64 + case 'L': + llong_arg = + # if defined(FEAT_EVAL) + tvs != NULL ? tv_nr(tvs, &arg_idx) : + # endif + va_arg(ap, varnumber_T); + if (llong_arg > 0) + arg_sign = 1; + else if (llong_arg < 0) + arg_sign = -1; + break; + # endif } } else *************** *** 4371,4376 **** --- 4394,4411 ---- if (ulong_arg != 0) arg_sign = 1; break; + # ifdef FEAT_NUM64 + case 'L': + ullong_arg = + # if defined(FEAT_EVAL) + tvs != NULL ? (uvarnumber_T) + tv_nr(tvs, &arg_idx) : + # endif + va_arg(ap, uvarnumber_T); + if (ullong_arg != 0) + arg_sign = 1; + break; + # endif } } *************** *** 4415,4431 **** } else { ! char f[5]; int f_l = 0; /* construct a simple format string for sprintf */ f[f_l++] = '%'; if (!length_modifier) ; ! else if (length_modifier == '2') { f[f_l++] = 'l'; f[f_l++] = 'l'; } else f[f_l++] = length_modifier; --- 4450,4476 ---- } else { ! char f[6]; int f_l = 0; /* construct a simple format string for sprintf */ f[f_l++] = '%'; if (!length_modifier) ; ! else if (length_modifier == 'L') { + # ifdef FEAT_NUM64 + # ifdef WIN3264 + f[f_l++] = 'I'; + f[f_l++] = '6'; + f[f_l++] = '4'; + # else f[f_l++] = 'l'; f[f_l++] = 'l'; + # endif + # else + f[f_l++] = 'l'; + # endif } else f[f_l++] = length_modifier; *************** *** 4446,4451 **** --- 4491,4501 ---- case 'l': str_arg_l += sprintf( tmp + str_arg_l, f, long_arg); break; + # ifdef FEAT_NUM64 + case 'L': str_arg_l += sprintf( + tmp + str_arg_l, f, llong_arg); + break; + # endif } } else *************** *** 4460,4465 **** --- 4510,4520 ---- case 'l': str_arg_l += sprintf( tmp + str_arg_l, f, ulong_arg); break; + # ifdef FEAT_NUM64 + case 'L': str_arg_l += sprintf( + tmp + str_arg_l, f, ullong_arg); + break; + # endif } } *** ../vim-7.4.1975/src/misc1.c 2016-07-01 17:17:13.290266761 +0200 --- src/misc1.c 2016-07-01 18:02:49.394215800 +0200 *************** *** 9169,9175 **** if (use_sandbox) ++sandbox; ++textlock; ! indent = eval_to_number(curbuf->b_p_inde); if (use_sandbox) --sandbox; --textlock; --- 9169,9175 ---- if (use_sandbox) ++sandbox; ++textlock; ! indent = (int)eval_to_number(curbuf->b_p_inde); if (use_sandbox) --sandbox; --textlock; *** ../vim-7.4.1975/src/misc2.c 2016-07-01 17:17:13.290266761 +0200 --- src/misc2.c 2016-07-01 18:02:49.394215800 +0200 *************** *** 2719,2725 **** int modifiers; int bit; int key; ! unsigned long n; int l; src = *srcp; --- 2719,2725 ---- int modifiers; int bit; int key; ! uvarnumber_T n; int l; src = *srcp; *** ../vim-7.4.1975/src/ops.c 2016-06-20 21:26:03.280671551 +0200 --- src/ops.c 2016-07-01 18:02:49.398215741 +0200 *************** *** 1179,1187 **** static int execreg_lastc = NUL; /* ! * execute a yank register: copy it into the stuff buffer * ! * return FAIL for failure, OK otherwise */ int do_execreg( --- 1179,1187 ---- static int execreg_lastc = NUL; /* ! * Execute a yank register: copy it into the stuff buffer. * ! * Return FAIL for failure, OK otherwise. */ int do_execreg( *************** *** 4755,4761 **** */ if (use_sandbox) ++sandbox; ! r = eval_to_number(curbuf->b_p_fex); if (use_sandbox) --sandbox; --- 4755,4761 ---- */ if (use_sandbox) ++sandbox; ! r = (int)eval_to_number(curbuf->b_p_fex); if (use_sandbox) --sandbox; *************** *** 5449,5456 **** char_u buf2[NUMBUFLEN]; int pre; /* 'X'/'x': hex; '0': octal; 'B'/'b': bin */ static int hexupper = FALSE; /* 0xABC */ ! unsigned long n; ! long_u oldn; char_u *ptr; int c; int todel; --- 5449,5456 ---- char_u buf2[NUMBUFLEN]; int pre; /* 'X'/'x': hex; '0': octal; 'B'/'b': bin */ static int hexupper = FALSE; /* 0xABC */ ! uvarnumber_T n; ! uvarnumber_T oldn; char_u *ptr; int c; int todel; *************** *** 5708,5716 **** oldn = n; if (subtract) ! n -= (unsigned long)Prenum1; else ! n += (unsigned long)Prenum1; /* handle wraparound for decimal numbers */ if (!pre) { --- 5708,5716 ---- oldn = n; if (subtract) ! n -= (uvarnumber_T)Prenum1; else ! n += (uvarnumber_T)Prenum1; /* handle wraparound for decimal numbers */ if (!pre) { *************** *** 5718,5724 **** { if (n > oldn) { ! n = 1 + (n ^ (unsigned long)-1); negative ^= TRUE; } } --- 5718,5724 ---- { if (n > oldn) { ! n = 1 + (n ^ (uvarnumber_T)-1); negative ^= TRUE; } } *************** *** 5727,5733 **** /* add */ if (n < oldn) { ! n = (n ^ (unsigned long)-1); negative ^= TRUE; } } --- 5727,5733 ---- /* add */ if (n < oldn) { ! n = (n ^ (uvarnumber_T)-1); negative ^= TRUE; } } *************** *** 5803,5809 **** { int i; int bit = 0; ! int bits = sizeof(unsigned long) * 8; /* leading zeros */ for (bit = bits; bit > 0; bit--) --- 5803,5809 ---- { int i; int bit = 0; ! int bits = sizeof(uvarnumber_T) * 8; /* leading zeros */ for (bit = bits; bit > 0; bit--) *************** *** 5815,5827 **** buf2[i] = '\0'; } else if (pre == 0) ! sprintf((char *)buf2, "%lu", n); else if (pre == '0') ! sprintf((char *)buf2, "%lo", n); else if (pre && hexupper) ! sprintf((char *)buf2, "%lX", n); else ! sprintf((char *)buf2, "%lx", n); length -= (int)STRLEN(buf2); /* --- 5815,5827 ---- buf2[i] = '\0'; } else if (pre == 0) ! vim_snprintf((char *)buf2, NUMBUFLEN, "%llu", n); else if (pre == '0') ! vim_snprintf((char *)buf2, NUMBUFLEN, "%llo", n); else if (pre && hexupper) ! vim_snprintf((char *)buf2, NUMBUFLEN, "%llX", n); else ! vim_snprintf((char *)buf2, NUMBUFLEN, "%llx", n); length -= (int)STRLEN(buf2); /* *************** *** 7086,7092 **** vim_memset(oap, 0, sizeof(oparg_T)); } ! static long line_count_info(char_u *line, long *wc, long *cc, long limit, int eol_size); /* * Count the number of bytes, characters and "words" in a line. --- 7086,7092 ---- vim_memset(oap, 0, sizeof(oparg_T)); } ! static varnumber_T line_count_info(char_u *line, varnumber_T *wc, varnumber_T *cc, varnumber_T limit, int eol_size); /* * Count the number of bytes, characters and "words" in a line. *************** *** 7102,7118 **** * case, eol_size will be added to the character count to account for * the size of the EOL character. */ ! static long line_count_info( char_u *line, ! long *wc, ! long *cc, ! long limit, int eol_size) { ! long i; ! long words = 0; ! long chars = 0; int is_word = 0; for (i = 0; i < limit && line[i] != NUL; ) --- 7102,7118 ---- * case, eol_size will be added to the character count to account for * the size of the EOL character. */ ! static varnumber_T line_count_info( char_u *line, ! varnumber_T *wc, ! varnumber_T *cc, ! varnumber_T limit, int eol_size) { ! varnumber_T i; ! varnumber_T words = 0; ! varnumber_T chars = 0; int is_word = 0; for (i = 0; i < limit && line[i] != NUL; ) *************** *** 7162,7178 **** char_u buf1[50]; char_u buf2[40]; linenr_T lnum; ! long byte_count = 0; #ifdef FEAT_MBYTE ! long bom_count = 0; #endif ! long byte_count_cursor = 0; ! long char_count = 0; ! long char_count_cursor = 0; ! long word_count = 0; ! long word_count_cursor = 0; int eol_size; ! long last_check = 100000L; long line_count_selected = 0; pos_T min_pos, max_pos; oparg_T oparg; --- 7162,7178 ---- char_u buf1[50]; char_u buf2[40]; linenr_T lnum; ! varnumber_T byte_count = 0; #ifdef FEAT_MBYTE ! varnumber_T bom_count = 0; #endif ! varnumber_T byte_count_cursor = 0; ! varnumber_T char_count = 0; ! varnumber_T char_count_cursor = 0; ! varnumber_T word_count = 0; ! varnumber_T word_count_cursor = 0; int eol_size; ! varnumber_T last_check = 100000L; long line_count_selected = 0; pos_T min_pos, max_pos; oparg_T oparg; *************** *** 7308,7319 **** byte_count_cursor = byte_count + line_count_info(ml_get(lnum), &word_count_cursor, &char_count_cursor, ! (long)(curwin->w_cursor.col + 1), eol_size); } } /* Add to the running totals */ byte_count += line_count_info(ml_get(lnum), &word_count, ! &char_count, (long)MAXCOL, eol_size); } /* Correction for when last line doesn't have an EOL. */ --- 7308,7321 ---- byte_count_cursor = byte_count + line_count_info(ml_get(lnum), &word_count_cursor, &char_count_cursor, ! (varnumber_T)(curwin->w_cursor.col + 1), ! eol_size); } } /* Add to the running totals */ byte_count += line_count_info(ml_get(lnum), &word_count, ! &char_count, (varnumber_T)MAXCOL, ! eol_size); } /* Correction for when last line doesn't have an EOL. */ *************** *** 7337,7350 **** if (char_count_cursor == byte_count_cursor && char_count == byte_count) vim_snprintf((char *)IObuff, IOSIZE, ! _("Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Bytes"), buf1, line_count_selected, (long)curbuf->b_ml.ml_line_count, word_count_cursor, word_count, byte_count_cursor, byte_count); else vim_snprintf((char *)IObuff, IOSIZE, ! _("Selected %s%ld of %ld Lines; %ld of %ld Words; %ld of %ld Chars; %ld of %ld Bytes"), buf1, line_count_selected, (long)curbuf->b_ml.ml_line_count, word_count_cursor, word_count, --- 7339,7352 ---- if (char_count_cursor == byte_count_cursor && char_count == byte_count) vim_snprintf((char *)IObuff, IOSIZE, ! _("Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Bytes"), buf1, line_count_selected, (long)curbuf->b_ml.ml_line_count, word_count_cursor, word_count, byte_count_cursor, byte_count); else vim_snprintf((char *)IObuff, IOSIZE, ! _("Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld of %lld Bytes"), buf1, line_count_selected, (long)curbuf->b_ml.ml_line_count, word_count_cursor, word_count, *************** *** 7363,7369 **** if (char_count_cursor == byte_count_cursor && char_count == byte_count) vim_snprintf((char *)IObuff, IOSIZE, ! _("Col %s of %s; Line %ld of %ld; Word %ld of %ld; Byte %ld of %ld"), (char *)buf1, (char *)buf2, (long)curwin->w_cursor.lnum, (long)curbuf->b_ml.ml_line_count, --- 7365,7371 ---- if (char_count_cursor == byte_count_cursor && char_count == byte_count) vim_snprintf((char *)IObuff, IOSIZE, ! _("Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld"), (char *)buf1, (char *)buf2, (long)curwin->w_cursor.lnum, (long)curbuf->b_ml.ml_line_count, *************** *** 7371,7377 **** byte_count_cursor, byte_count); else vim_snprintf((char *)IObuff, IOSIZE, ! _("Col %s of %s; Line %ld of %ld; Word %ld of %ld; Char %ld of %ld; Byte %ld of %ld"), (char *)buf1, (char *)buf2, (long)curwin->w_cursor.lnum, (long)curbuf->b_ml.ml_line_count, --- 7373,7379 ---- byte_count_cursor, byte_count); else vim_snprintf((char *)IObuff, IOSIZE, ! _("Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte %lld of %lld"), (char *)buf1, (char *)buf2, (long)curwin->w_cursor.lnum, (long)curbuf->b_ml.ml_line_count, *************** *** 7399,7417 **** #if defined(FEAT_EVAL) if (dict != NULL) { ! dict_add_nr_str(dict, "words", (long)word_count, NULL); ! dict_add_nr_str(dict, "chars", (long)char_count, NULL); ! dict_add_nr_str(dict, "bytes", (long)byte_count # ifdef FEAT_MBYTE + bom_count # endif , NULL); dict_add_nr_str(dict, VIsual_active ? "visual_bytes" : "cursor_bytes", ! (long)byte_count_cursor, NULL); dict_add_nr_str(dict, VIsual_active ? "visual_chars" : "cursor_chars", ! (long)char_count_cursor, NULL); dict_add_nr_str(dict, VIsual_active ? "visual_words" : "cursor_words", ! (long)word_count_cursor, NULL); } #endif } --- 7401,7419 ---- #if defined(FEAT_EVAL) if (dict != NULL) { ! dict_add_nr_str(dict, "words", word_count, NULL); ! dict_add_nr_str(dict, "chars", char_count, NULL); ! dict_add_nr_str(dict, "bytes", byte_count # ifdef FEAT_MBYTE + bom_count # endif , NULL); dict_add_nr_str(dict, VIsual_active ? "visual_bytes" : "cursor_bytes", ! byte_count_cursor, NULL); dict_add_nr_str(dict, VIsual_active ? "visual_chars" : "cursor_chars", ! char_count_cursor, NULL); dict_add_nr_str(dict, VIsual_active ? "visual_words" : "cursor_words", ! word_count_cursor, NULL); } #endif } *** ../vim-7.4.1975/src/option.c 2016-06-26 18:37:51.890998592 +0200 --- src/option.c 2016-07-01 18:02:49.398215741 +0200 *************** *** 4179,4185 **** int afterchar; /* character just after option name */ int len; int i; ! long value; int key; long_u flags; /* flags for current option */ char_u *varp = NULL; /* pointer to variable for current option */ --- 4179,4185 ---- int afterchar; /* character just after option name */ int len; int i; ! varnumber_T value; int key; long_u flags; /* flags for current option */ char_u *varp = NULL; /* pointer to variable for current option */ *************** *** 9102,9108 **** if ((int *)varp == &curbuf->b_changed) *numval = curbufIsChanged(); else ! *numval = *(int *)varp; } return 1; } --- 9102,9108 ---- if ((int *)varp == &curbuf->b_changed) *numval = curbufIsChanged(); else ! *numval = (long) *(varnumber_T *)varp; } return 1; } *** ../vim-7.4.1975/src/proto/charset.pro 2016-01-19 13:21:55.833334420 +0100 --- src/proto/charset.pro 2016-07-01 18:02:49.398215741 +0200 *************** *** 52,58 **** char_u *skiptowhite_esc(char_u *p); long getdigits(char_u **pp); int vim_isblankline(char_u *lbuf); ! void vim_str2nr(char_u *start, int *prep, int *len, int what, long *nptr, unsigned long *unptr, int maxlen); int hex2nr(int c); int hexhex2nr(char_u *p); int rem_backslash(char_u *str); --- 52,58 ---- char_u *skiptowhite_esc(char_u *p); long getdigits(char_u **pp); int vim_isblankline(char_u *lbuf); ! void vim_str2nr(char_u *start, int *prep, int *len, int what, varnumber_T *nptr, uvarnumber_T *unptr, int maxlen); int hex2nr(int c); int hexhex2nr(char_u *p); int rem_backslash(char_u *str); *** ../vim-7.4.1975/src/proto/eval.pro 2016-04-14 15:55:58.405348448 +0200 --- src/proto/eval.pro 2016-07-01 18:02:49.398215741 +0200 *************** *** 19,30 **** int skip_expr(char_u **pp); char_u *eval_to_string(char_u *arg, char_u **nextcmd, int convert); char_u *eval_to_string_safe(char_u *arg, char_u **nextcmd, int use_sandbox); ! int eval_to_number(char_u *expr); list_T *eval_spell_expr(char_u *badword, char_u *expr); int get_spellword(list_T *list, char_u **pp); typval_T *eval_expr(char_u *arg, char_u **nextcmd); int call_vim_function(char_u *func, int argc, char_u **argv, int safe, int str_arg_only, typval_T *rettv); ! long call_func_retnr(char_u *func, int argc, char_u **argv, int safe); void *call_func_retstr(char_u *func, int argc, char_u **argv, int safe); void *call_func_retlist(char_u *func, int argc, char_u **argv, int safe); void *save_funccal(void); --- 19,30 ---- int skip_expr(char_u **pp); char_u *eval_to_string(char_u *arg, char_u **nextcmd, int convert); char_u *eval_to_string_safe(char_u *arg, char_u **nextcmd, int use_sandbox); ! varnumber_T eval_to_number(char_u *expr); list_T *eval_spell_expr(char_u *badword, char_u *expr); int get_spellword(list_T *list, char_u **pp); typval_T *eval_expr(char_u *arg, char_u **nextcmd); int call_vim_function(char_u *func, int argc, char_u **argv, int safe, int str_arg_only, typval_T *rettv); ! varnumber_T call_func_retnr(char_u *func, int argc, char_u **argv, int safe); void *call_func_retstr(char_u *func, int argc, char_u **argv, int safe); void *call_func_retlist(char_u *func, int argc, char_u **argv, int safe); void *save_funccal(void); *************** *** 76,86 **** dictitem_T *dictitem_alloc(char_u *key); void dictitem_free(dictitem_T *item); int dict_add(dict_T *d, dictitem_T *item); ! int dict_add_nr_str(dict_T *d, char *key, long nr, char_u *str); int dict_add_list(dict_T *d, char *key, list_T *list); dictitem_T *dict_find(dict_T *d, char_u *key, int len); char_u *get_dict_string(dict_T *d, char_u *key, int save); ! long get_dict_number(dict_T *d, char_u *key); int string2float(char_u *text, float_T *value); char_u *get_function_name(expand_T *xp, int idx); char_u *get_expr_name(expand_T *xp, int idx); --- 76,86 ---- dictitem_T *dictitem_alloc(char_u *key); void dictitem_free(dictitem_T *item); int dict_add(dict_T *d, dictitem_T *item); ! int dict_add_nr_str(dict_T *d, char *key, varnumber_T nr, char_u *str); int dict_add_list(dict_T *d, char *key, list_T *list); dictitem_T *dict_find(dict_T *d, char_u *key, int len); char_u *get_dict_string(dict_T *d, char_u *key, int save); ! varnumber_T get_dict_number(dict_T *d, char_u *key); int string2float(char_u *text, float_T *value); char_u *get_function_name(expand_T *xp, int idx); char_u *get_expr_name(expand_T *xp, int idx); *************** *** 92,99 **** float_T vim_round(float_T f); long do_searchpair(char_u *spat, char_u *mpat, char_u *epat, int dir, char_u *skip, int flags, pos_T *match_pos, linenr_T lnum_stop, long time_limit); char_u *get_callback(typval_T *arg, partial_T **pp); ! void set_vim_var_nr(int idx, long val); ! long get_vim_var_nr(int idx); char_u *get_vim_var_str(int idx); list_T *get_vim_var_list(int idx); void set_vim_var_char(int c); --- 92,99 ---- float_T vim_round(float_T f); long do_searchpair(char_u *spat, char_u *mpat, char_u *epat, int dir, char_u *skip, int flags, pos_T *match_pos, linenr_T lnum_stop, long time_limit); char_u *get_callback(typval_T *arg, partial_T **pp); ! void set_vim_var_nr(int idx, varnumber_T val); ! varnumber_T get_vim_var_nr(int idx); char_u *get_vim_var_str(int idx); list_T *get_vim_var_list(int idx); void set_vim_var_char(int c); *************** *** 108,115 **** typval_T *alloc_tv(void); void free_tv(typval_T *varp); void clear_tv(typval_T *varp); ! long get_tv_number(typval_T *varp); ! long get_tv_number_chk(typval_T *varp, int *denote); char_u *get_tv_string(typval_T *varp); char_u *get_tv_string_buf(typval_T *varp, char_u *buf); char_u *get_tv_string_chk(typval_T *varp); --- 108,115 ---- typval_T *alloc_tv(void); void free_tv(typval_T *varp); void clear_tv(typval_T *varp); ! varnumber_T get_tv_number(typval_T *varp); ! varnumber_T get_tv_number_chk(typval_T *varp, int *denote); char_u *get_tv_string(typval_T *varp); char_u *get_tv_string_buf(typval_T *varp, char_u *buf); char_u *get_tv_string_chk(typval_T *varp); *** ../vim-7.4.1975/src/quickfix.c 2016-07-01 17:17:13.294266702 +0200 --- src/quickfix.c 2016-07-01 18:02:49.398215741 +0200 *************** *** 4377,4387 **** continue; filename = get_dict_string(d, (char_u *)"filename", TRUE); ! bufnum = get_dict_number(d, (char_u *)"bufnr"); ! lnum = get_dict_number(d, (char_u *)"lnum"); ! col = get_dict_number(d, (char_u *)"col"); ! vcol = get_dict_number(d, (char_u *)"vcol"); ! nr = get_dict_number(d, (char_u *)"nr"); type = get_dict_string(d, (char_u *)"type", TRUE); pattern = get_dict_string(d, (char_u *)"pattern", TRUE); text = get_dict_string(d, (char_u *)"text", TRUE); --- 4377,4387 ---- continue; filename = get_dict_string(d, (char_u *)"filename", TRUE); ! bufnum = (int)get_dict_number(d, (char_u *)"bufnr"); ! lnum = (int)get_dict_number(d, (char_u *)"lnum"); ! col = (int)get_dict_number(d, (char_u *)"col"); ! vcol = (int)get_dict_number(d, (char_u *)"vcol"); ! nr = (int)get_dict_number(d, (char_u *)"nr"); type = get_dict_string(d, (char_u *)"type", TRUE); pattern = get_dict_string(d, (char_u *)"pattern", TRUE); text = get_dict_string(d, (char_u *)"text", TRUE); *** ../vim-7.4.1975/src/structs.h 2016-07-01 17:17:13.294266702 +0200 --- src/structs.h 2016-07-01 18:02:49.398215741 +0200 *************** *** 1111,1121 **** typedef long_u hash_T; /* Type for hi_hash */ ! #if VIM_SIZEOF_INT <= 3 /* use long if int is smaller than 32 bits */ ! typedef long varnumber_T; #else ! typedef int varnumber_T; #endif typedef double float_T; typedef struct listvar_S list_T; --- 1111,1139 ---- typedef long_u hash_T; /* Type for hi_hash */ ! #ifdef FEAT_NUM64 ! /* Use 64-bit Number. */ ! # ifdef WIN3264 ! typedef __int64 varnumber_T; ! typedef unsigned __int64 uvarnumber_T; ! # elif defined(HAVE_STDINT_H) ! typedef int64_t varnumber_T; ! typedef uint64_t uvarnumber_T; ! # else ! typedef long varnumber_T; ! typedef unsigned long uvarnumber_T; ! # endif #else ! /* Use 32-bit Number. */ ! # if VIM_SIZEOF_INT <= 3 /* use long if int is smaller than 32 bits */ ! typedef long varnumber_T; ! typedef unsigned long uvarnumber_T; ! # else ! typedef int varnumber_T; ! typedef unsigned int uvarnumber_T; ! # endif #endif + typedef double float_T; typedef struct listvar_S list_T; *** ../vim-7.4.1975/src/testdir/test_viml.vim 2016-05-31 22:31:19.778640756 +0200 --- src/testdir/test_viml.vim 2016-07-01 18:02:49.398215741 +0200 *************** *** 1197,1202 **** --- 1197,1230 ---- endfunc "------------------------------------------------------------------------------- + " Test 94: 64-bit Numbers {{{1 + "------------------------------------------------------------------------------- + + func Test_num64() + if !has('num64') + return + endif + + call assert_notequal( 4294967296, 0) + call assert_notequal(-4294967296, 0) + call assert_equal( 4294967296, 0xFFFFffff + 1) + call assert_equal(-4294967296, -0xFFFFffff - 1) + + call assert_equal( 9223372036854775807, 1 / 0) + call assert_equal(-9223372036854775807, -1 / 0) + call assert_equal(-9223372036854775808, 0 / 0) + + call assert_equal( 0x7FFFffffFFFFffff, float2nr( 1.0e150)) + call assert_equal(-0x7FFFffffFFFFffff, float2nr(-1.0e150)) + + let rng = range(0xFFFFffff, 0x100000001) + call assert_equal([0xFFFFffff, 0x100000000, 0x100000001], rng) + call assert_equal(0x100000001, max(rng)) + call assert_equal(0xFFFFffff, min(rng)) + call assert_equal(rng, sort(range(0x100000001, 0xFFFFffff, -1), 'N')) + endfunc + + "------------------------------------------------------------------------------- " Modelines {{{1 " vim: ts=8 sw=4 tw=80 fdm=marker " vim: fdt=substitute(substitute(foldtext(),\ '\\%(^+--\\)\\@<=\\(\\s*\\)\\(.\\{-}\\)\:\ \\%(\"\ \\)\\=\\(Test\ \\d*\\)\:\\s*',\ '\\3\ (\\2)\:\ \\1',\ \"\"),\ '\\(Test\\s*\\)\\(\\d\\)\\D\\@=',\ '\\1\ \\2',\ "") *** ../vim-7.4.1975/src/version.c 2016-07-01 17:17:13.298266645 +0200 --- src/version.c 2016-07-01 18:09:07.172699440 +0200 *************** *** 455,460 **** --- 455,465 ---- #else "-netbeans_intg", #endif + #ifdef FEAT_NUM64 + "+num64", + #else + "-num64", + #endif #ifdef FEAT_GUI_W32 # ifdef FEAT_OLE "+ole", *** ../vim-7.4.1975/src/version.c 2016-07-01 17:17:13.298266645 +0200 --- src/version.c 2016-07-01 18:09:07.172699440 +0200 *************** *** 755,756 **** --- 760,763 ---- { /* Add new patch number below this line */ + /**/ + 1976, /**/ -- hundred-and-one symptoms of being an internet addict: 173. You keep tracking down the email addresses of all your friends (even childhood friends). /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///