To: vim-dev@vim.org Subject: Patch 6.1.221 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.221 Problem: Changing case may not work properly, depending on the current locale. Solution: Add the 'casemap' option to let the user chose how changing case is to be done. Also fix lowering case when an UTF-8 character doesn't keep the same byte length. Files: runtime/doc/options.txt, src/ascii.h, src/auto/configure, src/buffer.c, src/charset.c, src/config.h.in, src/configure.in, src/diff.c, src/edit.c, src/eval.c, src/ex_cmds2.c, src/ex_docmd.c, src/ex_getln.c, src/fileio.c, src/gui_amiga.c src/gui_mac.c, src/gui_photon.c, src/gui_w48.c, src/gui_beos.cc, src/macros.h, src/main.c, src/mbyte.c, src/menu.c, src/message.c, src/misc1.c, src/misc2.c, src/option.c, src/os_msdos.c, src/os_mswin.c, src/proto/charset.pro, src/regexp.c, src/option.h, src/syntax.c *** ../vim61.220/runtime/doc/options.txt Mon Sep 23 21:32:08 2002 --- runtime/doc/options.txt Sun Oct 13 19:46:59 2002 *************** *** 1,4 **** ! *options.txt* For Vim version 6.1. Last change: 2002 Sep 19 VIM REFERENCE MANUAL by Bram Moolenaar --- 1,4 ---- ! *options.txt* For Vim version 6.1. Last change: 2002 Oct 13 VIM REFERENCE MANUAL by Bram Moolenaar *************** *** 997,1002 **** --- 999,1019 ---- file name. It is not modified in response to a |:cd| command. + *'casemap'* *'cmp'* + 'casemap' 'cmp' string (default: "internal,keepascii") + global + {not in Vi} + Specifies details about changing the case of letters It may contain + these words, separated by a comma: + internal Use internal case mapping functions, the current + locale does not change the case mapping This only + matters when 'encoding' is a Unicode encoding. When + "internal" is omitted, the towupper() and towlower() + system library functions are used when available. + keepascii For the ASCII characters (0x00 to 0x7f) use the US + case mapping, the current locale is not effective. + This probably only matters for Turkish. + *'cdpath'* *'cd'* *E344* *E346* 'cdpath' 'cd' string (default: equivalent to $CDPATH or ",,") global *** ../vim61.220/src/ascii.h Wed Sep 5 20:31:02 2001 --- src/ascii.h Sun Oct 6 20:29:01 2002 *************** *** 41,47 **** #define POUND 0xA3 ! #define Ctrl_chr(x) (TO_UPPER(x) ^ 0x40) /* '?' -> DEL, '@' -> ^@, etc. */ #define Meta(x) ((x) | 0x80) #define CTRL_F_STR "\006" --- 41,47 ---- #define POUND 0xA3 ! #define Ctrl_chr(x) (TOUPPER_ASC(x) ^ 0x40) /* '?' -> DEL, '@' -> ^@, etc. */ #define Meta(x) ((x) | 0x80) #define CTRL_F_STR "\006" *** ../vim61.220/src/auto/configure Mon Sep 23 21:35:44 2002 --- src/auto/configure Sun Oct 6 20:55:40 2002 *************** *** 5868,5882 **** memset nanosleep opendir putenv qsort readlink select setenv \ setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \ sigvec strcasecmp strerror strftime stricmp strncasecmp strnicmp \ ! strpbrk strtol tgetent usleep utime utimes do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 ! echo "configure:5830: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 ! echo "configure:5875: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <w_buffer->b_p_ft); for (t = tmp; *t != 0; t++) ! *t = TO_UPPER(*t); str = tmp; } break; --- 3215,3221 ---- { sprintf((char *)tmp, ",%s", wp->w_buffer->b_p_ft); for (t = tmp; *t != 0; t++) ! *t = TOUPPER_LOC(*t); str = tmp; } break; *** ../vim61.220/src/charset.c Sat Aug 3 14:16:11 2002 --- src/charset.c Mon Oct 7 21:31:00 2002 *************** *** 385,420 **** #if defined(FEAT_SYN_HL) || defined(FEAT_INS_EXPAND) || defined(PROTO) /* ! * Convert the string "p" to do ignore-case comparing. ! * It's done in-place. */ ! void ! str_foldcase(p) ! char_u *p; { ! while (*p != NUL) { #ifdef FEAT_MBYTE ! if (has_mbyte && MB_BYTE2LEN(*p) > 1) { if (enc_utf8) { int c, lc; ! c = utf_ptr2char(p); lc = utf_tolower(c); ! if (c != lc && utf_char2len(c) == utf_char2len(lc)) ! (void)utf_char2bytes(c, p); } ! p += (*mb_ptr2len_check)(p); /* skip multi-byte char */ } else #endif { ! *p = TO_LOWER(*p); ! ++p; } } } #endif --- 385,465 ---- #if defined(FEAT_SYN_HL) || defined(FEAT_INS_EXPAND) || defined(PROTO) /* ! * Convert the string "p[len]" to do ignore-case comparing. Uses the current ! * locale. Returns an allocated string (NULL for out-of-memory). */ ! char_u * ! str_foldcase(str, len) ! char_u *str; ! int len; { ! garray_T ga; ! int i; ! ! #define GA_CHAR(i) ((char_u *)ga.ga_data)[i] ! #define GA_PTR(i) ((char_u *)ga.ga_data + i) ! ! /* Copy "str" into allocated memory, unmodified. */ ! ga_init2(&ga, 1, 10); ! if (ga_grow(&ga, len + 1) == FAIL) ! return NULL; ! mch_memmove(ga.ga_data, str, len); ! GA_CHAR(len) = NUL; ! ga.ga_len = len; ! ga.ga_room -= len; ! ! /* Make each character lower case. */ ! i = 0; ! while (GA_CHAR(i) != NUL) { #ifdef FEAT_MBYTE ! if (enc_utf8 || (has_mbyte && MB_BYTE2LEN(GA_CHAR(i)) > 1)) { if (enc_utf8) { int c, lc; ! c = utf_ptr2char(GA_PTR(i)); lc = utf_tolower(c); ! if (c != lc) ! { ! int ol = utf_char2len(c); ! int nl = utf_char2len(lc); ! ! /* If the byte length changes need to shift the following ! * characters forward or backward. */ ! if (ol != nl) ! { ! if (nl > ol) ! if (ga_grow(&ga, nl - ol) == FAIL) ! { ! /* out of memory, keep old char */ ! lc = c; ! nl = ol; ! } ! if (ol != nl) ! { ! mch_memmove(GA_PTR(i) + nl, GA_PTR(i) + ol, ! STRLEN(GA_PTR(i) + ol) + 1); ! ga.ga_len += nl - ol; ! ga.ga_room -= nl - ol; ! } ! } ! (void)utf_char2bytes(lc, GA_PTR(i)); ! } } ! /* skip to next multi-byte char */ ! i += (*mb_ptr2len_check)(GA_PTR(i)); } else #endif { ! GA_CHAR(i) = TOLOWER_LOC(GA_CHAR(i)); ! ++i; } } + + return (char_u *)ga.ga_data; } #endif *** ../vim61.220/src/config.h.in Sun Jul 21 20:30:30 2002 --- src/config.h.in Sun Oct 6 20:13:55 2002 *************** *** 186,191 **** --- 174,181 ---- #undef HAVE_SYSCTL #undef HAVE_SYSINFO #undef HAVE_TGETENT + #undef HAVE_TOWLOWER + #undef HAVE_TOWUPPER #undef HAVE_USLEEP #undef HAVE_UTIME #undef HAVE_BIND_TEXTDOMAIN_CODESET *** ../vim61.220/src/configure.in Mon Sep 23 21:35:44 2002 --- src/configure.in Sun Oct 6 20:13:08 2002 *************** *** 1747,1753 **** memset nanosleep opendir putenv qsort readlink select setenv \ setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \ sigvec strcasecmp strerror strftime stricmp strncasecmp strnicmp \ ! strpbrk strtol tgetent usleep utime utimes) dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible AC_MSG_CHECKING(for st_blksize) --- 1747,1753 ---- memset nanosleep opendir putenv qsort readlink select setenv \ setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \ sigvec strcasecmp strerror strftime stricmp strncasecmp strnicmp \ ! strpbrk strtol tgetent towlower towupper usleep utime utimes) dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible AC_MSG_CHECKING(for st_blksize) *** ../vim61.220/src/diff.c Mon Sep 30 19:35:18 2002 --- src/diff.c Sun Oct 6 20:40:44 2002 *************** *** 1382,1388 **** #endif { if (*p1 != *p2 && (!(diff_flags & DIFF_ICASE) ! || TO_LOWER(*p1) != TO_LOWER(*p2))) break; ++p1; ++p2; --- 1382,1388 ---- #endif { if (*p1 != *p2 && (!(diff_flags & DIFF_ICASE) ! || TOLOWER_LOC(*p1) != TOLOWER_LOC(*p2))) break; ++p1; ++p2; *** ../vim61.220/src/edit.c Sun Oct 13 16:05:33 2002 --- src/edit.c Sun Oct 13 15:22:09 2002 *************** *** 1793,1799 **** { /* Rule 1 is satisfied */ for (idx = completion_length; idx < len; ++idx) ! IObuff[idx] = TO_LOWER(IObuff[idx]); break; } } --- 1799,1805 ---- { /* Rule 1 is satisfied */ for (idx = completion_length; idx < len; ++idx) ! IObuff[idx] = TOLOWER_LOC(IObuff[idx]); break; } } *************** *** 1812,1818 **** { /* Rule 2 is satisfied */ for (idx = completion_length; idx < len; ++idx) ! IObuff[idx] = TO_UPPER(IObuff[idx]); break; } was_letter = isalpha(original_text[idx]); --- 1818,1824 ---- { /* Rule 2 is satisfied */ for (idx = completion_length; idx < len; ++idx) ! IObuff[idx] = TOUPPER_LOC(IObuff[idx]); break; } was_letter = isalpha(original_text[idx]); *************** *** 3113,3123 **** tmp_ptr += ++temp; temp = complete_col - temp; } ! complete_pat = vim_strnsave(tmp_ptr, temp); if (complete_pat == NULL) return FAIL; - if (p_ic) - str_foldcase(complete_pat); } else if (continue_status & CONT_ADDING) { --- 3119,3130 ---- tmp_ptr += ++temp; temp = complete_col - temp; } ! if (p_ic) ! complete_pat = str_foldcase(tmp_ptr, temp); ! else ! complete_pat = vim_strnsave(tmp_ptr, temp); if (complete_pat == NULL) return FAIL; } else if (continue_status & CONT_ADDING) { *************** *** 3211,3221 **** temp = (int)complete_col - (int)(tmp_ptr - line); if (temp < 0) /* cursor in indent: empty pattern */ temp = 0; ! complete_pat = vim_strnsave(tmp_ptr, temp); if (complete_pat == NULL) return FAIL; - if (p_ic) - str_foldcase(complete_pat); } else if (ctrl_x_mode == CTRL_X_FILES) { --- 3218,3229 ---- temp = (int)complete_col - (int)(tmp_ptr - line); if (temp < 0) /* cursor in indent: empty pattern */ temp = 0; ! if (p_ic) ! complete_pat = str_foldcase(tmp_ptr, temp); ! else ! complete_pat = vim_strnsave(tmp_ptr, temp); if (complete_pat == NULL) return FAIL; } else if (ctrl_x_mode == CTRL_X_FILES) { *************** *** 5495,5501 **** #endif /* TODO: multi-byte */ if (keytyped == (int)p[-1] || (icase && keytyped < 256 ! && TO_LOWER(keytyped) == TO_LOWER((int)p[-1]))) { line = ml_get_cursor(); if ((curwin->w_cursor.col == (colnr_T)(p - look) --- 5503,5509 ---- #endif /* TODO: multi-byte */ if (keytyped == (int)p[-1] || (icase && keytyped < 256 ! && TOLOWER_LOC(keytyped) == TOLOWER_LOC((int)p[-1]))) { line = ml_get_cursor(); if ((curwin->w_cursor.col == (colnr_T)(p - look) *** ../vim61.220/src/eval.c Sat Oct 12 21:16:50 2002 --- src/eval.c Fri Oct 11 19:44:18 2002 *************** *** 3169,3177 **** def = get_var_number(&argvars[2]); if (argvars[3].var_type != VAR_UNKNOWN) { ! /* avoid that TO_UPPER calls get_var_string_buf() twice */ c = *get_var_string_buf(&argvars[3], buf2); ! switch (TO_UPPER(c)) { case 'E': type = VIM_ERROR; break; case 'Q': type = VIM_QUESTION; break; --- 3169,3177 ---- def = get_var_number(&argvars[2]); if (argvars[3].var_type != VAR_UNKNOWN) { ! /* avoid that TOUPPER_ASC calls get_var_string_buf() twice */ c = *get_var_string_buf(&argvars[3], buf2); ! switch (TOUPPER_ASC(c)) { case 'E': type = VIM_ERROR; break; case 'Q': type = VIM_QUESTION; break; *************** *** 6086,6092 **** if (argvars[2].var_type != VAR_UNKNOWN) { mode = get_var_string_buf(&argvars[2], modebuf); ! modec = TO_LOWER(mode[0]); if (modec != 't' && modec != 'c' #ifdef FEAT_GUI && modec != 'g' --- 6086,6092 ---- if (argvars[2].var_type != VAR_UNKNOWN) { mode = get_var_string_buf(&argvars[2], modebuf); ! modec = TOLOWER_ASC(mode[0]); if (modec != 't' && modec != 'c' #ifdef FEAT_GUI && modec != 'g' *************** *** 6108,6117 **** } ! switch (TO_LOWER(what[0])) { case 'b': ! if (TO_LOWER(what[1]) == 'g') /* bg[#] */ p = highlight_color(id, what, modec); else /* bold */ p = highlight_has_attr(id, HL_BOLD, modec); --- 6108,6117 ---- } ! switch (TOLOWER_ASC(what[0])) { case 'b': ! if (TOLOWER_ASC(what[1]) == 'g') /* bg[#] */ p = highlight_color(id, what, modec); else /* bold */ p = highlight_has_attr(id, HL_BOLD, modec); *************** *** 6122,6128 **** break; case 'i': ! if (TO_LOWER(what[1]) == 'n') /* inverse */ p = highlight_has_attr(id, HL_INVERSE, modec); else /* italic */ p = highlight_has_attr(id, HL_ITALIC, modec); --- 6122,6128 ---- break; case 'i': ! if (TOLOWER_ASC(what[1]) == 'n') /* inverse */ p = highlight_has_attr(id, HL_INVERSE, modec); else /* italic */ p = highlight_has_attr(id, HL_ITALIC, modec); *************** *** 6318,6324 **** else #endif { ! *p = TO_LOWER(*p); /* note that tolower() can be a macro */ ++p; } } --- 6318,6324 ---- else #endif { ! *p = TOLOWER_LOC(*p); /* note that tolower() can be a macro */ ++p; } } *************** *** 6361,6367 **** else #endif { ! *p = TO_UPPER(*p); /* note that toupper() can be a macro */ p++; } } --- 6361,6367 ---- else #endif { ! *p = TOUPPER_LOC(*p); /* note that toupper() can be a macro */ p++; } } *************** *** 8019,8025 **** eval_fname_sid(p) char_u *p; { ! return (*p == 's' || TO_UPPER(p[2]) == 'I'); } /* --- 8019,8025 ---- eval_fname_sid(p) char_u *p; { ! return (*p == 's' || TOUPPER_ASC(p[2]) == 'I'); } /* *** ../vim61.220/src/ex_cmds2.c Sat Oct 12 17:26:38 2002 --- src/ex_cmds2.c Sat Oct 12 17:22:00 2002 *************** *** 2720,2726 **** prt_use_number() { return (printer_opts[OPT_PRINT_NUMBER].present ! && TO_LOWER(printer_opts[OPT_PRINT_NUMBER].string[0]) == 'y'); } /* --- 2720,2726 ---- prt_use_number() { return (printer_opts[OPT_PRINT_NUMBER].present ! && TOLOWER_ASC(printer_opts[OPT_PRINT_NUMBER].string[0]) == 'y'); } /* *************** *** 2897,2905 **** #ifdef FEAT_SYN_HL if (printer_opts[OPT_PRINT_SYNTAX].present ! && TO_LOWER(printer_opts[OPT_PRINT_SYNTAX].string[0]) != 'a') settings.do_syntax = ! (TO_LOWER(printer_opts[OPT_PRINT_SYNTAX].string[0]) == 'y'); else settings.do_syntax = settings.has_color; #endif --- 2897,2905 ---- #ifdef FEAT_SYN_HL if (printer_opts[OPT_PRINT_SYNTAX].present ! && TOLOWER_ASC(printer_opts[OPT_PRINT_SYNTAX].string[0]) != 'a') settings.do_syntax = ! (TOLOWER_ASC(printer_opts[OPT_PRINT_SYNTAX].string[0]) == 'y'); else settings.do_syntax = settings.has_color; #endif *************** *** 2930,2936 **** #endif jobsplit = (printer_opts[OPT_PRINT_JOBSPLIT].present ! && TO_LOWER(printer_opts[OPT_PRINT_JOBSPLIT].string[0]) == 'y'); if (!mch_print_begin(&settings)) goto print_fail_no_begin; --- 2930,2936 ---- #endif jobsplit = (printer_opts[OPT_PRINT_JOBSPLIT].present ! && TOLOWER_ASC(printer_opts[OPT_PRINT_JOBSPLIT].string[0]) == 'y'); if (!mch_print_begin(&settings)) goto print_fail_no_begin; *************** *** 3232,3238 **** * line. */ if (line[col] == NUL || (printer_opts[OPT_PRINT_WRAP].present ! && TO_LOWER(printer_opts[OPT_PRINT_WRAP].string[0]) == 'n')) return 0; return col; } --- 3232,3238 ---- * line. */ if (line[col] == NUL || (printer_opts[OPT_PRINT_WRAP].present ! && TOLOWER_ASC(printer_opts[OPT_PRINT_WRAP].string[0]) == 'n')) return 0; return col; } *************** *** 3976,3982 **** * Find the size of the paper and set the margins. */ prt_portrait = (!printer_opts[OPT_PRINT_PORTRAIT].present ! || TO_LOWER(printer_opts[OPT_PRINT_PORTRAIT].string[0]) == 'y'); if (printer_opts[OPT_PRINT_PAPER].present) { paper_name = (char *)printer_opts[OPT_PRINT_PAPER].string; --- 3976,3982 ---- * Find the size of the paper and set the margins. */ prt_portrait = (!printer_opts[OPT_PRINT_PORTRAIT].present ! || TOLOWER_ASC(printer_opts[OPT_PRINT_PORTRAIT].string[0]) == 'y'); if (printer_opts[OPT_PRINT_PAPER].present) { paper_name = (char *)printer_opts[OPT_PRINT_PAPER].string; *************** *** 4055,4061 **** psettings->n_uncollated_copies = 1; prt_num_copies = 1; prt_collate = (!printer_opts[OPT_PRINT_COLLATE].present ! || TO_LOWER(printer_opts[OPT_PRINT_COLLATE].string[0]) == 'y'); if (prt_collate) { /* TODO: Get number of collated copies wanted. */ --- 4055,4061 ---- psettings->n_uncollated_copies = 1; prt_num_copies = 1; prt_collate = (!printer_opts[OPT_PRINT_COLLATE].present ! || TOLOWER_ASC(printer_opts[OPT_PRINT_COLLATE].string[0]) == 'y'); if (prt_collate) { /* TODO: Get number of collated copies wanted. */ *** ../vim61.220/src/ex_docmd.c Fri Oct 11 20:38:35 2002 --- src/ex_docmd.c Fri Oct 11 20:34:46 2002 *************** *** 3565,3571 **** { /* Make 'fileencoding' lower case. */ for (p = eap->cmd + eap->force_enc; *p != NUL; ++p) ! *p = TO_LOWER(*p); } #endif --- 3565,3571 ---- { /* Make 'fileencoding' lower case. */ for (p = eap->cmd + eap->force_enc; *p != NUL; ++p) ! *p = TOLOWER_ASC(*p); } #endif *** ../vim61.220/src/ex_getln.c Sun Oct 13 16:05:33 2002 --- src/ex_getln.c Sun Oct 13 15:35:07 2002 *************** *** 2570,2577 **** || xp->xp_context == EXPAND_FILES || xp->xp_context == EXPAND_BUFFERS) { ! if (TO_LOWER(cmd_files[i][len]) != ! TO_LOWER(cmd_files[0][len])) break; } else --- 2570,2577 ---- || xp->xp_context == EXPAND_FILES || xp->xp_context == EXPAND_BUFFERS) { ! if (TOLOWER_LOC(cmd_files[i][len]) != ! TOLOWER_LOC(cmd_files[0][len])) break; } else *** ../vim61.220/src/fileio.c Sun Oct 13 18:48:35 2002 --- src/fileio.c Sun Oct 13 18:42:11 2002 *************** *** 4494,4500 **** * a floppy from "A:\dir" to "B:\dir". */ else if (len > 3 ! && TO_UPPER(full_path[0]) == TO_UPPER(dir_name[0]) && full_path[1] == ':' && vim_ispathsep(full_path[2])) p = full_path + 2; --- 4669,4675 ---- * a floppy from "A:\dir" to "B:\dir". */ else if (len > 3 ! && TOUPPER_LOC(full_path[0]) == TOUPPER_LOC(dir_name[0]) && full_path[1] == ':' && vim_ispathsep(full_path[2])) p = full_path + 2; *** ../vim61.220/src/gui_amiga.c Sat May 4 22:23:07 2002 --- src/gui_amiga.c Sun Oct 6 20:44:33 2002 *************** *** 142,148 **** { if (isdigit(c)) return c - '0'; ! c = TO_LOWER(c); if (c >= 'a' && c <= 'f') return c - 'a' + 10; return -1000; --- 142,148 ---- { if (isdigit(c)) return c - '0'; ! c = TOLOWER_ASC(c); if (c >= 'a' && c <= 'f') return c - 'a' + 10; return -1000; *** ../vim61.220/src/gui_mac.c Fri Sep 27 19:30:44 2002 --- src/gui_mac.c Sun Oct 6 20:44:52 2002 *************** *** 3061,3067 **** { if (isdigit(c)) return c - '0'; ! c = TO_LOWER(c); if (c >= 'a' && c <= 'f') return c - 'a' + 10; return -1000; --- 3061,3067 ---- { if (isdigit(c)) return c - '0'; ! c = TOLOWER_ASC(c); if (c >= 'a' && c <= 'f') return c - 'a' + 10; return -1000; *** ../vim61.220/src/gui_photon.c Sat May 4 22:23:07 2002 --- src/gui_photon.c Sun Oct 6 20:45:01 2002 *************** *** 1980,1986 **** { if (vim_isdigit(c)) return( c - '0' ); ! c = TO_LOWER(c); if (c >= 'a' && c <= 'f') return( c - 'a' + 10 ); return( -1000 ); --- 1980,1986 ---- { if (vim_isdigit(c)) return( c - '0' ); ! c = TOLOWER_ASC(c); if (c >= 'a' && c <= 'f') return( c - 'a' + 10 ); return( -1000 ); *** ../vim61.220/src/gui_w48.c Mon Sep 16 22:00:32 2002 --- src/gui_w48.c Tue Oct 8 20:55:33 2002 *************** *** 1146,1152 **** { if (vim_isdigit(c)) return c - '0'; ! c = TO_LOWER(c); if (c >= 'a' && c <= 'f') return c - 'a' + 10; return -1000; --- 1146,1152 ---- { if (vim_isdigit(c)) return c - '0'; ! c = TOLOWER_ASC(c); if (c >= 'a' && c <= 'f') return c - 'a' + 10; return -1000; *** ../vim61.220/src/gui_beos.cc Sat May 4 22:23:07 2002 --- src/gui_beos.cc Sun Oct 6 20:53:33 2002 *************** *** 2455,2461 **** { if (isdigit(c)) return c - '0'; ! c = TO_LOWER(c); if (c >= 'a' && c <= 'f') return c - 'a' + 10; return -1000; --- 2455,2461 ---- { if (isdigit(c)) return c - '0'; ! c = TOLOWER_ASC(c); if (c >= 'a' && c <= 'f') return c - 'a' + 10; return -1000; *** ../vim61.220/src/macros.h Sun Jul 21 20:30:31 2002 --- src/macros.h Sun Oct 6 21:52:17 2002 *************** *** 51,74 **** #define bufempty() (curbuf->b_ml.ml_line_count == 1 && *ml_get((linenr_T)1) == NUL) /* * On some systems toupper()/tolower() only work on lower/uppercase characters ! * Careful: Only call TO_UPPER() and TO_LOWER() with a character in the range ! * 0 - 255. toupper()/tolower() on some systems can't handle others. * Note: for UTF-8 use utf_toupper() and utf_tolower(). */ #ifdef MSWIN ! # define TO_UPPER(c) toupper_tab[(c) & 255] ! # define TO_LOWER(c) tolower_tab[(c) & 255] #else # ifdef BROKEN_TOUPPER ! # define TO_UPPER(c) (islower(c) ? toupper(c) : (c)) ! # define TO_LOWER(c) (isupper(c) ? tolower(c) : (c)) # else ! # define TO_UPPER toupper ! # define TO_LOWER tolower # endif #endif /* * MB_ISLOWER() and MB_ISUPPER() are to be used on multi-byte characters. But * don't use them for negative values or values above 0x100 for DBCS. --- 51,84 ---- #define bufempty() (curbuf->b_ml.ml_line_count == 1 && *ml_get((linenr_T)1) == NUL) /* + * toupper() and tolower() that use the current locale. * On some systems toupper()/tolower() only work on lower/uppercase characters ! * Careful: Only call TOUPPER_LOC() and TOLOWER_LOC() with a character in the ! * range 0 - 255. toupper()/tolower() on some systems can't handle others. * Note: for UTF-8 use utf_toupper() and utf_tolower(). */ #ifdef MSWIN ! # define TOUPPER_LOC(c) toupper_tab[(c) & 255] ! # define TOLOWER_LOC(c) tolower_tab[(c) & 255] #else # ifdef BROKEN_TOUPPER ! # define TOUPPER_LOC(c) (islower(c) ? toupper(c) : (c)) ! # define TOLOWER_LOC(c) (isupper(c) ? tolower(c) : (c)) # else ! # define TOUPPER_LOC toupper ! # define TOLOWER_LOC tolower # endif #endif + /* toupper() and tolower() for ASCII only and ignore the current locale. */ + #ifdef EBCDIC + # define TOUPPER_ASC(c) (islower(c) ? toupper(c) : (c)) + # define TOLOWER_ASC(c) (isupper(c) ? tolower(c) : (c)) + #else + # define TOUPPER_ASC(c) (((c) < 'a' || (c) > 'z') ? (c) : (c) - ('a' - 'A')) + # define TOLOWER_ASC(c) (((c) < 'A' || (c) > 'Z') ? (c) : (c) + ('a' - 'A')) + #endif + /* * MB_ISLOWER() and MB_ISUPPER() are to be used on multi-byte characters. But * don't use them for negative values or values above 0x100 for DBCS. *************** *** 76,88 **** #ifdef FEAT_MBYTE # define MB_ISLOWER(c) (enc_utf8 && (c) > 0x80 ? utf_islower(c) : islower(c)) # define MB_ISUPPER(c) (enc_utf8 && (c) > 0x80 ? utf_isupper(c) : isupper(c)) ! # define MB_TOLOWER(c) (enc_utf8 && (c) > 0x80 ? utf_tolower(c) : TO_LOWER(c)) ! # define MB_TOUPPER(c) (enc_utf8 && (c) > 0x80 ? utf_toupper(c) : TO_UPPER(c)) #else # define MB_ISLOWER(c) islower(c) # define MB_ISUPPER(c) isupper(c) ! # define MB_TOLOWER(c) TO_LOWER(c) ! # define MB_TOUPPER(c) TO_UPPER(c) #endif /* Like isalpha() but reject non-ASCII characters. Can't be used with a --- 86,98 ---- #ifdef FEAT_MBYTE # define MB_ISLOWER(c) (enc_utf8 && (c) > 0x80 ? utf_islower(c) : islower(c)) # define MB_ISUPPER(c) (enc_utf8 && (c) > 0x80 ? utf_isupper(c) : isupper(c)) ! # define MB_TOLOWER(c) (enc_utf8 && (c) > 0x80 ? utf_tolower(c) : TOLOWER_LOC(c)) ! # define MB_TOUPPER(c) (enc_utf8 && (c) > 0x80 ? utf_toupper(c) : TOUPPER_LOC(c)) #else # define MB_ISLOWER(c) islower(c) # define MB_ISUPPER(c) isupper(c) ! # define MB_TOLOWER(c) TOLOWER_LOC(c) ! # define MB_TOUPPER(c) TOUPPER_LOC(c) #endif /* Like isalpha() but reject non-ASCII characters. Can't be used with a *** ../vim61.220/src/main.c Mon Sep 23 21:12:18 2002 --- src/main.c Sun Oct 6 20:45:54 2002 *************** *** 411,425 **** /* TODO: On MacOS X default to gui if argv[0] ends in: * /vim.app/Contents/MacOS/Vim */ ! if (TO_LOWER(initstr[0]) == 'r') { restricted = TRUE; ++initstr; } /* Avoid using evim mode for "editor". */ ! if (TO_LOWER(initstr[0]) == 'e' ! && (TO_LOWER(initstr[1]) == 'v' || TO_LOWER(initstr[1]) == 'g')) { #ifdef FEAT_GUI gui.starting = TRUE; --- 411,426 ---- /* TODO: On MacOS X default to gui if argv[0] ends in: * /vim.app/Contents/MacOS/Vim */ ! if (TOLOWER_ASC(initstr[0]) == 'r') { restricted = TRUE; ++initstr; } /* Avoid using evim mode for "editor". */ ! if (TOLOWER_ASC(initstr[0]) == 'e' ! && (TOLOWER_ASC(initstr[1]) == 'v' ! || TOLOWER_ASC(initstr[1]) == 'g')) { #ifdef FEAT_GUI gui.starting = TRUE; *************** *** 428,434 **** ++initstr; } ! if (TO_LOWER(initstr[0]) == 'g') { main_start_gui(); #ifdef FEAT_GUI --- 429,435 ---- ++initstr; } ! if (TOLOWER_ASC(initstr[0]) == 'g') { main_start_gui(); #ifdef FEAT_GUI *************** *** 506,515 **** if (c == '/') { c = argv[0][argv_idx++]; ! c = TO_UPPER(c); } else ! c = TO_LOWER(c); #endif switch (c) { --- 507,516 ---- if (c == '/') { c = argv[0][argv_idx++]; ! c = TOUPPER_ASC(c); } else ! c = TOLOWER_ASC(c); #endif switch (c) { *************** *** 2688,2694 **** /* Guess that when the server name starts with "g" it's a GUI * server, which we can bring to the foreground here. * Foreground() in the server doesn't work very well. */ ! if (argtype != ARGTYPE_SEND && TO_UPPER(*sname) == 'G') SetForegroundWindow(srv); # endif --- 2689,2695 ---- /* Guess that when the server name starts with "g" it's a GUI * server, which we can bring to the foreground here. * Foreground() in the server doesn't work very well. */ ! if (argtype != ARGTYPE_SEND && TOUPPER_ASC(*sname) == 'G') SetForegroundWindow(srv); # endif *** ../vim61.220/src/mbyte.c Sat Oct 12 15:48:03 2002 --- src/mbyte.c Sat Oct 12 15:33:10 2002 *************** *** 1771,1778 **** utf_toupper(a) int a; { if (a < 128) ! return toupper(a); return utf_convert(a, toUpper, sizeof(toUpper)); } --- 1771,1791 ---- utf_toupper(a) int a; { + /* If 'casemap' contains "keepascii" use ASCII style toupper(). */ + if (a < 128 && (cmp_flags & CMP_KEEPASCII)) + return TOUPPER_ASC(a); + + #if defined(HAVE_TOWUPPER) && defined(__STDC__ISO_10646__) + /* If towupper() is availble and handles Unicode, use it. */ + if (!(cmp_flags & CMP_INTERNAL)) + return towupper(a); + #endif + + /* For characters below 128 use locale sensitive toupper(). */ if (a < 128) ! return TOUPPER_LOC(a); ! ! /* For any other characters use the above mapping table. */ return utf_convert(a, toUpper, sizeof(toUpper)); } *************** *** 1791,1798 **** utf_tolower(a) int a; { if (a < 128) ! return tolower(a); return utf_convert(a, toLower, sizeof(toLower)); } --- 1804,1824 ---- utf_tolower(a) int a; { + /* If 'casemap' contains "keepascii" use ASCII style tolower(). */ + if (a < 128 && (cmp_flags & CMP_KEEPASCII)) + return TOLOWER_ASC(a); + + #if defined(HAVE_TOWLOWER) && defined(__STDC__ISO_10646__) + /* If towlower() is availble and handles Unicode, use it. */ + if (!(cmp_flags & CMP_INTERNAL)) + return towlower(a); + #endif + + /* For characters below 128 use locale sensitive tolower(). */ if (a < 128) ! return TOLOWER_LOC(a); ! ! /* For any other characters use the above mapping table. */ return utf_convert(a, toLower, sizeof(toLower)); } *************** *** 1830,1836 **** /* Single byte: first check normally, then with ignore case. */ if (s1[i] != s2[i]) { ! cdiff = TO_LOWER(s1[i]) - TO_LOWER(s2[i]); if (cdiff != 0) return cdiff; } --- 1856,1862 ---- /* Single byte: first check normally, then with ignore case. */ if (s1[i] != s2[i]) { ! cdiff = TOLOWER_LOC(s1[i]) - TOLOWER_LOC(s2[i]); if (cdiff != 0) return cdiff; } *************** *** 2319,2325 **** if (*s == '_') *p++ = '-'; else ! *p++ = TO_LOWER(*s); } *p = NUL; --- 2345,2351 ---- if (*s == '_') *p++ = '-'; else ! *p++ = TOLOWER_ASC(*s); } *p = NUL; *************** *** 2445,2451 **** if (s[i] == '_' || s[i] == '-') buf[i] = '-'; else if (isalnum((int)s[i])) ! buf[i] = TO_LOWER(s[i]); else break; } --- 2471,2477 ---- if (s[i] == '_' || s[i] == '-') buf[i] = '-'; else if (isalnum((int)s[i])) ! buf[i] = TOLOWER_ASC(s[i]); else break; } *** ../vim61.220/src/menu.c Mon Feb 11 15:31:34 2002 --- src/menu.c Sun Oct 13 15:43:15 2002 *************** *** 1824,1833 **** vimmenu_T *menu; if (key < 256) ! key = TO_LOWER(key); for (menu = root_menu; menu != NULL; menu = menu->next) if (menu->mnemonic == key ! || (menu->mnemonic < 256 && TO_LOWER(menu->mnemonic) == key)) return TRUE; return FALSE; } --- 1833,1842 ---- vimmenu_T *menu; if (key < 256) ! key = TOLOWER_LOC(key); for (menu = root_menu; menu != NULL; menu = menu->next) if (menu->mnemonic == key ! || (menu->mnemonic < 256 && TOLOWER_LOC(menu->mnemonic) == key)) return TRUE; return FALSE; } *** ../vim61.220/src/message.c Mon Sep 16 22:00:32 2002 --- src/message.c Sun Oct 6 20:47:55 2002 *************** *** 2294,2300 **** continue; for (retval = 0; hotkeys[retval]; retval++) { ! if (hotkeys[retval] == TO_LOWER(c)) break; } if (hotkeys[retval]) --- 2294,2300 ---- continue; for (retval = 0; hotkeys[retval]; retval++) { ! if (hotkeys[retval] == TOLOWER_LOC(c)) break; } if (hotkeys[retval]) *************** *** 2386,2392 **** p = confirm_msg + 1 + STRLEN(message); q = hotk; r = buttons; ! *q = (char_u)TO_LOWER(*r); /* define lowercase hotkey */ /* Remember where the choices start, displaying starts here when "q" typed * at the more prompt. */ --- 2386,2392 ---- p = confirm_msg + 1 + STRLEN(message); q = hotk; r = buttons; ! *q = (char_u)TOLOWER_LOC(*r); /* define lowercase hotkey */ /* Remember where the choices start, displaying starts here when "q" typed * at the more prompt. */ *************** *** 2399,2405 **** { *p++ = ','; *p++ = ' '; /* '\n' -> ', ' */ ! *(++q) = (char_u)TO_LOWER(*(r + 1)); /* next hotkey */ if (dfltbutton) --dfltbutton; } --- 2399,2405 ---- { *p++ = ','; *p++ = ' '; /* '\n' -> ', ' */ ! *(++q) = (char_u)TOLOWER_LOC(*(r + 1)); /* next hotkey */ if (dfltbutton) --dfltbutton; } *************** *** 2414,2420 **** *p++ = (dfltbutton == 1) ? '[' : '('; *p++ = *r; *p++ = (dfltbutton == 1) ? ']' : ')'; ! *q = (char_u)TO_LOWER(*r); /* define lowercase hotkey */ } } else --- 2414,2420 ---- *p++ = (dfltbutton == 1) ? '[' : '('; *p++ = *r; *p++ = (dfltbutton == 1) ? ']' : ')'; ! *q = (char_u)TOLOWER_LOC(*r); /* define lowercase hotkey */ } } else *** ../vim61.220/src/misc1.c Mon Sep 16 22:00:32 2002 --- src/misc1.c Sun Oct 6 20:48:36 2002 *************** *** 2925,2931 **** )) { #ifdef OS2 /* env vars only in uppercase */ ! *var++ = TO_UPPER(*tail); tail++; /* toupper() may be a macro! */ #else *var++ = *tail++; --- 2925,2931 ---- )) { #ifdef OS2 /* env vars only in uppercase */ ! *var++ = TOUPPER_LOC(*tail); tail++; /* toupper() may be a macro! */ #else *var++ = *tail++; *************** *** 3789,3795 **** { while (len > 0 && *x && *y) { ! if (TO_LOWER(*x) != TO_LOWER(*y) && !(*x == '/' && *y == '\\') && !(*x == '\\' && *y == '/')) break; --- 3789,3795 ---- { while (len > 0 && *x && *y) { ! if (TOLOWER_LOC(*x) != TOLOWER_LOC(*y) && !(*x == '/' && *y == '\\') && !(*x == '\\' && *y == '/')) break; *************** *** 6553,6559 **** else # endif while (*s) ! *d++ = TO_LOWER(*s++); *d = NUL; } # endif --- 6553,6559 ---- else # endif while (*s) ! *d++ = TOLOWER_LOC(*s++); *d = NUL; } # endif *** ../vim61.220/src/misc2.c Mon Sep 30 22:29:09 2002 --- src/misc2.c Sun Oct 6 20:50:36 2002 *************** *** 1281,1287 **** #if (!defined(HAVE_STRCASECMP) && !defined(HAVE_STRICMP)) || defined(PROTO) /* ! * Compare two strings, ignoring case. * return 0 for match, < 0 for smaller, > 0 for bigger */ int --- 1281,1288 ---- #if (!defined(HAVE_STRCASECMP) && !defined(HAVE_STRICMP)) || defined(PROTO) /* ! * Compare two strings, ignoring case, using current locale. ! * Doesn't work for multi-byte characters. * return 0 for match, < 0 for smaller, > 0 for bigger */ int *************** *** 1293,1299 **** for (;;) { ! i = (int)TO_LOWER(*s1) - (int)TO_LOWER(*s2); if (i != 0) return i; /* this character different */ if (*s1 == NUL) --- 1294,1300 ---- for (;;) { ! i = (int)TOLOWER_LOC(*s1) - (int)TOLOWER_LOC(*s2); if (i != 0) return i; /* this character different */ if (*s1 == NUL) *************** *** 1307,1313 **** #if (!defined(HAVE_STRNCASECMP) && !defined(HAVE_STRNICMP)) || defined(PROTO) /* ! * Compare two strings, for length "len", ignoring case. * return 0 for match, < 0 for smaller, > 0 for bigger */ int --- 1308,1315 ---- #if (!defined(HAVE_STRNCASECMP) && !defined(HAVE_STRNICMP)) || defined(PROTO) /* ! * Compare two strings, for length "len", ignoring case, using current locale. ! * Doesn't work for multi-byte characters. * return 0 for match, < 0 for smaller, > 0 for bigger */ int *************** *** 1320,1326 **** while (len > 0) { ! i = (int)TO_LOWER(*s1) - (int)TO_LOWER(*s2); if (i != 0) return i; /* this character different */ if (*s1 == NUL) --- 1322,1328 ---- while (len > 0) { ! i = (int)TOLOWER_LOC(*s1) - (int)TOLOWER_LOC(*s2); if (i != 0) return i; /* this character different */ if (*s1 == NUL) *************** *** 1934,1946 **** { int i; ! if (c > 0 && c <= 255) /* avoid TO_UPPER() with number > 255 */ ! { ! c = TO_UPPER(c); ! for (i = 0; mod_mask_table[i].mod_mask != 0; i++) ! if (c == mod_mask_table[i].name) ! return mod_mask_table[i].mod_flag; ! } return 0; } --- 1936,1945 ---- { int i; ! c = TOUPPER_ASC(c); ! for (i = 0; mod_mask_table[i].mod_mask != 0; i++) ! if (c == mod_mask_table[i].name) ! return mod_mask_table[i].mod_flag; return 0; } *************** *** 2288,2294 **** #endif if ((modifiers & MOD_MASK_SHIFT) && ASCII_ISALPHA(key)) { ! key = TO_UPPER(key); modifiers &= ~MOD_MASK_SHIFT; } if ((modifiers & MOD_MASK_CTRL) --- 2287,2293 ---- #endif if ((modifiers & MOD_MASK_SHIFT) && ASCII_ISALPHA(key)) { ! key = TOUPPER_ASC(key); modifiers &= ~MOD_MASK_SHIFT; } if ((modifiers & MOD_MASK_CTRL) *************** *** 2372,2378 **** { table_name = key_names_table[i].name; for (j = 0; vim_isIDc(name[j]) && table_name[j] != NUL; j++) ! if (TO_LOWER(table_name[j]) != TO_LOWER(name[j])) break; if (!vim_isIDc(name[j]) && table_name[j] == NUL) return key_names_table[i].key; --- 2371,2377 ---- { table_name = key_names_table[i].name; for (j = 0; vim_isIDc(name[j]) && table_name[j] != NUL; j++) ! if (TOLOWER_ASC(table_name[j]) != TOLOWER_ASC(name[j])) break; if (!vim_isIDc(name[j]) && table_name[j] == NUL) return key_names_table[i].key; *************** *** 2796,2802 **** len = 1; else len = 2; ! if (len == 1 && TO_LOWER(modep[0]) == 'a') all_idx = SHAPE_IDX_COUNT - 1; else { --- 2795,2801 ---- len = 1; else len = 2; ! if (len == 1 && TOLOWER_ASC(modep[0]) == 'a') all_idx = SHAPE_IDX_COUNT - 1; else { *************** *** 2893,2899 **** return (char_u *)N_("Illegal percentage"); if (round == 2) { ! if (TO_LOWER(i) == 'v') shape_table[idx].shape = SHAPE_VER; else shape_table[idx].shape = SHAPE_HOR; --- 2892,2898 ---- return (char_u *)N_("Illegal percentage"); if (round == 2) { ! if (TOLOWER_ASC(i) == 'v') shape_table[idx].shape = SHAPE_VER; else shape_table[idx].shape = SHAPE_HOR; *************** *** 4466,4472 **** { if (s1[i] != s2[i] #ifdef CASE_INSENSITIVE_FILENAME ! && TO_UPPER(s1[i]) != TO_UPPER(s2[i]) #endif ) { --- 4465,4471 ---- { if (s1[i] != s2[i] #ifdef CASE_INSENSITIVE_FILENAME ! && TOUPPER_LOC(s1[i]) != TOUPPER_LOC(s2[i]) #endif ) { *************** *** 5217,5223 **** if ( #ifdef CASE_INSENSITIVE_FILENAME ! TO_UPPER(p[i]) != TO_UPPER(q[i]) #else p[i] != q[i] #endif --- 5216,5222 ---- if ( #ifdef CASE_INSENSITIVE_FILENAME ! TOUPPER_LOC(p[i]) != TOUPPER_LOC(q[i]) #else p[i] != q[i] #endif *** ../vim61.220/src/option.c Mon Sep 23 21:32:08 2002 --- src/option.c Sun Oct 6 20:50:46 2002 *************** *** 455,460 **** --- 455,464 ---- {(char_u *)0L, (char_u *)0L} #endif }, + {"casemap", "cmp", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, + (char_u *)&p_cmp, PV_NONE, + {(char_u *)"internal,keepascii", (char_u *)0L} + }, {"cdpath", "cd", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP, #ifdef FEAT_SEARCHPATH (char_u *)&p_cdpath, PV_NONE, *************** *** 3407,3413 **** i = 1; #ifdef HAVE_STRTOL value = strtol((char *)arg, NULL, 0); ! if (arg[i] == '0' && TO_LOWER(arg[i + 1]) == 'x') i += 2; #else value = atol((char *)arg); --- 3413,3419 ---- i = 1; #ifdef HAVE_STRTOL value = strtol((char *)arg, NULL, 0); ! if (arg[i] == '0' && TOLOWER_ASC(arg[i + 1]) == 'x') i += 2; #else value = atol((char *)arg); *************** *** 4031,4036 **** --- 4037,4043 ---- /* initialize the table for 'iskeyword' et.al. */ (void)init_chartab(); + (void)opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE); #ifdef FEAT_SESSION (void)opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, TRUE); (void)opt_strings_flags(p_vop, p_ssop_values, &vop_flags, TRUE); *************** *** 5162,5167 **** --- 5169,5181 ---- errmsg = e_invarg; } else if (check_opt_strings(p_bs, p_bs_values, TRUE) != OK) + errmsg = e_invarg; + } + + /* 'casemap' */ + else if (varp == &p_cmp) + { + if (opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE) != OK) errmsg = e_invarg; } *** ../vim61.220/src/os_msdos.c Sun Aug 18 15:48:20 2002 --- src/os_msdos.c Sun Oct 6 20:51:08 2002 *************** *** 2241,2247 **** return 0; if (path[1] == ':') /* has a drive name */ { ! if (change_drive(TO_LOWER(path[0]) - 'a' + 1)) return -1; /* invalid drive name */ path += 2; } --- 2241,2247 ---- return 0; if (path[1] == ':') /* has a drive name */ { ! if (change_drive(TOLOWER_ASC(path[0]) - 'a' + 1)) return -1; /* invalid drive name */ path += 2; } *** ../vim61.220/src/os_mswin.c Mon Mar 11 21:46:49 2002 --- src/os_mswin.c Sun Oct 6 20:51:28 2002 *************** *** 576,582 **** /* If we can change to the drive, skip that part of the path. If we * can't then the current directory may be invalid, try using chdir() * with the whole path. */ ! if (_chdrive(TO_LOWER(path[0]) - 'a' + 1) == 0) path += 2; } --- 576,582 ---- /* If we can change to the drive, skip that part of the path. If we * can't then the current directory may be invalid, try using chdir() * with the whole path. */ ! if (_chdrive(TOLOWER_ASC(path[0]) - 'a' + 1) == 0) path += 2; } *** ../vim61.220/src/proto/charset.pro Fri Mar 22 21:41:06 2002 --- src/proto/charset.pro Sun Oct 6 21:57:38 2002 *************** *** 3,9 **** int buf_init_chartab __ARGS((buf_T *buf, int global)); void trans_characters __ARGS((char_u *buf, int bufsize)); char_u *transstr __ARGS((char_u *s)); ! void str_foldcase __ARGS((char_u *p)); char_u *transchar __ARGS((int c)); char_u *transchar_byte __ARGS((int c)); void transchar_nonprint __ARGS((char_u *buf, int c)); --- 3,9 ---- int buf_init_chartab __ARGS((buf_T *buf, int global)); void trans_characters __ARGS((char_u *buf, int bufsize)); char_u *transstr __ARGS((char_u *s)); ! char_u *str_foldcase __ARGS((char_u *str, int len)); char_u *transchar __ARGS((int c)); char_u *transchar_byte __ARGS((int c)); void transchar_nonprint __ARGS((char_u *buf, int c)); *** ../vim61.220/src/regexp.c Mon Sep 30 22:22:34 2002 --- src/regexp.c Sun Oct 6 20:52:05 2002 *************** *** 2845,2851 **** (enc_utf8 && utf_fold(prog->regstart) == utf_fold(c))) || (c < 255 && prog->regstart < 255 && #endif ! TO_LOWER(prog->regstart) == TO_LOWER(c))))) retval = regtry(prog, col); else retval = 0; --- 2847,2853 ---- (enc_utf8 && utf_fold(prog->regstart) == utf_fold(c))) || (c < 255 && prog->regstart < 255 && #endif ! TOLOWER_LOC(prog->regstart) == TOLOWER_LOC(c))))) retval = regtry(prog, col); else retval = 0; *************** *** 3432,3438 **** #ifdef FEAT_MBYTE !enc_utf8 && #endif ! TO_LOWER(*opnd) != TO_LOWER(*reginput)))) return FALSE; if (*opnd == NUL) { --- 3434,3440 ---- #ifdef FEAT_MBYTE !enc_utf8 && #endif ! TOLOWER_LOC(*opnd) != TOLOWER_LOC(*reginput)))) return FALSE; if (*opnd == NUL) { *************** *** 3886,3894 **** if (ireg_ic) { if (isupper(nextb)) ! nextb_ic = TO_LOWER(nextb); else ! nextb_ic = TO_UPPER(nextb); } else nextb_ic = nextb; --- 3888,3896 ---- if (ireg_ic) { if (isupper(nextb)) ! nextb_ic = TOLOWER_LOC(nextb); else ! nextb_ic = TOUPPER_LOC(nextb); } else nextb_ic = nextb; *************** *** 4407,4414 **** * would have been used for it. */ if (ireg_ic) { ! cu = TO_UPPER(*opnd); ! cl = TO_LOWER(*opnd); while (count < maxcount && (*scan == cu || *scan == cl)) { count++; --- 4409,4416 ---- * would have been used for it. */ if (ireg_ic) { ! cu = TOUPPER_LOC(*opnd); ! cl = TOLOWER_LOC(*opnd); while (count < maxcount && (*scan == cu || *scan == cl)) { count++; *************** *** 5206,5214 **** else #endif if (isupper(c)) ! cc = TO_LOWER(c); else if (islower(c)) ! cc = TO_UPPER(c); else return vim_strchr(s, c); --- 5208,5216 ---- else #endif if (isupper(c)) ! cc = TOLOWER_LOC(c); else if (islower(c)) ! cc = TOUPPER_LOC(c); else return vim_strchr(s, c); *************** *** 5266,5272 **** char_u *d; int c; { ! *d = TO_UPPER(c); return (fptr)NULL; } --- 5268,5274 ---- char_u *d; int c; { ! *d = TOUPPER_LOC(c); return (fptr)NULL; } *************** *** 5276,5282 **** char_u *d; int c; { ! *d = TO_UPPER(c); return (fptr)do_Upper; } --- 5278,5284 ---- char_u *d; int c; { ! *d = TOUPPER_LOC(c); return (fptr)do_Upper; } *************** *** 5286,5292 **** char_u *d; int c; { ! *d = TO_LOWER(c); return (fptr)NULL; } --- 5288,5294 ---- char_u *d; int c; { ! *d = TOLOWER_LOC(c); return (fptr)NULL; } *************** *** 5296,5302 **** char_u *d; int c; { ! *d = TO_LOWER(c); return (fptr)do_Lower; } --- 5298,5304 ---- char_u *d; int c; { ! *d = TOLOWER_LOC(c); return (fptr)do_Lower; } *** ../vim61.220/src/option.h Sun Jul 28 22:02:42 2002 --- src/option.h Sun Oct 6 20:57:57 2002 *************** *** 309,314 **** --- 309,321 ---- #ifdef FEAT_LINEBREAK EXTERN char_u *p_breakat; /* 'breakat' */ #endif + EXTERN char_u *p_cmp; /* 'casemap' */ + EXTERN unsigned cmp_flags; + #ifdef IN_OPTION_C + static char *(p_cmp_values[]) = {"internal", "keepascii", NULL}; + #endif + #define CMP_INTERNAL 0x001 + #define CMP_KEEPASCII 0x002 #ifdef FEAT_MBYTE EXTERN char_u *p_enc; /* 'encoding' */ EXTERN int p_deco; /* 'delcombine' */ *** ../vim61.220/src/syntax.c Sat Sep 28 15:15:20 2002 --- src/syntax.c Sun Oct 6 21:54:54 2002 *************** *** 2946,2952 **** ktab = syn_buf->b_keywtab[syn_khash(keyword)]; else /* round == 2, ignore case */ { ! str_foldcase(keyword); ktab = syn_buf->b_keywtab_ic[syn_khash(keyword)]; } --- 2948,2960 ---- ktab = syn_buf->b_keywtab[syn_khash(keyword)]; else /* round == 2, ignore case */ { ! p = str_foldcase(keyword, STRLEN(keyword)); ! if (p != NULL) ! { ! STRNCPY(keyword, p, MAXKEYWLEN); ! keyword[MAXKEYWLEN] = NUL; ! vim_free(p); ! } ktab = syn_buf->b_keywtab_ic[syn_khash(keyword)]; } *************** *** 3904,3914 **** keyentry_T *ktab; keyentry_T ***ktabpp; int hash; ! ktab = (keyentry_T *)alloc((int)(sizeof(keyentry_T) + STRLEN(name))); if (ktab == NULL) return; ! STRCPY(ktab->keyword, name); ktab->k_syn.id = id; ktab->k_syn.inc_tag = current_syn_inc_tag; ktab->flags = flags; --- 3912,3931 ---- keyentry_T *ktab; keyentry_T ***ktabpp; int hash; + char_u *name_ic = name; ! if (curbuf->b_syn_ic) ! { ! name_ic = str_foldcase(name, STRLEN(name)); ! if (name_ic == NULL) ! name_ic = name; ! } ! ktab = (keyentry_T *)alloc((int)(sizeof(keyentry_T) + STRLEN(name_ic))); if (ktab == NULL) return; ! STRCPY(ktab->keyword, name_ic); ! if (name_ic != name) ! vim_free(name_ic); ktab->k_syn.id = id; ktab->k_syn.inc_tag = current_syn_inc_tag; ktab->flags = flags; *************** *** 3918,3927 **** ktab->next_list = copy_id_list(next_list); if (curbuf->b_syn_ic) - { - str_foldcase(ktab->keyword); ktabpp = &curbuf->b_keywtab_ic; - } else ktabpp = &curbuf->b_keywtab; --- 3935,3941 ---- *************** *** 4047,4053 **** { if (!isalpha(arg[llen])) break; ! lowname[llen] = TO_LOWER(arg[llen]); } for (fidx = sizeof(flagtab) / sizeof(struct flag); --fidx >= 0; ) --- 4061,4067 ---- { if (!isalpha(arg[llen])) break; ! lowname[llen] = TOLOWER_ASC(arg[llen]); } for (fidx = sizeof(flagtab) / sizeof(struct flag); --fidx >= 0; ) *************** *** 5383,5389 **** || STRCMP(name + 1, "TOP") == 0 || STRCMP(name + 1, "CONTAINED") == 0) { ! if (TO_UPPER(**arg) != 'C') { EMSG2(_("E407: %s not allowed here"), name + 1); failed = TRUE; --- 5397,5403 ---- || STRCMP(name + 1, "TOP") == 0 || STRCMP(name + 1, "CONTAINED") == 0) { ! if (TOUPPER_ASC(**arg) != 'C') { EMSG2(_("E407: %s not allowed here"), name + 1); failed = TRUE; *************** *** 6533,6539 **** #endif /* reduce calls to STRICMP a bit, it can be slow */ ! off = TO_UPPER(*arg); for (i = (sizeof(color_names) / sizeof(char *)); --i >= 0; ) if (off == color_names[i][0] && STRICMP(arg + 1, color_names[i] + 1) == 0) --- 6547,6553 ---- #endif /* reduce calls to STRICMP a bit, it can be slow */ ! off = TOUPPER_ASC(*arg); for (i = (sizeof(color_names) / sizeof(char *)); --i >= 0; ) if (off == color_names[i][0] && STRICMP(arg + 1, color_names[i] + 1) == 0) *************** *** 7557,7563 **** if (id <= 0 || id > highlight_ga.ga_len) return NULL; ! if (TO_LOWER(what[0]) == 'f') fg = TRUE; else fg = FALSE; --- 7571,7577 ---- if (id <= 0 || id > highlight_ga.ga_len) return NULL; ! if (TOLOWER_ASC(what[0]) == 'f') fg = TRUE; else fg = FALSE; *** ../vim61.220/src/version.c Sun Oct 13 18:48:35 2002 --- src/version.c Sun Oct 13 19:50:11 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 221, /**/ -- hundred-and-one symptoms of being an internet addict: 212. Your Internet group window has more icons than your Accessories window. /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.vim.org \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///