diff options
| author | Kenichi Handa | 1997-11-08 03:05:44 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1997-11-08 03:05:44 +0000 |
| commit | c952af224541abd7cf8882e47d91fb3ba9adedf4 (patch) | |
| tree | f92a8a1ac49d6812645b0e0e1b0c927d5e5492ca /src/coding.c | |
| parent | a5ee738b6363e2a8f89a7e6e87017f507ab6349f (diff) | |
| download | emacs-c952af224541abd7cf8882e47d91fb3ba9adedf4.tar.gz emacs-c952af224541abd7cf8882e47d91fb3ba9adedf4.zip | |
(setup_coding_system): Initialize common_flags member
instead of require_flushing member of `*coding'.
(code_convert_region): Fix previous change.
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/src/coding.c b/src/coding.c index ceb579a7239..ad73f5d2dbd 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -2320,7 +2320,6 @@ setup_coding_system (coding_system, coding) | |||
| 2320 | int i; | 2320 | int i; |
| 2321 | 2321 | ||
| 2322 | /* At first, set several fields to default values. */ | 2322 | /* At first, set several fields to default values. */ |
| 2323 | coding->require_flushing = 0; | ||
| 2324 | coding->last_block = 0; | 2323 | coding->last_block = 0; |
| 2325 | coding->selective = 0; | 2324 | coding->selective = 0; |
| 2326 | coding->composing = 0; | 2325 | coding->composing = 0; |
| @@ -2378,27 +2377,49 @@ setup_coding_system (coding_system, coding) | |||
| 2378 | } | 2377 | } |
| 2379 | 2378 | ||
| 2380 | if (VECTORP (eol_type)) | 2379 | if (VECTORP (eol_type)) |
| 2381 | coding->eol_type = CODING_EOL_UNDECIDED; | 2380 | { |
| 2381 | coding->eol_type = CODING_EOL_UNDECIDED; | ||
| 2382 | coding->common_flags = CODING_REQUIRE_DETECTION_MASK; | ||
| 2383 | } | ||
| 2382 | else if (XFASTINT (eol_type) == 1) | 2384 | else if (XFASTINT (eol_type) == 1) |
| 2383 | coding->eol_type = CODING_EOL_CRLF; | 2385 | { |
| 2386 | coding->eol_type = CODING_EOL_CRLF; | ||
| 2387 | coding->common_flags | ||
| 2388 | = CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK; | ||
| 2389 | } | ||
| 2384 | else if (XFASTINT (eol_type) == 2) | 2390 | else if (XFASTINT (eol_type) == 2) |
| 2385 | coding->eol_type = CODING_EOL_CR; | 2391 | { |
| 2392 | coding->eol_type = CODING_EOL_CR; | ||
| 2393 | coding->common_flags | ||
| 2394 | = CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK; | ||
| 2395 | } | ||
| 2386 | else | 2396 | else |
| 2387 | coding->eol_type = CODING_EOL_LF; | 2397 | { |
| 2398 | coding->eol_type = CODING_EOL_LF; | ||
| 2399 | coding->common_flags = 0; | ||
| 2400 | } | ||
| 2388 | 2401 | ||
| 2389 | type = XVECTOR (coding_spec)->contents[0]; | 2402 | type = XVECTOR (coding_spec)->contents[0]; |
| 2390 | switch (XFASTINT (type)) | 2403 | switch (XFASTINT (type)) |
| 2391 | { | 2404 | { |
| 2392 | case 0: | 2405 | case 0: |
| 2393 | coding->type = coding_type_emacs_mule; | 2406 | coding->type = coding_type_emacs_mule; |
| 2407 | if (!NILP (coding->post_read_conversion)) | ||
| 2408 | coding->common_flags |= CODING_REQUIRE_DECODING_MASK; | ||
| 2409 | if (!NILP (coding->pre_write_conversion)) | ||
| 2410 | coding->common_flags |= CODING_REQUIRE_ENCODING_MASK; | ||
| 2394 | break; | 2411 | break; |
| 2395 | 2412 | ||
| 2396 | case 1: | 2413 | case 1: |
| 2397 | coding->type = coding_type_sjis; | 2414 | coding->type = coding_type_sjis; |
| 2415 | coding->common_flags | ||
| 2416 | |= CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK; | ||
| 2398 | break; | 2417 | break; |
| 2399 | 2418 | ||
| 2400 | case 2: | 2419 | case 2: |
| 2401 | coding->type = coding_type_iso2022; | 2420 | coding->type = coding_type_iso2022; |
| 2421 | coding->common_flags | ||
| 2422 | |= CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK; | ||
| 2402 | { | 2423 | { |
| 2403 | Lisp_Object val, temp; | 2424 | Lisp_Object val, temp; |
| 2404 | Lisp_Object *flags; | 2425 | Lisp_Object *flags; |
| @@ -2550,11 +2571,13 @@ setup_coding_system (coding_system, coding) | |||
| 2550 | ? 2 : 0))); | 2571 | ? 2 : 0))); |
| 2551 | } | 2572 | } |
| 2552 | } | 2573 | } |
| 2553 | coding->require_flushing = 1; | 2574 | coding->common_flags |= CODING_REQUIRE_FLUSHING_MASK; |
| 2554 | break; | 2575 | break; |
| 2555 | 2576 | ||
| 2556 | case 3: | 2577 | case 3: |
| 2557 | coding->type = coding_type_big5; | 2578 | coding->type = coding_type_big5; |
| 2579 | coding->common_flags | ||
| 2580 | |= CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK; | ||
| 2558 | coding->flags | 2581 | coding->flags |
| 2559 | = (NILP (XVECTOR (coding_spec)->contents[4]) | 2582 | = (NILP (XVECTOR (coding_spec)->contents[4]) |
| 2560 | ? CODING_FLAG_BIG5_HKU | 2583 | ? CODING_FLAG_BIG5_HKU |
| @@ -2563,6 +2586,8 @@ setup_coding_system (coding_system, coding) | |||
| 2563 | 2586 | ||
| 2564 | case 4: | 2587 | case 4: |
| 2565 | coding->type = coding_type_ccl; | 2588 | coding->type = coding_type_ccl; |
| 2589 | coding->common_flags | ||
| 2590 | |= CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK; | ||
| 2566 | { | 2591 | { |
| 2567 | Lisp_Object val = XVECTOR (coding_spec)->contents[4]; | 2592 | Lisp_Object val = XVECTOR (coding_spec)->contents[4]; |
| 2568 | if (CONSP (val) | 2593 | if (CONSP (val) |
| @@ -2575,7 +2600,7 @@ setup_coding_system (coding_system, coding) | |||
| 2575 | else | 2600 | else |
| 2576 | goto label_invalid_coding_system; | 2601 | goto label_invalid_coding_system; |
| 2577 | } | 2602 | } |
| 2578 | coding->require_flushing = 1; | 2603 | coding->common_flags |= CODING_REQUIRE_FLUSHING_MASK; |
| 2579 | break; | 2604 | break; |
| 2580 | 2605 | ||
| 2581 | case 5: | 2606 | case 5: |
| @@ -2584,7 +2609,10 @@ setup_coding_system (coding_system, coding) | |||
| 2584 | 2609 | ||
| 2585 | default: | 2610 | default: |
| 2586 | if (EQ (type, Qt)) | 2611 | if (EQ (type, Qt)) |
| 2587 | coding->type = coding_type_undecided; | 2612 | { |
| 2613 | coding->type = coding_type_undecided; | ||
| 2614 | coding->common_flags |= CODING_REQUIRE_DETECTION_MASK; | ||
| 2615 | } | ||
| 2588 | else | 2616 | else |
| 2589 | coding->type = coding_type_no_conversion; | 2617 | coding->type = coding_type_no_conversion; |
| 2590 | break; | 2618 | break; |
| @@ -2593,6 +2621,7 @@ setup_coding_system (coding_system, coding) | |||
| 2593 | 2621 | ||
| 2594 | label_invalid_coding_system: | 2622 | label_invalid_coding_system: |
| 2595 | coding->type = coding_type_no_conversion; | 2623 | coding->type = coding_type_no_conversion; |
| 2624 | coding->common_flags = 0; | ||
| 2596 | coding->eol_type = CODING_EOL_LF; | 2625 | coding->eol_type = CODING_EOL_LF; |
| 2597 | coding->symbol = coding->pre_write_conversion = coding->post_read_conversion | 2626 | coding->symbol = coding->pre_write_conversion = coding->post_read_conversion |
| 2598 | = Qnil; | 2627 | = Qnil; |
| @@ -3434,7 +3463,7 @@ code_convert_region (b, e, coding, encodep) | |||
| 3434 | insval = call1 (coding->post_read_conversion, make_number (len)); | 3463 | insval = call1 (coding->post_read_conversion, make_number (len)); |
| 3435 | CHECK_NUMBER (insval, 0); | 3464 | CHECK_NUMBER (insval, 0); |
| 3436 | if (pos >= beg + len) | 3465 | if (pos >= beg + len) |
| 3437 | pos = beg + XINT (insval); | 3466 | pos += XINT (insval) - len; |
| 3438 | else if (pos > beg) | 3467 | else if (pos > beg) |
| 3439 | pos = beg; | 3468 | pos = beg; |
| 3440 | TEMP_SET_PT (pos); | 3469 | TEMP_SET_PT (pos); |