diff options
| author | Kenichi Handa | 1999-09-03 01:28:42 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1999-09-03 01:28:42 +0000 |
| commit | 0377370fbbff24ff79669d5d776c4590053b42fc (patch) | |
| tree | 81ff4ffb58a016e64aadbddf713d77edf6762bd2 /src | |
| parent | cae184f227ba2607c4ea9ff7b23a3d7ebb0779c4 (diff) | |
| download | emacs-0377370fbbff24ff79669d5d776c4590053b42fc.tar.gz emacs-0377370fbbff24ff79669d5d776c4590053b42fc.zip | |
(MULTIBYTE_BYTES_WIDTH): Delete the 2nd arg C. Use the
macro STRING_CHAR_AND_LENGTH. Caller changed.
Diffstat (limited to 'src')
| -rw-r--r-- | src/indent.c | 83 |
1 files changed, 20 insertions, 63 deletions
diff --git a/src/indent.c b/src/indent.c index 699bae64bc1..f53d971018c 100644 --- a/src/indent.c +++ b/src/indent.c | |||
| @@ -268,71 +268,28 @@ skip_invisible (pos, next_boundary_p, to, window) | |||
| 268 | 268 | ||
| 269 | /* Set variables WIDTH and BYTES for a multibyte sequence starting at P. | 269 | /* Set variables WIDTH and BYTES for a multibyte sequence starting at P. |
| 270 | 270 | ||
| 271 | C is *P which should satisfy `BASE_LEADING_CODE_P (c)'. | ||
| 272 | |||
| 273 | DP is a display table or NULL. | 271 | DP is a display table or NULL. |
| 274 | 272 | ||
| 275 | This macro is used in current_column_1, Fmove_to_column, and | 273 | This macro is used in current_column_1, Fmove_to_column, and |
| 276 | compute_motion. */ | 274 | compute_motion. */ |
| 277 | 275 | ||
| 278 | #define MULTIBYTE_BYTES_WIDTH(p, c, dp) \ | 276 | #define MULTIBYTE_BYTES_WIDTH(p, dp) \ |
| 279 | do { \ | 277 | do { \ |
| 280 | unsigned char *pend = p + 1; \ | 278 | int c; \ |
| 281 | \ | 279 | \ |
| 282 | wide_column = 0; \ | 280 | wide_column = 0; \ |
| 283 | while (! CHAR_HEAD_P (*pend)) pend++; \ | 281 | c = STRING_CHAR_AND_LENGTH (p, MAX_LENGTH_OF_MULTI_BYTE_FORM, bytes); \ |
| 284 | \ | 282 | if (BYTES_BY_CHAR_HEAD (*p) != bytes) \ |
| 285 | if (c == LEADING_CODE_COMPOSITION) \ | 283 | width = bytes * 4; \ |
| 286 | { \ | 284 | else \ |
| 287 | int id = str_cmpchar_id (p, pend - p); \ | 285 | { \ |
| 288 | int ch = MAKE_COMPOSITE_CHAR (id); \ | 286 | if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c))) \ |
| 289 | \ | 287 | width = XVECTOR (DISP_CHAR_VECTOR (dp, c))->size; \ |
| 290 | if (id >= 0) \ | 288 | else \ |
| 291 | { \ | 289 | width = WIDTH_BY_CHAR_HEAD (*p); \ |
| 292 | bytes = cmpchar_table[id]->len; \ | 290 | if (width > 1) \ |
| 293 | if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, ch))) \ | 291 | wide_column = width; \ |
| 294 | width = XVECTOR (DISP_CHAR_VECTOR (dp, ch))->size; \ | 292 | } \ |
| 295 | else \ | ||
| 296 | width = cmpchar_table[id]->width; \ | ||
| 297 | if (width > 1) \ | ||
| 298 | wide_column = width; \ | ||
| 299 | } \ | ||
| 300 | else \ | ||
| 301 | { \ | ||
| 302 | bytes = 1; \ | ||
| 303 | width = 4; \ | ||
| 304 | } \ | ||
| 305 | } \ | ||
| 306 | else \ | ||
| 307 | { \ | ||
| 308 | bytes = BYTES_BY_CHAR_HEAD (c); \ | ||
| 309 | if (bytes >= 2 && bytes <= pend - p) \ | ||
| 310 | { \ | ||
| 311 | int ch = STRING_CHAR (p, bytes); \ | ||
| 312 | \ | ||
| 313 | if (CHAR_VALID_P (ch, 0)) \ | ||
| 314 | { \ | ||
| 315 | if (dp && VECTORP (DISP_CHAR_VECTOR (dp, ch))) \ | ||
| 316 | width = XVECTOR (DISP_CHAR_VECTOR (dp, ch))->size; \ | ||
| 317 | else \ | ||
| 318 | width = WIDTH_BY_CHAR_HEAD (c); \ | ||
| 319 | } \ | ||
| 320 | else \ | ||
| 321 | width = bytes * 4; \ | ||
| 322 | if (width > 1) \ | ||
| 323 | wide_column = width; \ | ||
| 324 | } \ | ||
| 325 | else \ | ||
| 326 | { \ | ||
| 327 | bytes = 1; \ | ||
| 328 | width = 4; \ | ||
| 329 | } \ | ||
| 330 | } \ | ||
| 331 | if (p + bytes < pend) \ | ||
| 332 | { \ | ||
| 333 | width += 4 * (pend - (p + bytes)); \ | ||
| 334 | bytes = pend - p; \ | ||
| 335 | } \ | ||
| 336 | } while (0) | 293 | } while (0) |
| 337 | 294 | ||
| 338 | DEFUN ("current-column", Fcurrent_column, Scurrent_column, 0, 0, 0, | 295 | DEFUN ("current-column", Fcurrent_column, Scurrent_column, 0, 0, 0, |
| @@ -536,7 +493,7 @@ current_column_1 () | |||
| 536 | 493 | ||
| 537 | scan_byte--; | 494 | scan_byte--; |
| 538 | ptr = BYTE_POS_ADDR (scan_byte); | 495 | ptr = BYTE_POS_ADDR (scan_byte); |
| 539 | MULTIBYTE_BYTES_WIDTH (ptr, c, dp); | 496 | MULTIBYTE_BYTES_WIDTH (ptr, dp); |
| 540 | scan_byte += bytes; | 497 | scan_byte += bytes; |
| 541 | col += width; | 498 | col += width; |
| 542 | } | 499 | } |
| @@ -919,7 +876,7 @@ The return value is the current column.") | |||
| 919 | 876 | ||
| 920 | pos_byte--; | 877 | pos_byte--; |
| 921 | ptr = BYTE_POS_ADDR (pos_byte); | 878 | ptr = BYTE_POS_ADDR (pos_byte); |
| 922 | MULTIBYTE_BYTES_WIDTH (ptr, c, dp); | 879 | MULTIBYTE_BYTES_WIDTH (ptr, dp); |
| 923 | pos_byte += bytes; | 880 | pos_byte += bytes; |
| 924 | col += width; | 881 | col += width; |
| 925 | } | 882 | } |
| @@ -1482,7 +1439,7 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width, | |||
| 1482 | 1439 | ||
| 1483 | pos_byte--; /* rewind POS_BYTE */ | 1440 | pos_byte--; /* rewind POS_BYTE */ |
| 1484 | ptr = BYTE_POS_ADDR (pos_byte); | 1441 | ptr = BYTE_POS_ADDR (pos_byte); |
| 1485 | MULTIBYTE_BYTES_WIDTH (ptr, c, dp); | 1442 | MULTIBYTE_BYTES_WIDTH (ptr, dp); |
| 1486 | pos_byte += bytes; | 1443 | pos_byte += bytes; |
| 1487 | if (wide_column) | 1444 | if (wide_column) |
| 1488 | wide_column_end_hpos = hpos + wide_column; | 1445 | wide_column_end_hpos = hpos + wide_column; |