diff options
author | Bram Moolenaar <Bram@vim.org> | 2005-03-07 23:16:51 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2005-03-07 23:16:51 +0000 |
commit | e4efc3b27052385c6466f133ac1b0931b7e4c855 (patch) | |
tree | 4f03a30a3323a5fbe0ceba3fa47e2c2503e60d7c /src | |
parent | 44ecf65f74749995760eea6a1082f59d94817cbe (diff) |
updated for version 7.0057
Diffstat (limited to 'src')
-rwxr-xr-x | src/auto/configure | 2 | ||||
-rw-r--r-- | src/configure.in | 2 | ||||
-rw-r--r-- | src/gui_mac.c | 26 | ||||
-rw-r--r-- | src/gui_w32.c | 2 | ||||
-rw-r--r-- | src/proto/gui_gtk.pro | 1 | ||||
-rw-r--r-- | src/proto/netbeans.pro | 2 | ||||
-rw-r--r-- | src/proto/workshop.pro | 1 | ||||
-rw-r--r-- | src/quickfix.c | 27 | ||||
-rw-r--r-- | src/regexp.c | 198 | ||||
-rw-r--r-- | src/workshop.c | 38 |
10 files changed, 95 insertions, 204 deletions
diff --git a/src/auto/configure b/src/auto/configure index 1a0a5a7ee1..f22fee3d80 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -4629,7 +4629,7 @@ fi if test "X$vi_cv_path_ruby" != "X"; then echo "$as_me:$LINENO: checking Ruby version" >&5 echo $ECHO_N "checking Ruby version... $ECHO_C" >&6 - if $vi_cv_path_ruby -e 'VERSION >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then + if $vi_cv_path_ruby -e 'RUBY_VERSION >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then echo "$as_me:$LINENO: result: OK" >&5 echo "${ECHO_T}OK" >&6 echo "$as_me:$LINENO: checking Ruby header files" >&5 diff --git a/src/configure.in b/src/configure.in index cc8d00e5ff..fb8e330594 100644 --- a/src/configure.in +++ b/src/configure.in @@ -807,7 +807,7 @@ if test "$enable_rubyinterp" = "yes"; then AC_PATH_PROG(vi_cv_path_ruby, ruby) if test "X$vi_cv_path_ruby" != "X"; then AC_MSG_CHECKING(Ruby version) - if $vi_cv_path_ruby -e 'VERSION >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then + if $vi_cv_path_ruby -e '(VERSION rescue RUBY_VERSION) >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then AC_MSG_RESULT(OK) AC_MSG_CHECKING(Ruby header files) rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e 'print Config::CONFIG[["archdir"]] || $hdrdir' 2>/dev/null` diff --git a/src/gui_mac.c b/src/gui_mac.c index bbf329dfda..03dc326f68 100644 --- a/src/gui_mac.c +++ b/src/gui_mac.c @@ -3879,6 +3879,12 @@ gui_mch_init_font(font_name, fontset) TextSize(font >> 16); TextFont(font & 0xFFFF); + GetFontInfo(&font_info); + + gui.char_ascent = font_info.ascent; + gui.char_width = CharWidth('_'); + gui.char_height = font_info.ascent + font_info.descent + p_linespace; + #ifdef USE_ATSUI_DRAWING ATSUFontID fontID; Fixed fontSize; @@ -3927,12 +3933,6 @@ gui_mch_init_font(font_name, fontset) } #endif - GetFontInfo(&font_info); - - gui.char_ascent = font_info.ascent; - gui.char_width = CharWidth('_'); - gui.char_height = font_info.ascent + font_info.descent + p_linespace; - return OK; } @@ -4313,11 +4313,6 @@ gui_mch_draw_string(row, col, s, len, flags) int len; int flags; { -#if defined(FEAT_GUI) && defined(MACOS_X) -#ifndef USE_ATSUI_DRAWING - SInt32 sys_version; -#endif -#endif #ifdef FEAT_MBYTE #ifdef USE_ATSUI_DRAWING /* ATSUI requires utf-16 strings */ @@ -4342,10 +4337,7 @@ gui_mch_draw_string(row, col, s, len, flags) /* * On OS X, try using Quartz-style text antialiasing. */ - sys_version = 0; - - Gestalt(gestaltSystemVersion, &sys_version); - if (sys_version >= 0x1020) + if (gMacSystemVersion >= 0x1020) { /* Quartz antialiasing is available only in OS 10.2 and later. */ UInt32 qd_flags = (p_antialias ? @@ -4366,7 +4358,7 @@ gui_mch_draw_string(row, col, s, len, flags) #ifdef USE_ATSUI_DRAWING if ((flags & DRAW_TRANSP) == 0) #else - if (((sys_version >= 0x1020 && p_antialias) || p_linespace != 0) + if (((gMacSystemVersion >= 0x1020 && p_antialias) || p_linespace != 0) && !(flags & DRAW_TRANSP)) #endif { @@ -4394,7 +4386,7 @@ gui_mch_draw_string(row, col, s, len, flags) } #ifndef USE_ATSUI_DRAWING - if (sys_version >= 0x1020 && p_antialias) + if (gMacSystemVersion >= 0x1020 && p_antialias) { StyleParameter face; diff --git a/src/gui_w32.c b/src/gui_w32.c index 2308362476..8bcec1dc7b 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -3947,7 +3947,7 @@ gui_mch_destroy_sign(sign) /* BALLOON-EVAL IMPLEMENTATION FOR WINDOWS. * Added by Sergey Khorev <sergey.khorev@gmail.com> * - * The only reused thing is gui_beval.h and gui_mch_get_beval_info() + * The only reused thing is gui_beval.h and get_beval_info() * from gui_beval.c (note it uses x and y of the BalloonEval struct * to get current mouse position). * diff --git a/src/proto/gui_gtk.pro b/src/proto/gui_gtk.pro index 882587e55a..afe38dc2b4 100644 --- a/src/proto/gui_gtk.pro +++ b/src/proto/gui_gtk.pro @@ -14,7 +14,6 @@ void gui_mch_destroy_scrollbar __ARGS((scrollbar_T *sb)); char_u *gui_mch_browse __ARGS((int saving, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter)); char_u *gui_mch_browsedir __ARGS((char_u *title, char_u *initdir)); int gui_mch_dialog __ARGS((int type, char_u *title, char_u *message, char_u *buttons, int def_but, char_u *textfield)); -int gui_mch_dialog __ARGS((int type, char_u *title, char_u *message, char_u *buttons, int def_but, char_u *textfield)); void gui_mch_show_popupmenu __ARGS((vimmenu_T *menu)); void gui_make_popup __ARGS((char_u *path_name)); void gui_mch_find_dialog __ARGS((exarg_T *eap)); diff --git a/src/proto/netbeans.pro b/src/proto/netbeans.pro index 31b7ef375b..f6b7d7d496 100644 --- a/src/proto/netbeans.pro +++ b/src/proto/netbeans.pro @@ -1,9 +1,11 @@ /* netbeans.c */ +void netbeans_w32_connect __ARGS((void)); void messageFromNetbeansW32 __ARGS((void)); int isNetbeansBuffer __ARGS((buf_T *bufp)); int isNetbeansModified __ARGS((buf_T *bufp)); void netbeans_end __ARGS((void)); void ex_nbkey __ARGS((exarg_T *eap)); +void netbeans_beval_cb __ARGS((BalloonEval *beval, int state)); void netbeans_startup_done __ARGS((void)); void netbeans_send_disconnect __ARGS((void)); void netbeans_frame_moved __ARGS((int new_x, int new_y)); diff --git a/src/proto/workshop.pro b/src/proto/workshop.pro index 13a1050651..426fded0b4 100644 --- a/src/proto/workshop.pro +++ b/src/proto/workshop.pro @@ -44,5 +44,6 @@ int workshop_test_getcursorcol __ARGS((void)); char *workshop_test_getcursorrowtext __ARGS((void)); char *workshop_test_getselectedtext __ARGS((void)); void workshop_save_sensitivity __ARGS((char *filename)); +void workshop_beval_cb __ARGS((BalloonEval *beval, int state)); void findYourself __ARGS((char *argv0)); /* vim: set ft=c : */ diff --git a/src/quickfix.c b/src/quickfix.c index d9ce186cf8..c34f47f791 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -2418,27 +2418,6 @@ ex_vimgrep(eap) else { found_match = FALSE; -#if 0 -#ifdef HAVE_SETJMP_H - /* - * Matching with a regexp may cause a very deep recursive call of - * regmatch(). Vim will crash when running out of stack space. - * Catch this here if the system supports it. - * It's a bit slow, thus do it outside of the loop. - */ - mch_startjmp(); - if (SETJMP(lc_jump_env) != 0) - { - mch_didjmp(); -# ifdef SIGHASARG - if (lc_signal != SIGINT) -# endif - EMSG(_(e_complex)); - got_int = TRUE; - goto jumpend; - } -#endif -#endif /* Try for a match in all lines of the buffer. */ for (lnum = 1; lnum <= buf->b_ml.ml_line_count; ++lnum) { @@ -2477,12 +2456,6 @@ ex_vimgrep(eap) if (got_int) break; } -#if 0 -#ifdef HAVE_SETJMP_H -jumpend: - mch_endjmp(); -#endif -#endif if (using_dummy) { diff --git a/src/regexp.c b/src/regexp.c index 79d3e2a573..9ad719c8db 100644 --- a/src/regexp.c +++ b/src/regexp.c @@ -3184,49 +3184,21 @@ vim_regexec_multi(rmp, win, buf, lnum, col) return r; } -#if 0 /* disabled, no longer needed now that regmatch() is not recursive */ -# ifdef HAVE_SETJMP_H -# define USE_SETJMP -# endif -# ifdef HAVE_TRY_EXCEPT -# define USE_TRY_EXCEPT -# endif -#endif - /* * Match a regexp against a string ("line" points to the string) or multiple * lines ("line" is NULL, use reg_getline()). */ -#ifdef USE_SETJMP - static long -vim_regexec_both(line_arg, col_arg) - char_u *line_arg; - colnr_T col_arg; /* column to start looking for match */ -#else static long vim_regexec_both(line, col) char_u *line; colnr_T col; /* column to start looking for match */ -#endif { regprog_T *prog; char_u *s; - long retval; -#ifdef USE_SETJMP - char_u *line; - colnr_T col; - int did_mch_startjmp = FALSE; -#endif + long retval = 0L; reg_tofree = NULL; -#ifdef USE_SETJMP - /* Trick to avoid "might be clobbered by `longjmp'" warning from gcc. */ - line = line_arg; - col = col_arg; -#endif - retval = 0L; - if (REG_MULTI) { prog = reg_mmatch->regprog; @@ -3312,36 +3284,6 @@ vim_regexec_both(line, col) goto theend; } -#ifdef USE_TRY_EXCEPT - __try - { -#endif - -#ifdef USE_SETJMP - /* - * Matching with a regexp may cause a very deep recursive call of - * regmatch(). Vim will crash when running out of stack space. Catch - * this here if the system supports it. - * It's a bit slow, do it after the check for "regmust". - * Don't do it if the caller already set it up. - */ - if (!lc_active) - { - did_mch_startjmp = TRUE; - mch_startjmp(); - if (SETJMP(lc_jump_env) != 0) - { - mch_didjmp(); -# ifdef SIGHASARG - if (lc_signal != SIGINT) -# endif - EMSG(_(e_complex)); - retval = 0L; - goto inner_end; - } - } -#endif - regline = line; reglnum = 0; @@ -3414,26 +3356,6 @@ vim_regexec_both(line, col) } } -#ifdef USE_SETJMP -inner_end: - if (did_mch_startjmp) - mch_endjmp(); -#endif -#ifdef USE_TRY_EXCEPT - } - __except(EXCEPTION_EXECUTE_HANDLER) - { - if (GetExceptionCode() == EXCEPTION_STACK_OVERFLOW) - { - RESETSTKOFLW(); - EMSG(_(e_outofstack)); - } - else - EMSG(_(e_complex)); - retval = 0L; - } -#endif - theend: /* Didn't find a match. */ vim_free(reg_tofree); @@ -3505,68 +3427,67 @@ regtry(prog, col) need_clear_zsubexpr = TRUE; #endif - if (regmatch(prog->program + 1)) + if (regmatch(prog->program + 1) == 0) + return 0; + + cleanup_subexpr(); + if (REG_MULTI) { - cleanup_subexpr(); - if (REG_MULTI) + if (reg_startpos[0].lnum < 0) { - if (reg_startpos[0].lnum < 0) - { - reg_startpos[0].lnum = 0; - reg_startpos[0].col = col; - } - if (reg_endpos[0].lnum < 0) - { - reg_endpos[0].lnum = reglnum; - reg_endpos[0].col = (int)(reginput - regline); - } - else - /* Use line number of "\ze". */ - reglnum = reg_endpos[0].lnum; + reg_startpos[0].lnum = 0; + reg_startpos[0].col = col; } - else + if (reg_endpos[0].lnum < 0) { - if (reg_startp[0] == NULL) - reg_startp[0] = regline + col; - if (reg_endp[0] == NULL) - reg_endp[0] = reginput; + reg_endpos[0].lnum = reglnum; + reg_endpos[0].col = (int)(reginput - regline); } + else + /* Use line number of "\ze". */ + reglnum = reg_endpos[0].lnum; + } + else + { + if (reg_startp[0] == NULL) + reg_startp[0] = regline + col; + if (reg_endp[0] == NULL) + reg_endp[0] = reginput; + } #ifdef FEAT_SYN_HL - /* Package any found \z(...\) matches for export. Default is none. */ - unref_extmatch(re_extmatch_out); - re_extmatch_out = NULL; + /* Package any found \z(...\) matches for export. Default is none. */ + unref_extmatch(re_extmatch_out); + re_extmatch_out = NULL; - if (prog->reghasz == REX_SET) - { - int i; + if (prog->reghasz == REX_SET) + { + int i; - cleanup_zsubexpr(); - re_extmatch_out = make_extmatch(); - for (i = 0; i < NSUBEXP; i++) + cleanup_zsubexpr(); + re_extmatch_out = make_extmatch(); + for (i = 0; i < NSUBEXP; i++) + { + if (REG_MULTI) { - if (REG_MULTI) - { - /* Only accept single line matches. */ - if (reg_startzpos[i].lnum >= 0 - && reg_endzpos[i].lnum == reg_startzpos[i].lnum) - re_extmatch_out->matches[i] = - vim_strnsave(reg_getline(reg_startzpos[i].lnum) + /* Only accept single line matches. */ + if (reg_startzpos[i].lnum >= 0 + && reg_endzpos[i].lnum == reg_startzpos[i].lnum) + re_extmatch_out->matches[i] = + vim_strnsave(reg_getline(reg_startzpos[i].lnum) + reg_startzpos[i].col, - reg_endzpos[i].col - reg_startzpos[i].col); - } - else - { - if (reg_startzp[i] != NULL && reg_endzp[i] != NULL) - re_extmatch_out->matches[i] = + reg_endzpos[i].col - reg_startzpos[i].col); + } + else + { + if (reg_startzp[i] != NULL && reg_endzp[i] != NULL) + re_extmatch_out->matches[i] = vim_strnsave(reg_startzp[i], - (int)(reg_endzp[i] - reg_startzp[i])); - } + (int)(reg_endzp[i] - reg_startzp[i])); } } -#endif - return 1 + reglnum; } - return 0; +#endif + return 1 + reglnum; } #ifdef FEAT_MBYTE @@ -4601,7 +4522,12 @@ regmatch(scan) /* It could match. Prepare for trying to match what * follows. The code is below. Parameters are stored in * a regstar_T on the regstack. */ - if (ga_grow(®stack, sizeof(regstar_T)) == FAIL) + if (((unsigned)regstack.ga_len >> 10) >= p_mmp) + { + EMSG(_(e_maxmempat)); + status = RA_FAIL; + } + else if (ga_grow(®stack, sizeof(regstar_T)) == FAIL) status = RA_FAIL; else { @@ -4641,7 +4567,12 @@ regmatch(scan) case BEHIND: case NOBEHIND: /* Need a bit of room to store extra positions. */ - if (ga_grow(®stack, sizeof(regbehind_T)) == FAIL) + if (((unsigned)regstack.ga_len >> 10) >= p_mmp) + { + EMSG(_(e_maxmempat)); + status = RA_FAIL; + } + else if (ga_grow(®stack, sizeof(regbehind_T)) == FAIL) status = RA_FAIL; else { @@ -5029,7 +4960,7 @@ regmatch(scan) break; } - /* May want to continue with the inner loop. */ + /* May need to continue with the inner loop, starting at "scan". */ if (status == RA_CONT) continue; @@ -5050,6 +4981,8 @@ regmatch(scan) printf("Premature EOL\n"); #endif } + if (status == RA_FAIL) + got_int = TRUE; return (status == RA_MATCH); } @@ -5071,6 +5004,11 @@ regstack_push(regstack, state, scan, startp) { regitem_T *rp; + if (((unsigned)regstack->ga_len >> 10) >= p_mmp) + { + EMSG(_(e_maxmempat)); + return NULL; + } if (ga_grow(regstack, sizeof(regitem_T)) == FAIL) return NULL; diff --git a/src/workshop.c b/src/workshop.c index a80575f245..e17f0e64fa 100644 --- a/src/workshop.c +++ b/src/workshop.c @@ -58,7 +58,7 @@ static void load_buffer_by_number(int, int); static void load_window(char *, int lnum); static void warp_to_pc(int); #ifdef FEAT_BEVAL -static void bevalCB(BalloonEval *, int); +void workshop_beval_cb(BalloonEval *, int); #endif static char *fixAccelText(char *); static void addMenu(char *, char *, char *); @@ -74,7 +74,6 @@ static int tbpri; /* ToolBar priority */ int usingSunWorkShop = 0; /* set if -ws flag is used */ char curMenuName[BUFSIZ]; char curMenuPriority[BUFSIZ]; -BalloonEval *balloonEval; static Boolean workshopInitDone = False; static Boolean workshopHotKeysEnabled = False; @@ -220,21 +219,7 @@ workshop_load_file( #endif #ifdef FEAT_BEVAL - if (balloonEval == NULL) - { - /* - * Set up the Balloon Expression Evaluation area. - * It's enabled by default. Disable it when 'ballooneval' is off. - */ -# ifdef FEAT_GUI_GTK - balloonEval = gui_mch_create_beval_area(gui.drawarea, NULL, - &bevalCB, NULL); -# else - balloonEval = gui_mch_create_beval_area(textArea, NULL, bevalCB, NULL); -# endif - if (!p_beval) - gui_mch_disable_beval_area(balloonEval); - } + bevalServers |= BEVAL_WORKSHOP; #endif load_window(filename, line); @@ -1566,15 +1551,15 @@ fixAccelText( } #ifdef FEAT_BEVAL - static void -bevalCB( + void +workshop_beval_cb( BalloonEval *beval, int state) { - char_u *filename; + win_T *wp; char_u *text; int type; - int line; + linenr_T lnum; int col; int idx; char buf[MAXPATHLEN * 2]; @@ -1583,7 +1568,7 @@ bevalCB( if (!p_beval) return; - if (gui_mch_get_beval_info(beval, &filename, &line, &text, &col) == OK) + if (get_beval_info(beval, FALSE, &wp, &lnum, &text, &col) == OK) { if (text && text[0]) { @@ -1606,7 +1591,7 @@ bevalCB( idx = computeIndex(col, text, beval->ts); if (idx > 0) { - line = 0; + lnum = 0; /* * If successful, it will respond with a balloon cmd. @@ -1623,9 +1608,10 @@ bevalCB( /* Send request to dbx */ sprintf(buf, "toolVerb debug.balloonEval " - "%s %d,0 %d,0 %d,%d %d %s\n", (char *) filename, - line, idx, type, serialNo++, - strlen((char *) text), (char *) text); + "%s %ld,0 %d,0 %d,%d %ld %s\n", + (char *)wp->w_buffer->b_ffname, + (long)lnum, idx, type, serialNo++, + (long)strlen((char *)text), (char *)text); balloonEval = beval; workshop_send_message(buf); } |