To: vim-dev@vim.org Subject: Patch 6.1.427 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.427 Problem: Several error messages for regexp patterns are not translated. Solution: Use _() properly. (Muraoka Taro) Files: src/regexp.c *** ../vim61.426/src/regexp.c Mon Feb 24 11:29:15 2003 --- src/regexp.c Sat Mar 29 16:51:47 2003 *************** *** 313,322 **** /* Used for an error (down from) vim_regcomp(): give the error message, set * rc_did_emsg and return NULL */ ! #define EMSG_RET_NULL(m) { EMSG(_(m)); rc_did_emsg = TRUE; return NULL; } ! #define EMSG_M_RET_NULL(m, c) { EMSG2(_(m), c ? "" : "\\"); rc_did_emsg = TRUE; return NULL; } ! #define EMSG_RET_FAIL(m) { EMSG(_(m)); rc_did_emsg = TRUE; return FAIL; } ! #define EMSG_ONE_RET_NULL EMSG_M_RET_NULL("E369: invalid item in %s%%[]", reg_magic == MAGIC_ALL) #define MAX_LIMIT (32767L << 16L) --- 313,322 ---- /* Used for an error (down from) vim_regcomp(): give the error message, set * rc_did_emsg and return NULL */ ! #define EMSG_RET_NULL(m) { EMSG(m); rc_did_emsg = TRUE; return NULL; } ! #define EMSG_M_RET_NULL(m, c) { EMSG2(m, c ? "" : "\\"); rc_did_emsg = TRUE; return NULL; } ! #define EMSG_RET_FAIL(m) { EMSG(m); rc_did_emsg = TRUE; return FAIL; } ! #define EMSG_ONE_RET_NULL EMSG_M_RET_NULL(_("E369: invalid item in %s%%[]"), reg_magic == MAGIC_ALL) #define MAX_LIMIT (32767L << 16L) *************** *** 807,813 **** int flags; if (expr == NULL) ! EMSG_RET_NULL(e_null); init_class_tab(); --- 807,813 ---- int flags; if (expr == NULL) ! EMSG_RET_NULL(_(e_null)); init_class_tab(); *************** *** 823,829 **** /* Small enough for pointer-storage convention? */ #ifdef SMALL_MALLOC /* 16 bit storage allocation */ if (regsize >= 65536L - 256L) ! EMSG_RET_NULL(N_("E339: Pattern too long")); #endif /* Allocate space. */ --- 823,829 ---- /* Small enough for pointer-storage convention? */ #ifdef SMALL_MALLOC /* 16 bit storage allocation */ if (regsize >= 65536L - 256L) ! EMSG_RET_NULL(_("E339: Pattern too long")); #endif /* Allocate space. */ *************** *** 992,998 **** { /* Make a ZOPEN node. */ if (regnzpar >= NSUBEXP) ! EMSG_RET_NULL("E50: Too many \\z("); parno = regnzpar; regnzpar++; ret = regnode(ZOPEN + parno); --- 992,998 ---- { /* Make a ZOPEN node. */ if (regnzpar >= NSUBEXP) ! EMSG_RET_NULL(_("E50: Too many \\z(")); parno = regnzpar; regnzpar++; ret = regnode(ZOPEN + parno); *************** *** 1003,1009 **** { /* Make a MOPEN node. */ if (regnpar >= NSUBEXP) ! EMSG_M_RET_NULL("E51: Too many %s(", reg_magic == MAGIC_ALL); parno = regnpar; ++regnpar; ret = regnode(MOPEN + parno); --- 1003,1009 ---- { /* Make a MOPEN node. */ if (regnpar >= NSUBEXP) ! EMSG_M_RET_NULL(_("E51: Too many %s("), reg_magic == MAGIC_ALL); parno = regnpar; ++regnpar; ret = regnode(MOPEN + parno); *************** *** 1060,1079 **** { #ifdef FEAT_SYN_HL if (paren == REG_ZPAREN) ! EMSG_RET_NULL("E52: Unmatched \\z(") else #endif if (paren == REG_NPAREN) ! EMSG_M_RET_NULL("E53: Unmatched %s%%(", reg_magic == MAGIC_ALL) else ! EMSG_M_RET_NULL("E54: Unmatched %s(", reg_magic == MAGIC_ALL) } else if (paren == REG_NOPAREN && peekchr() != NUL) { if (curchr == Magic(')')) ! EMSG_M_RET_NULL("E55: Unmatched %s)", reg_magic == MAGIC_ALL) else ! EMSG_RET_NULL(e_trailing) /* "Can't happen". */ /* NOTREACHED */ } /* --- 1060,1079 ---- { #ifdef FEAT_SYN_HL if (paren == REG_ZPAREN) ! EMSG_RET_NULL(_("E52: Unmatched \\z(")) else #endif if (paren == REG_NPAREN) ! EMSG_M_RET_NULL(_("E53: Unmatched %s%%("), reg_magic == MAGIC_ALL) else ! EMSG_M_RET_NULL(_("E54: Unmatched %s("), reg_magic == MAGIC_ALL) } else if (paren == REG_NOPAREN && peekchr() != NUL) { if (curchr == Magic(')')) ! EMSG_M_RET_NULL(_("E55: Unmatched %s)"), reg_magic == MAGIC_ALL) else ! EMSG_RET_NULL(_(e_trailing)) /* "Can't happen". */ /* NOTREACHED */ } /* *************** *** 1234,1243 **** if (!(flags & HASWIDTH) && re_multi_type(op) == MULTI_MULT) { if (op == Magic('*')) ! EMSG_M_RET_NULL("E56: %s* operand could be empty", reg_magic >= MAGIC_ON); if (op == Magic('+')) ! EMSG_M_RET_NULL("E57: %s+ operand could be empty", reg_magic == MAGIC_ALL); /* "\{}" is checked below, it's allowed when there is an upper limit */ } --- 1234,1243 ---- if (!(flags & HASWIDTH) && re_multi_type(op) == MULTI_MULT) { if (op == Magic('*')) ! EMSG_M_RET_NULL(_("E56: %s* operand could be empty"), reg_magic >= MAGIC_ON); if (op == Magic('+')) ! EMSG_M_RET_NULL(_("E57: %s+ operand could be empty"), reg_magic == MAGIC_ALL); /* "\{}" is checked below, it's allowed when there is an upper limit */ } *************** *** 1291,1297 **** } } if (lop == END) ! EMSG_M_RET_NULL("E59: invalid character after %s@", reg_magic == MAGIC_ALL); /* Look behind must match with behind_pos. */ if (lop == BEHIND || lop == NOBEHIND) --- 1291,1297 ---- } } if (lop == END) ! EMSG_M_RET_NULL(_("E59: invalid character after %s@"), reg_magic == MAGIC_ALL); /* Look behind must match with behind_pos. */ if (lop == BEHIND || lop == NOBEHIND) *************** *** 1316,1322 **** return NULL; if (!(flags & HASWIDTH) && (maxval > minval ? maxval >= MAX_LIMIT : minval >= MAX_LIMIT)) ! EMSG_M_RET_NULL("E58: %s{ operand could be empty", reg_magic == MAGIC_ALL); if (flags & SIMPLE) { --- 1316,1322 ---- return NULL; if (!(flags & HASWIDTH) && (maxval > minval ? maxval >= MAX_LIMIT : minval >= MAX_LIMIT)) ! EMSG_M_RET_NULL(_("E58: %s{ operand could be empty"), reg_magic == MAGIC_ALL); if (flags & SIMPLE) { *************** *** 1326,1332 **** else { if (num_complex_braces >= 10) ! EMSG_M_RET_NULL("E60: Too many complex %s{...}s", reg_magic == MAGIC_ALL); reginsert(BRACE_COMPLEX + num_complex_braces, ret); regoptail(ret, regnode(BACK)); --- 1326,1332 ---- else { if (num_complex_braces >= 10) ! EMSG_M_RET_NULL(_("E60: Too many complex %s{...}s"), reg_magic == MAGIC_ALL); reginsert(BRACE_COMPLEX + num_complex_braces, ret); regoptail(ret, regnode(BACK)); *************** *** 1463,1469 **** case Magic('U'): p = vim_strchr(classchars, no_Magic(c)); if (p == NULL) ! EMSG_RET_NULL("E63: invalid use of \\_"); ret = regnode(classcodes[p - classchars] + extra); *flagp |= HASWIDTH | SIMPLE; break; --- 1463,1469 ---- case Magic('U'): p = vim_strchr(classchars, no_Magic(c)); if (p == NULL) ! EMSG_RET_NULL(_("E63: invalid use of \\_")); ret = regnode(classcodes[p - classchars] + extra); *flagp |= HASWIDTH | SIMPLE; break; *************** *** 1498,1504 **** case Magic('|'): case Magic('&'): case Magic(')'): ! EMSG_RET_NULL(e_internal); /* Supposed to be caught earlier. */ /* NOTREACHED */ case Magic('='): --- 1498,1504 ---- case Magic('|'): case Magic('&'): case Magic(')'): ! EMSG_RET_NULL(_(e_internal)); /* Supposed to be caught earlier. */ /* NOTREACHED */ case Magic('='): *************** *** 1532,1538 **** } } else ! EMSG_RET_NULL(e_nopresub); break; case Magic('1'): --- 1532,1538 ---- } } else ! EMSG_RET_NULL(_(e_nopresub)); break; case Magic('1'): *************** *** 1564,1570 **** && (p[2] == '!' || p[2] == '=')) break; if (*p == NUL) ! EMSG_RET_NULL("E65: Illegal back reference"); } ret = regnode(BACKREF + refnum); } --- 1564,1570 ---- && (p[2] == '!' || p[2] == '=')) break; if (*p == NUL) ! EMSG_RET_NULL(_("E65: Illegal back reference")); } ret = regnode(BACKREF + refnum); } *************** *** 1577,1583 **** switch (c) { case '(': if (reg_do_extmatch != REX_SET) ! EMSG_RET_NULL("E66: \\z( not allowed here"); if (one_exactly) EMSG_ONE_RET_NULL; ret = reg(REG_ZPAREN, &flags); --- 1577,1583 ---- switch (c) { case '(': if (reg_do_extmatch != REX_SET) ! EMSG_RET_NULL(_("E66: \\z( not allowed here")); if (one_exactly) EMSG_ONE_RET_NULL; ret = reg(REG_ZPAREN, &flags); *************** *** 1596,1602 **** case '7': case '8': case '9': if (reg_do_extmatch != REX_USE) ! EMSG_RET_NULL("E67: \\z1 et al. not allowed here"); ret = regnode(ZREF + c - '0'); re_has_z = REX_USE; break; --- 1596,1602 ---- case '7': case '8': case '9': if (reg_do_extmatch != REX_USE) ! EMSG_RET_NULL(_("E67: \\z1 et al. not allowed here")); ret = regnode(ZREF + c - '0'); re_has_z = REX_USE; break; *************** *** 1607,1613 **** case 'e': ret = regnode(MCLOSE + 0); break; ! default: EMSG_RET_NULL("E68: Invalid character after \\z"); } } break; --- 1607,1613 ---- case 'e': ret = regnode(MCLOSE + 0); break; ! default: EMSG_RET_NULL(_("E68: Invalid character after \\z")); } } break; *************** *** 1656,1662 **** while ((c = getchr()) != ']') { if (c == NUL) ! EMSG_M_RET_NULL("E69: Missing ] after %s%%[", reg_magic == MAGIC_ALL); br = regnode(BRANCH); if (ret == NULL) --- 1656,1662 ---- while ((c = getchr()) != ']') { if (c == NUL) ! EMSG_M_RET_NULL(_("E69: Missing ] after %s%%["), reg_magic == MAGIC_ALL); br = regnode(BRANCH); if (ret == NULL) *************** *** 1672,1678 **** return NULL; } if (ret == NULL) ! EMSG_M_RET_NULL("E70: Empty %s%%[]", reg_magic == MAGIC_ALL); lastbranch = regnode(BRANCH); br = regnode(NOTHING); --- 1672,1678 ---- return NULL; } if (ret == NULL) ! EMSG_M_RET_NULL(_("E70: Empty %s%%[]"), reg_magic == MAGIC_ALL); lastbranch = regnode(BRANCH); br = regnode(NOTHING); *************** *** 1732,1738 **** } } ! EMSG_M_RET_NULL("E71: Invalid character after %s%%", reg_magic == MAGIC_ALL); } } --- 1732,1738 ---- } } ! EMSG_M_RET_NULL(_("E71: Invalid character after %s%%"), reg_magic == MAGIC_ALL); } } *************** *** 1792,1805 **** #endif endc = *regparse++; if (startc > endc) ! EMSG_RET_NULL(e_invrange); #ifdef FEAT_MBYTE if (has_mbyte && ((*mb_char2len)(startc) > 1 || (*mb_char2len)(endc) > 1)) { /* Limit to a range of 256 chars */ if (endc > startc + 256) ! EMSG_RET_NULL(e_invrange); while (++startc <= endc) regmbc(startc); } --- 1792,1805 ---- #endif endc = *regparse++; if (startc > endc) ! EMSG_RET_NULL(_(e_invrange)); #ifdef FEAT_MBYTE if (has_mbyte && ((*mb_char2len)(startc) > 1 || (*mb_char2len)(endc) > 1)) { /* Limit to a range of 256 chars */ if (endc > startc + 256) ! EMSG_RET_NULL(_(e_invrange)); while (++startc <= endc) regmbc(startc); } *************** *** 1971,1977 **** regc(NUL); prevchr_len = 1; /* last char was the ']' */ if (*regparse != ']') ! EMSG_RET_NULL(e_toomsbra); /* Cannot happen? */ skipchr(); /* let's be friends with the lexer again */ *flagp |= HASWIDTH | SIMPLE; break; --- 1971,1977 ---- regc(NUL); prevchr_len = 1; /* last char was the ']' */ if (*regparse != ']') ! EMSG_RET_NULL(_(e_toomsbra)); /* Cannot happen? */ skipchr(); /* let's be friends with the lexer again */ *flagp |= HASWIDTH | SIMPLE; break; *** ../vim61.426/src/version.c Mon Mar 31 20:20:30 2003 --- src/version.c Mon Mar 31 20:22:15 2003 *************** *** 613,614 **** --- 613,616 ---- { /* Add new patch number below this line */ + /**/ + 427, /**/ -- ARTHUR: (as the MAN next to him is squashed by a sheep) Knights! Run away! Midst echoing shouts of "run away" the KNIGHTS retreat to cover with the odd cow or goose hitting them still. The KNIGHTS crouch down under cover. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 /// \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///