diff options
| author | Richard M. Stallman | 1997-05-13 19:51:29 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-05-13 19:51:29 +0000 |
| commit | 46ed603f3e68cc502efcd386cf2fea9e26b208ae (patch) | |
| tree | dee18e925161d40cd5090e13f8d847992978cda7 | |
| parent | 0403641fca512ba597075c854a13f9259d91d812 (diff) | |
| download | emacs-46ed603f3e68cc502efcd386cf2fea9e26b208ae.tar.gz emacs-46ed603f3e68cc502efcd386cf2fea9e26b208ae.zip | |
(map_char_table): New arg SUBTABLE. Callers changed.
Pass the whole chartable to C_FUNCTION.
Pass index character as a Lisp_Object.
| -rw-r--r-- | src/fns.c | 25 |
1 files changed, 14 insertions, 11 deletions
| @@ -1367,15 +1367,17 @@ or a character code.") | |||
| 1367 | return value; | 1367 | return value; |
| 1368 | } | 1368 | } |
| 1369 | 1369 | ||
| 1370 | /* Map C_FUNCTION or FUNCTION over CHARTABLE, calling it for each | 1370 | /* Map C_FUNCTION or FUNCTION over SUBTABLE, calling it for each |
| 1371 | character or group of characters that share a value. | 1371 | character or group of characters that share a value. |
| 1372 | DEPTH is the current depth in the originally specified | 1372 | DEPTH is the current depth in the originally specified |
| 1373 | chartable, and INDICES contains the vector indices | 1373 | chartable, and INDICES contains the vector indices |
| 1374 | for the levels our callers have descended. */ | 1374 | for the levels our callers have descended. |
| 1375 | |||
| 1376 | ARG is passed to C_FUNCTION when that is called. */ | ||
| 1375 | 1377 | ||
| 1376 | void | 1378 | void |
| 1377 | map_char_table (c_function, function, chartable, depth, indices) | 1379 | map_char_table (c_function, function, subtable, arg, depth, indices) |
| 1378 | Lisp_Object (*c_function) (), function, chartable, *indices; | 1380 | Lisp_Object (*c_function) (), function, subtable, arg, *indices; |
| 1379 | int depth; | 1381 | int depth; |
| 1380 | { | 1382 | { |
| 1381 | int i, to; | 1383 | int i, to; |
| @@ -1385,9 +1387,9 @@ map_char_table (c_function, function, chartable, depth, indices) | |||
| 1385 | /* At first, handle ASCII and 8-bit European characters. */ | 1387 | /* At first, handle ASCII and 8-bit European characters. */ |
| 1386 | for (i = 0; i < CHAR_TABLE_SINGLE_BYTE_SLOTS; i++) | 1388 | for (i = 0; i < CHAR_TABLE_SINGLE_BYTE_SLOTS; i++) |
| 1387 | { | 1389 | { |
| 1388 | Lisp_Object elt = XCHAR_TABLE (chartable)->contents[i]; | 1390 | Lisp_Object elt = XCHAR_TABLE (subtable)->contents[i]; |
| 1389 | if (c_function) | 1391 | if (c_function) |
| 1390 | (*c_function) (i, elt); | 1392 | (*c_function) (arg, make_number (i), elt); |
| 1391 | else | 1393 | else |
| 1392 | call2 (function, make_number (i), elt); | 1394 | call2 (function, make_number (i), elt); |
| 1393 | } | 1395 | } |
| @@ -1401,7 +1403,7 @@ map_char_table (c_function, function, chartable, depth, indices) | |||
| 1401 | 1403 | ||
| 1402 | for (i; i < to; i++) | 1404 | for (i; i < to; i++) |
| 1403 | { | 1405 | { |
| 1404 | Lisp_Object elt = XCHAR_TABLE (chartable)->contents[i]; | 1406 | Lisp_Object elt = XCHAR_TABLE (subtable)->contents[i]; |
| 1405 | 1407 | ||
| 1406 | indices[depth] = i; | 1408 | indices[depth] = i; |
| 1407 | 1409 | ||
| @@ -1409,7 +1411,8 @@ map_char_table (c_function, function, chartable, depth, indices) | |||
| 1409 | { | 1411 | { |
| 1410 | if (depth >= 3) | 1412 | if (depth >= 3) |
| 1411 | error ("Too deep char table"); | 1413 | error ("Too deep char table"); |
| 1412 | map_char_table (c_function, function, elt, depth + 1, indices); | 1414 | map_char_table (c_function, function, elt, arg, |
| 1415 | depth + 1, indices); | ||
| 1413 | } | 1416 | } |
| 1414 | else | 1417 | else |
| 1415 | { | 1418 | { |
| @@ -1421,7 +1424,7 @@ map_char_table (c_function, function, chartable, depth, indices) | |||
| 1421 | c2 = depth >= 2 ? XFASTINT (indices[2]) : 0; | 1424 | c2 = depth >= 2 ? XFASTINT (indices[2]) : 0; |
| 1422 | c = MAKE_NON_ASCII_CHAR (charset, c1, c2); | 1425 | c = MAKE_NON_ASCII_CHAR (charset, c1, c2); |
| 1423 | if (c_function) | 1426 | if (c_function) |
| 1424 | (*c_function) (c, elt); | 1427 | (*c_function) (arg, make_number (c), elt); |
| 1425 | else | 1428 | else |
| 1426 | call2 (function, make_number (c), elt); | 1429 | call2 (function, make_number (c), elt); |
| 1427 | } | 1430 | } |
| @@ -1441,7 +1444,7 @@ The key is always a possible RANGE argument to `set-char-table-range'.") | |||
| 1441 | /* The depth of char table is at most 3. */ | 1444 | /* The depth of char table is at most 3. */ |
| 1442 | Lisp_Object *indices = (Lisp_Object *) alloca (3 * sizeof (Lisp_Object)); | 1445 | Lisp_Object *indices = (Lisp_Object *) alloca (3 * sizeof (Lisp_Object)); |
| 1443 | 1446 | ||
| 1444 | map_char_table (NULL, function, char_table, 0, indices); | 1447 | map_char_table (NULL, function, char_table, char_table, 0, indices); |
| 1445 | return Qnil; | 1448 | return Qnil; |
| 1446 | } | 1449 | } |
| 1447 | 1450 | ||
| @@ -1784,7 +1787,7 @@ and can edit it until it has been confirmed.") | |||
| 1784 | while (1) | 1787 | while (1) |
| 1785 | { | 1788 | { |
| 1786 | ans = Fdowncase (Fread_from_minibuffer (prompt, Qnil, Qnil, Qnil, | 1789 | ans = Fdowncase (Fread_from_minibuffer (prompt, Qnil, Qnil, Qnil, |
| 1787 | Qyes_or_no_p_history)); | 1790 | Qyes_or_no_p_history, Qnil)); |
| 1788 | if (XSTRING (ans)->size == 3 && !strcmp (XSTRING (ans)->data, "yes")) | 1791 | if (XSTRING (ans)->size == 3 && !strcmp (XSTRING (ans)->data, "yes")) |
| 1789 | { | 1792 | { |
| 1790 | UNGCPRO; | 1793 | UNGCPRO; |