comparison src/misc1.c @ 11129:f4ea50924c6d v8.0.0452

patch 8.0.0452: some macros are in lower case commit https://github.com/vim/vim/commit/1c46544412382db8b3203d6c78e550df885540bd Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 12 20:10:05 2017 +0100 patch 8.0.0452: some macros are in lower case Problem: Some macros are in lower case. Solution: Make a few more macros upper case.
author Christian Brabandt <cb@256bit.org>
date Sun, 12 Mar 2017 20:15:06 +0100
parents 506f5d8b7d8b
children 501f46f7644c
comparison
equal deleted inserted replaced
11128:23154628ab7f 11129:f4ea50924c6d
137 if (!(flags & SIN_INSERT) && curbuf->b_p_pi) 137 if (!(flags & SIN_INSERT) && curbuf->b_p_pi)
138 { 138 {
139 ind_done = 0; 139 ind_done = 0;
140 140
141 /* count as many characters as we can use */ 141 /* count as many characters as we can use */
142 while (todo > 0 && vim_iswhite(*p)) 142 while (todo > 0 && VIM_ISWHITE(*p))
143 { 143 {
144 if (*p == TAB) 144 if (*p == TAB)
145 { 145 {
146 tab_pad = (int)curbuf->b_p_ts 146 tab_pad = (int)curbuf->b_p_ts
147 - (ind_done % (int)curbuf->b_p_ts); 147 - (ind_done % (int)curbuf->b_p_ts);
200 ++ind_len; 200 ++ind_len;
201 /* ++ind_done; */ 201 /* ++ind_done; */
202 } 202 }
203 203
204 /* Return if the indent is OK already. */ 204 /* Return if the indent is OK already. */
205 if (!doit && !vim_iswhite(*p) && !(flags & SIN_INSERT)) 205 if (!doit && !VIM_ISWHITE(*p) && !(flags & SIN_INSERT))
206 return FALSE; 206 return FALSE;
207 207
208 /* Allocate memory for the new line. */ 208 /* Allocate memory for the new line. */
209 if (flags & SIN_INSERT) 209 if (flags & SIN_INSERT)
210 p = oldline; 210 p = oldline;
232 orig_char_len--; 232 orig_char_len--;
233 } 233 }
234 234
235 /* Skip over any additional white space (useful when newindent is less 235 /* Skip over any additional white space (useful when newindent is less
236 * than old) */ 236 * than old) */
237 while (vim_iswhite(*p)) 237 while (VIM_ISWHITE(*p))
238 ++p; 238 ++p;
239 239
240 } 240 }
241 else 241 else
242 { 242 {
256 if (!(flags & SIN_INSERT) && curbuf->b_p_pi) 256 if (!(flags & SIN_INSERT) && curbuf->b_p_pi)
257 { 257 {
258 p = oldline; 258 p = oldline;
259 ind_done = 0; 259 ind_done = 0;
260 260
261 while (todo > 0 && vim_iswhite(*p)) 261 while (todo > 0 && VIM_ISWHITE(*p))
262 { 262 {
263 if (*p == TAB) 263 if (*p == TAB)
264 { 264 {
265 tab_pad = (int)curbuf->b_p_ts 265 tab_pad = (int)curbuf->b_p_ts
266 - (ind_done % (int)curbuf->b_p_ts); 266 - (ind_done % (int)curbuf->b_p_ts);
355 ind_len = 0; 355 ind_len = 0;
356 ind_done = 0; 356 ind_done = 0;
357 s = src; 357 s = src;
358 358
359 /* Count/copy the usable portion of the source line */ 359 /* Count/copy the usable portion of the source line */
360 while (todo > 0 && vim_iswhite(*s)) 360 while (todo > 0 && VIM_ISWHITE(*s))
361 { 361 {
362 if (*s == TAB) 362 if (*s == TAB)
363 { 363 {
364 tab_pad = (int)curbuf->b_p_ts 364 tab_pad = (int)curbuf->b_p_ts
365 - (ind_done % (int)curbuf->b_p_ts); 365 - (ind_done % (int)curbuf->b_p_ts);
818 else /* Not a comment line */ 818 else /* Not a comment line */
819 # endif 819 # endif
820 { 820 {
821 /* Find last non-blank in line */ 821 /* Find last non-blank in line */
822 p = ptr + STRLEN(ptr) - 1; 822 p = ptr + STRLEN(ptr) - 1;
823 while (p > ptr && vim_iswhite(*p)) 823 while (p > ptr && VIM_ISWHITE(*p))
824 --p; 824 --p;
825 last_char = *p; 825 last_char = *p;
826 826
827 /* 827 /*
828 * find the character just before the '{' or ';' 828 * find the character just before the '{' or ';'
829 */ 829 */
830 if (last_char == '{' || last_char == ';') 830 if (last_char == '{' || last_char == ';')
831 { 831 {
832 if (p > ptr) 832 if (p > ptr)
833 --p; 833 --p;
834 while (p > ptr && vim_iswhite(*p)) 834 while (p > ptr && VIM_ISWHITE(*p))
835 --p; 835 --p;
836 } 836 }
837 /* 837 /*
838 * Try to catch lines that are split over multiple 838 * Try to catch lines that are split over multiple
839 * lines. eg: 839 * lines. eg:
1018 /* 1018 /*
1019 * If we have hit RETURN immediately after the start 1019 * If we have hit RETURN immediately after the start
1020 * comment leader, then put a space after the middle 1020 * comment leader, then put a space after the middle
1021 * comment leader on the next line. 1021 * comment leader on the next line.
1022 */ 1022 */
1023 if (!vim_iswhite(saved_line[lead_len - 1]) 1023 if (!VIM_ISWHITE(saved_line[lead_len - 1])
1024 && ((p_extra != NULL 1024 && ((p_extra != NULL
1025 && (int)curwin->w_cursor.col == lead_len) 1025 && (int)curwin->w_cursor.col == lead_len)
1026 || (p_extra == NULL 1026 || (p_extra == NULL
1027 && saved_line[lead_len] == NUL) 1027 && saved_line[lead_len] == NUL)
1028 || require_blank)) 1028 || require_blank))
1122 } 1122 }
1123 if (c == COM_RIGHT) /* right adjusted leader */ 1123 if (c == COM_RIGHT) /* right adjusted leader */
1124 { 1124 {
1125 /* find last non-white in the leader to line up with */ 1125 /* find last non-white in the leader to line up with */
1126 for (p = leader + lead_len - 1; p > leader 1126 for (p = leader + lead_len - 1; p > leader
1127 && vim_iswhite(*p); --p) 1127 && VIM_ISWHITE(*p); --p)
1128 ; 1128 ;
1129 ++p; 1129 ++p;
1130 1130
1131 #ifdef FEAT_MBYTE 1131 #ifdef FEAT_MBYTE
1132 /* Compute the length of the replaced characters in 1132 /* Compute the length of the replaced characters in
1178 lead_len -= l; 1178 lead_len -= l;
1179 *p = ' '; 1179 *p = ' ';
1180 } 1180 }
1181 else 1181 else
1182 #endif 1182 #endif
1183 if (!vim_iswhite(*p)) 1183 if (!VIM_ISWHITE(*p))
1184 *p = ' '; 1184 *p = ' ';
1185 } 1185 }
1186 } 1186 }
1187 else /* left adjusted leader */ 1187 else /* left adjusted leader */
1188 { 1188 {
1215 1215
1216 /* Replace any remaining non-white chars in the old 1216 /* Replace any remaining non-white chars in the old
1217 * leader by spaces. Keep Tabs, the indent must 1217 * leader by spaces. Keep Tabs, the indent must
1218 * remain the same. */ 1218 * remain the same. */
1219 for (p += lead_repl_len; p < leader + lead_len; ++p) 1219 for (p += lead_repl_len; p < leader + lead_len; ++p)
1220 if (!vim_iswhite(*p)) 1220 if (!VIM_ISWHITE(*p))
1221 { 1221 {
1222 /* Don't put a space before a TAB. */ 1222 /* Don't put a space before a TAB. */
1223 if (p + 1 < leader + lead_len && p[1] == TAB) 1223 if (p + 1 < leader + lead_len && p[1] == TAB)
1224 { 1224 {
1225 --lead_len; 1225 --lead_len;
1280 --off; 1280 --off;
1281 } 1281 }
1282 1282
1283 /* If the leader ends in white space, don't add an 1283 /* If the leader ends in white space, don't add an
1284 * extra space */ 1284 * extra space */
1285 if (lead_len > 0 && vim_iswhite(leader[lead_len - 1])) 1285 if (lead_len > 0 && VIM_ISWHITE(leader[lead_len - 1]))
1286 extra_space = FALSE; 1286 extra_space = FALSE;
1287 leader[lead_len] = NUL; 1287 leader[lead_len] = NUL;
1288 } 1288 }
1289 1289
1290 if (extra_space) 1290 if (extra_space)
1303 #ifdef FEAT_SMARTINDENT 1303 #ifdef FEAT_SMARTINDENT
1304 || did_si 1304 || did_si
1305 #endif 1305 #endif
1306 ) 1306 )
1307 { 1307 {
1308 while (lead_len && vim_iswhite(*leader)) 1308 while (lead_len && VIM_ISWHITE(*leader))
1309 { 1309 {
1310 --lead_len; 1310 --lead_len;
1311 --newcol; 1311 --newcol;
1312 ++leader; 1312 ++leader;
1313 } 1313 }
1678 int middle_match_len = 0; 1678 int middle_match_len = 0;
1679 char_u *prev_list; 1679 char_u *prev_list;
1680 char_u *saved_flags = NULL; 1680 char_u *saved_flags = NULL;
1681 1681
1682 result = i = 0; 1682 result = i = 0;
1683 while (vim_iswhite(line[i])) /* leading white space is ignored */ 1683 while (VIM_ISWHITE(line[i])) /* leading white space is ignored */
1684 ++i; 1684 ++i;
1685 1685
1686 /* 1686 /*
1687 * Repeat to match several nested comment strings. 1687 * Repeat to match several nested comment strings.
1688 */ 1688 */
1723 1723
1724 /* Line contents and string must match. 1724 /* Line contents and string must match.
1725 * When string starts with white space, must have some white space 1725 * When string starts with white space, must have some white space
1726 * (but the amount does not need to match, there might be a mix of 1726 * (but the amount does not need to match, there might be a mix of
1727 * TABs and spaces). */ 1727 * TABs and spaces). */
1728 if (vim_iswhite(string[0])) 1728 if (VIM_ISWHITE(string[0]))
1729 { 1729 {
1730 if (i == 0 || !vim_iswhite(line[i - 1])) 1730 if (i == 0 || !VIM_ISWHITE(line[i - 1]))
1731 continue; /* missing white space */ 1731 continue; /* missing white space */
1732 while (vim_iswhite(string[0])) 1732 while (VIM_ISWHITE(string[0]))
1733 ++string; 1733 ++string;
1734 } 1734 }
1735 for (j = 0; string[j] != NUL && string[j] == line[i + j]; ++j) 1735 for (j = 0; string[j] != NUL && string[j] == line[i + j]; ++j)
1736 ; 1736 ;
1737 if (string[j] != NUL) 1737 if (string[j] != NUL)
1738 continue; /* string doesn't match */ 1738 continue; /* string doesn't match */
1739 1739
1740 /* When 'b' flag used, there must be white space or an 1740 /* When 'b' flag used, there must be white space or an
1741 * end-of-line after the string in the line. */ 1741 * end-of-line after the string in the line. */
1742 if (vim_strchr(part_buf, COM_BLANK) != NULL 1742 if (vim_strchr(part_buf, COM_BLANK) != NULL
1743 && !vim_iswhite(line[i + j]) && line[i + j] != NUL) 1743 && !VIM_ISWHITE(line[i + j]) && line[i + j] != NUL)
1744 continue; 1744 continue;
1745 1745
1746 /* We have found a match, stop searching unless this is a middle 1746 /* We have found a match, stop searching unless this is a middle
1747 * comment. The middle comment can be a substring of the end 1747 * comment. The middle comment can be a substring of the end
1748 * comment in which case it's better to return the length of the 1748 * comment in which case it's better to return the length of the
1783 break; 1783 break;
1784 1784
1785 result = i; 1785 result = i;
1786 1786
1787 /* Include any trailing white space. */ 1787 /* Include any trailing white space. */
1788 while (vim_iswhite(line[i])) 1788 while (VIM_ISWHITE(line[i]))
1789 ++i; 1789 ++i;
1790 1790
1791 if (include_space) 1791 if (include_space)
1792 result = i; 1792 result = i;
1793 1793
1851 * Line contents and string must match. 1851 * Line contents and string must match.
1852 * When string starts with white space, must have some white space 1852 * When string starts with white space, must have some white space
1853 * (but the amount does not need to match, there might be a mix of 1853 * (but the amount does not need to match, there might be a mix of
1854 * TABs and spaces). 1854 * TABs and spaces).
1855 */ 1855 */
1856 if (vim_iswhite(string[0])) 1856 if (VIM_ISWHITE(string[0]))
1857 { 1857 {
1858 if (i == 0 || !vim_iswhite(line[i - 1])) 1858 if (i == 0 || !VIM_ISWHITE(line[i - 1]))
1859 continue; 1859 continue;
1860 while (vim_iswhite(string[0])) 1860 while (VIM_ISWHITE(string[0]))
1861 ++string; 1861 ++string;
1862 } 1862 }
1863 for (j = 0; string[j] != NUL && string[j] == line[i + j]; ++j) 1863 for (j = 0; string[j] != NUL && string[j] == line[i + j]; ++j)
1864 /* do nothing */; 1864 /* do nothing */;
1865 if (string[j] != NUL) 1865 if (string[j] != NUL)
1868 /* 1868 /*
1869 * When 'b' flag used, there must be white space or an 1869 * When 'b' flag used, there must be white space or an
1870 * end-of-line after the string in the line. 1870 * end-of-line after the string in the line.
1871 */ 1871 */
1872 if (vim_strchr(part_buf, COM_BLANK) != NULL 1872 if (vim_strchr(part_buf, COM_BLANK) != NULL
1873 && !vim_iswhite(line[i + j]) && line[i + j] != NUL) 1873 && !VIM_ISWHITE(line[i + j]) && line[i + j] != NUL)
1874 { 1874 {
1875 continue; 1875 continue;
1876 } 1876 }
1877 1877
1878 /* 1878 /*
1905 * of other comment leaders. If it is, let's adjust the 1905 * of other comment leaders. If it is, let's adjust the
1906 * lower_check_bound so that we make sure that we have determined 1906 * lower_check_bound so that we make sure that we have determined
1907 * the comment leader correctly. 1907 * the comment leader correctly.
1908 */ 1908 */
1909 1909
1910 while (vim_iswhite(*com_leader)) 1910 while (VIM_ISWHITE(*com_leader))
1911 ++com_leader; 1911 ++com_leader;
1912 len1 = (int)STRLEN(com_leader); 1912 len1 = (int)STRLEN(com_leader);
1913 1913
1914 for (list = curbuf->b_p_com; *list; ) 1914 for (list = curbuf->b_p_com; *list; )
1915 { 1915 {
1918 (void)copy_option_part(&list, part_buf2, COM_MAX_LEN, ","); 1918 (void)copy_option_part(&list, part_buf2, COM_MAX_LEN, ",");
1919 if (flags_save == com_flags) 1919 if (flags_save == com_flags)
1920 continue; 1920 continue;
1921 string = vim_strchr(part_buf2, ':'); 1921 string = vim_strchr(part_buf2, ':');
1922 ++string; 1922 ++string;
1923 while (vim_iswhite(*string)) 1923 while (VIM_ISWHITE(*string))
1924 ++string; 1924 ++string;
1925 len2 = (int)STRLEN(string); 1925 len2 = (int)STRLEN(string);
1926 if (len2 == 0) 1926 if (len2 == 0)
1927 continue; 1927 continue;
1928 1928
2692 inindent(int extra) 2692 inindent(int extra)
2693 { 2693 {
2694 char_u *ptr; 2694 char_u *ptr;
2695 colnr_T col; 2695 colnr_T col;
2696 2696
2697 for (col = 0, ptr = ml_get_curline(); vim_iswhite(*ptr); ++col) 2697 for (col = 0, ptr = ml_get_curline(); VIM_ISWHITE(*ptr); ++col)
2698 ++ptr; 2698 ++ptr;
2699 if (col >= curwin->w_cursor.col + extra) 2699 if (col >= curwin->w_cursor.col + extra)
2700 return TRUE; 2700 return TRUE;
2701 else 2701 else
2702 return FALSE; 2702 return FALSE;
5775 if (STRNCMP(s, "namespace", 9) == 0 && (s[9] == NUL || !vim_iswordc(s[9]))) 5775 if (STRNCMP(s, "namespace", 9) == 0 && (s[9] == NUL || !vim_iswordc(s[9])))
5776 { 5776 {
5777 p = cin_skipcomment(skipwhite(s + 9)); 5777 p = cin_skipcomment(skipwhite(s + 9));
5778 while (*p != NUL) 5778 while (*p != NUL)
5779 { 5779 {
5780 if (vim_iswhite(*p)) 5780 if (VIM_ISWHITE(*p))
5781 { 5781 {
5782 has_name = TRUE; /* found end of a name */ 5782 has_name = TRUE; /* found end of a name */
5783 p = cin_skipcomment(skipwhite(p)); 5783 p = cin_skipcomment(skipwhite(p));
5784 } 5784 }
5785 else if (*p == '{') 5785 else if (*p == '{')
5823 if (STRNCMP(s, "extern", 6) == 0 && (s[6] == NUL || !vim_iswordc(s[6]))) 5823 if (STRNCMP(s, "extern", 6) == 0 && (s[6] == NUL || !vim_iswordc(s[6])))
5824 { 5824 {
5825 p = cin_skipcomment(skipwhite(s + 6)); 5825 p = cin_skipcomment(skipwhite(s + 6));
5826 while (*p != NUL) 5826 while (*p != NUL)
5827 { 5827 {
5828 if (vim_iswhite(*p)) 5828 if (VIM_ISWHITE(*p))
5829 { 5829 {
5830 p = cin_skipcomment(skipwhite(p)); 5830 p = cin_skipcomment(skipwhite(p));
5831 } 5831 }
5832 else if (*p == '{') 5832 else if (*p == '{')
5833 { 5833 {
5974 p = skipwhite(p + 4); 5974 p = skipwhite(p + 4);
5975 else if ((len == 8 && STRNCMP(p, "unsigned", 8) == 0) 5975 else if ((len == 8 && STRNCMP(p, "unsigned", 8) == 0)
5976 || (len == 6 && STRNCMP(p, "signed", 6) == 0)) 5976 || (len == 6 && STRNCMP(p, "signed", 6) == 0))
5977 { 5977 {
5978 s = skipwhite(p + len); 5978 s = skipwhite(p + len);
5979 if ((STRNCMP(s, "int", 3) == 0 && vim_iswhite(s[3])) 5979 if ((STRNCMP(s, "int", 3) == 0 && VIM_ISWHITE(s[3]))
5980 || (STRNCMP(s, "long", 4) == 0 && vim_iswhite(s[4])) 5980 || (STRNCMP(s, "long", 4) == 0 && VIM_ISWHITE(s[4]))
5981 || (STRNCMP(s, "short", 5) == 0 && vim_iswhite(s[5])) 5981 || (STRNCMP(s, "short", 5) == 0 && VIM_ISWHITE(s[5]))
5982 || (STRNCMP(s, "char", 4) == 0 && vim_iswhite(s[4]))) 5982 || (STRNCMP(s, "char", 4) == 0 && VIM_ISWHITE(s[4])))
5983 p = s; 5983 p = s;
5984 } 5984 }
5985 for (len = 0; vim_isIDc(p[len]); ++len) 5985 for (len = 0; vim_isIDc(p[len]); ++len)
5986 ; 5986 ;
5987 if (len == 0 || !vim_iswhite(p[len]) || cin_nocode(p)) 5987 if (len == 0 || !VIM_ISWHITE(p[len]) || cin_nocode(p))
5988 return 0; 5988 return 0;
5989 5989
5990 p = skipwhite(p + len); 5990 p = skipwhite(p + len);
5991 fp.lnum = curwin->w_cursor.lnum; 5991 fp.lnum = curwin->w_cursor.lnum;
5992 fp.col = (colnr_T)(p - line); 5992 fp.col = (colnr_T)(p - line);
6354 { 6354 {
6355 int offset = *poffset; 6355 int offset = *poffset;
6356 6356
6357 if (offset-- < 2) 6357 if (offset-- < 2)
6358 return 0; 6358 return 0;
6359 while (offset > 2 && vim_iswhite(line[offset])) 6359 while (offset > 2 && VIM_ISWHITE(line[offset]))
6360 --offset; 6360 --offset;
6361 6361
6362 offset -= 1; 6362 offset -= 1;
6363 if (!STRNCMP(line + offset, "if", 2)) 6363 if (!STRNCMP(line + offset, "if", 2))
6364 goto probablyFound; 6364 goto probablyFound;
7600 else if (curbuf->b_ind_unclosed_whiteok) 7600 else if (curbuf->b_ind_unclosed_whiteok)
7601 our_paren_pos.col++; 7601 our_paren_pos.col++;
7602 else 7602 else
7603 { 7603 {
7604 col = our_paren_pos.col + 1; 7604 col = our_paren_pos.col + 1;
7605 while (vim_iswhite(l[col])) 7605 while (VIM_ISWHITE(l[col]))
7606 col++; 7606 col++;
7607 if (l[col] != NUL) /* In case of trailing space */ 7607 if (l[col] != NUL) /* In case of trailing space */
7608 our_paren_pos.col = col; 7608 our_paren_pos.col = col;
7609 else 7609 else
7610 our_paren_pos.col++; 7610 our_paren_pos.col++;
9447 { 9447 {
9448 that++; 9448 that++;
9449 amount++; 9449 amount++;
9450 firsttry = amount; 9450 firsttry = amount;
9451 9451
9452 while (vim_iswhite(*that)) 9452 while (VIM_ISWHITE(*that))
9453 { 9453 {
9454 amount += lbr_chartabsize(line, that, (colnr_T)amount); 9454 amount += lbr_chartabsize(line, that, (colnr_T)amount);
9455 ++that; 9455 ++that;
9456 } 9456 }
9457 9457
9470 && *that != '\'' 9470 && *that != '\''
9471 && *that != '#' 9471 && *that != '#'
9472 && (*that < '0' || *that > '9'))) 9472 && (*that < '0' || *that > '9')))
9473 { 9473 {
9474 while (*that 9474 while (*that
9475 && (!vim_iswhite(*that) 9475 && (!VIM_ISWHITE(*that)
9476 || quotecount 9476 || quotecount
9477 || parencount) 9477 || parencount)
9478 && (!((*that == '(' || *that == '[') 9478 && (!((*that == '(' || *that == '[')
9479 && !quotecount 9479 && !quotecount
9480 && !parencount 9480 && !parencount
9493 line, &that, (colnr_T)amount); 9493 line, &that, (colnr_T)amount);
9494 amount += lbr_chartabsize_adv( 9494 amount += lbr_chartabsize_adv(
9495 line, &that, (colnr_T)amount); 9495 line, &that, (colnr_T)amount);
9496 } 9496 }
9497 } 9497 }
9498 while (vim_iswhite(*that)) 9498 while (VIM_ISWHITE(*that))
9499 { 9499 {
9500 amount += lbr_chartabsize( 9500 amount += lbr_chartabsize(
9501 line, that, (colnr_T)amount); 9501 line, that, (colnr_T)amount);
9502 that++; 9502 that++;
9503 } 9503 }