|
Karsten Hopp |
8a1227 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
8a1227 |
Subject: Patch 7.3.1159
|
|
Karsten Hopp |
8a1227 |
Fcc: outbox
|
|
Karsten Hopp |
8a1227 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
8a1227 |
Mime-Version: 1.0
|
|
Karsten Hopp |
8a1227 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
8a1227 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
8a1227 |
------------
|
|
Karsten Hopp |
8a1227 |
|
|
Karsten Hopp |
8a1227 |
Patch 7.3.1159
|
|
Karsten Hopp |
8a1227 |
Problem: The round() function is not always available. (Christ van
|
|
Karsten Hopp |
8a1227 |
Willegen)
|
|
Karsten Hopp |
8a1227 |
Solution: Use the solution from f_round().
|
|
Karsten Hopp |
8a1227 |
Files: src/ex_cmds2.c, src/eval.c, src/proto/eval.pro
|
|
Karsten Hopp |
8a1227 |
|
|
Karsten Hopp |
8a1227 |
|
|
Karsten Hopp |
8a1227 |
*** ../vim-7.3.1158/src/ex_cmds2.c 2013-06-08 18:19:39.000000000 +0200
|
|
Karsten Hopp |
8a1227 |
--- src/ex_cmds2.c 2013-06-10 20:06:00.000000000 +0200
|
|
Karsten Hopp |
8a1227 |
***************
|
|
Karsten Hopp |
8a1227 |
*** 982,988 ****
|
|
Karsten Hopp |
8a1227 |
double usec = (tm->tv_sec * 1000000.0 + tm->tv_usec) / count;
|
|
Karsten Hopp |
8a1227 |
|
|
Karsten Hopp |
8a1227 |
tm2->tv_sec = floor(usec / 1000000.0);
|
|
Karsten Hopp |
8a1227 |
! tm2->tv_usec = round(usec - (tm2->tv_sec * 1000000.0));
|
|
Karsten Hopp |
8a1227 |
# endif
|
|
Karsten Hopp |
8a1227 |
}
|
|
Karsten Hopp |
8a1227 |
}
|
|
Karsten Hopp |
8a1227 |
--- 982,988 ----
|
|
Karsten Hopp |
8a1227 |
double usec = (tm->tv_sec * 1000000.0 + tm->tv_usec) / count;
|
|
Karsten Hopp |
8a1227 |
|
|
Karsten Hopp |
8a1227 |
tm2->tv_sec = floor(usec / 1000000.0);
|
|
Karsten Hopp |
8a1227 |
! tm2->tv_usec = vim_round(usec - (tm2->tv_sec * 1000000.0));
|
|
Karsten Hopp |
8a1227 |
# endif
|
|
Karsten Hopp |
8a1227 |
}
|
|
Karsten Hopp |
8a1227 |
}
|
|
Karsten Hopp |
8a1227 |
*** ../vim-7.3.1158/src/eval.c 2013-06-09 20:50:56.000000000 +0200
|
|
Karsten Hopp |
8a1227 |
--- src/eval.c 2013-06-10 20:05:59.000000000 +0200
|
|
Karsten Hopp |
8a1227 |
***************
|
|
Karsten Hopp |
8a1227 |
*** 15774,15779 ****
|
|
Karsten Hopp |
8a1227 |
--- 15774,15790 ----
|
|
Karsten Hopp |
8a1227 |
}
|
|
Karsten Hopp |
8a1227 |
|
|
Karsten Hopp |
8a1227 |
#ifdef FEAT_FLOAT
|
|
Karsten Hopp |
8a1227 |
+
|
|
Karsten Hopp |
8a1227 |
+ /*
|
|
Karsten Hopp |
8a1227 |
+ * round() is not in C90, use ceil() or floor() instead.
|
|
Karsten Hopp |
8a1227 |
+ */
|
|
Karsten Hopp |
8a1227 |
+ float_T
|
|
Karsten Hopp |
8a1227 |
+ vim_round(f)
|
|
Karsten Hopp |
8a1227 |
+ float_T f;
|
|
Karsten Hopp |
8a1227 |
+ {
|
|
Karsten Hopp |
8a1227 |
+ return f > 0 ? floor(f + 0.5) : ceil(f - 0.5);
|
|
Karsten Hopp |
8a1227 |
+ }
|
|
Karsten Hopp |
8a1227 |
+
|
|
Karsten Hopp |
8a1227 |
/*
|
|
Karsten Hopp |
8a1227 |
* "round({float})" function
|
|
Karsten Hopp |
8a1227 |
*/
|
|
Karsten Hopp |
8a1227 |
***************
|
|
Karsten Hopp |
8a1227 |
*** 15786,15793 ****
|
|
Karsten Hopp |
8a1227 |
|
|
Karsten Hopp |
8a1227 |
rettv->v_type = VAR_FLOAT;
|
|
Karsten Hopp |
8a1227 |
if (get_float_arg(argvars, &f) == OK)
|
|
Karsten Hopp |
8a1227 |
! /* round() is not in C90, use ceil() or floor() instead. */
|
|
Karsten Hopp |
8a1227 |
! rettv->vval.v_float = f > 0 ? floor(f + 0.5) : ceil(f - 0.5);
|
|
Karsten Hopp |
8a1227 |
else
|
|
Karsten Hopp |
8a1227 |
rettv->vval.v_float = 0.0;
|
|
Karsten Hopp |
8a1227 |
}
|
|
Karsten Hopp |
8a1227 |
--- 15797,15803 ----
|
|
Karsten Hopp |
8a1227 |
|
|
Karsten Hopp |
8a1227 |
rettv->v_type = VAR_FLOAT;
|
|
Karsten Hopp |
8a1227 |
if (get_float_arg(argvars, &f) == OK)
|
|
Karsten Hopp |
8a1227 |
! rettv->vval.v_float = vim_round(f);
|
|
Karsten Hopp |
8a1227 |
else
|
|
Karsten Hopp |
8a1227 |
rettv->vval.v_float = 0.0;
|
|
Karsten Hopp |
8a1227 |
}
|
|
Karsten Hopp |
8a1227 |
*** ../vim-7.3.1158/src/proto/eval.pro 2013-05-30 13:37:23.000000000 +0200
|
|
Karsten Hopp |
8a1227 |
--- src/proto/eval.pro 2013-06-10 20:05:57.000000000 +0200
|
|
Karsten Hopp |
8a1227 |
***************
|
|
Karsten Hopp |
8a1227 |
*** 75,87 ****
|
|
Karsten Hopp |
8a1227 |
dictitem_T *dict_find __ARGS((dict_T *d, char_u *key, int len));
|
|
Karsten Hopp |
8a1227 |
char_u *get_dict_string __ARGS((dict_T *d, char_u *key, int save));
|
|
Karsten Hopp |
8a1227 |
long get_dict_number __ARGS((dict_T *d, char_u *key));
|
|
Karsten Hopp |
8a1227 |
- void dict_extend __ARGS((dict_T *d1, dict_T *d2, char_u *action));
|
|
Karsten Hopp |
8a1227 |
char_u *get_function_name __ARGS((expand_T *xp, int idx));
|
|
Karsten Hopp |
8a1227 |
char_u *get_expr_name __ARGS((expand_T *xp, int idx));
|
|
Karsten Hopp |
8a1227 |
- char_u *get_expanded_name __ARGS((char_u *name, int check));
|
|
Karsten Hopp |
8a1227 |
- int translated_function_exists __ARGS((char_u *name));
|
|
Karsten Hopp |
8a1227 |
int func_call __ARGS((char_u *name, typval_T *args, dict_T *selfdict, typval_T *rettv));
|
|
Karsten Hopp |
8a1227 |
void mzscheme_call_vim __ARGS((char_u *name, typval_T *args, typval_T *rettv));
|
|
Karsten Hopp |
8a1227 |
long do_searchpair __ARGS((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));
|
|
Karsten Hopp |
8a1227 |
void set_vim_var_nr __ARGS((int idx, long val));
|
|
Karsten Hopp |
8a1227 |
long get_vim_var_nr __ARGS((int idx));
|
|
Karsten Hopp |
8a1227 |
--- 75,86 ----
|
|
Karsten Hopp |
8a1227 |
dictitem_T *dict_find __ARGS((dict_T *d, char_u *key, int len));
|
|
Karsten Hopp |
8a1227 |
char_u *get_dict_string __ARGS((dict_T *d, char_u *key, int save));
|
|
Karsten Hopp |
8a1227 |
long get_dict_number __ARGS((dict_T *d, char_u *key));
|
|
Karsten Hopp |
8a1227 |
char_u *get_function_name __ARGS((expand_T *xp, int idx));
|
|
Karsten Hopp |
8a1227 |
char_u *get_expr_name __ARGS((expand_T *xp, int idx));
|
|
Karsten Hopp |
8a1227 |
int func_call __ARGS((char_u *name, typval_T *args, dict_T *selfdict, typval_T *rettv));
|
|
Karsten Hopp |
8a1227 |
+ void dict_extend __ARGS((dict_T *d1, dict_T *d2, char_u *action));
|
|
Karsten Hopp |
8a1227 |
void mzscheme_call_vim __ARGS((char_u *name, typval_T *args, typval_T *rettv));
|
|
Karsten Hopp |
8a1227 |
+ float_T vim_round __ARGS((float_T f));
|
|
Karsten Hopp |
8a1227 |
long do_searchpair __ARGS((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));
|
|
Karsten Hopp |
8a1227 |
void set_vim_var_nr __ARGS((int idx, long val));
|
|
Karsten Hopp |
8a1227 |
long get_vim_var_nr __ARGS((int idx));
|
|
Karsten Hopp |
8a1227 |
***************
|
|
Karsten Hopp |
8a1227 |
*** 110,115 ****
|
|
Karsten Hopp |
8a1227 |
--- 109,116 ----
|
|
Karsten Hopp |
8a1227 |
void ex_execute __ARGS((exarg_T *eap));
|
|
Karsten Hopp |
8a1227 |
void ex_function __ARGS((exarg_T *eap));
|
|
Karsten Hopp |
8a1227 |
void free_all_functions __ARGS((void));
|
|
Karsten Hopp |
8a1227 |
+ int translated_function_exists __ARGS((char_u *name));
|
|
Karsten Hopp |
8a1227 |
+ char_u *get_expanded_name __ARGS((char_u *name, int check));
|
|
Karsten Hopp |
8a1227 |
void func_dump_profile __ARGS((FILE *fd));
|
|
Karsten Hopp |
8a1227 |
char_u *get_user_func_name __ARGS((expand_T *xp, int idx));
|
|
Karsten Hopp |
8a1227 |
void ex_delfunction __ARGS((exarg_T *eap));
|
|
Karsten Hopp |
8a1227 |
*** ../vim-7.3.1158/src/version.c 2013-06-10 18:36:20.000000000 +0200
|
|
Karsten Hopp |
8a1227 |
--- src/version.c 2013-06-10 20:02:01.000000000 +0200
|
|
Karsten Hopp |
8a1227 |
***************
|
|
Karsten Hopp |
8a1227 |
*** 730,731 ****
|
|
Karsten Hopp |
8a1227 |
--- 730,733 ----
|
|
Karsten Hopp |
8a1227 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
8a1227 |
+ /**/
|
|
Karsten Hopp |
8a1227 |
+ 1159,
|
|
Karsten Hopp |
8a1227 |
/**/
|
|
Karsten Hopp |
8a1227 |
|
|
Karsten Hopp |
8a1227 |
--
|
|
Karsten Hopp |
8a1227 |
hundred-and-one symptoms of being an internet addict:
|
|
Karsten Hopp |
8a1227 |
134. You consider bandwidth to be more important than carats.
|
|
Karsten Hopp |
8a1227 |
|
|
Karsten Hopp |
8a1227 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
8a1227 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
8a1227 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
8a1227 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|