Mercurial > emacs
comparison src/coding.c @ 20227:71008f909642
(setup_coding_system): Initialize common_flags member
instead of require_flushing member of `*coding'.
(code_convert_region): Fix previous change.
| author | Kenichi Handa <handa@m17n.org> |
|---|---|
| date | Sat, 08 Nov 1997 03:05:44 +0000 |
| parents | 402b6e5f4b58 |
| children | 9960d1196c09 |
comparison
equal
deleted
inserted
replaced
| 20226:549826cf2952 | 20227:71008f909642 |
|---|---|
| 2318 Lisp_Object coding_spec, plist, type, eol_type; | 2318 Lisp_Object coding_spec, plist, type, eol_type; |
| 2319 Lisp_Object val; | 2319 Lisp_Object val; |
| 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; |
| 2327 coding->direction = 0; | 2326 coding->direction = 0; |
| 2328 coding->carryover_size = 0; | 2327 coding->carryover_size = 0; |
| 2376 val = XCONS (val)->cdr; | 2375 val = XCONS (val)->cdr; |
| 2377 } | 2376 } |
| 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; |
| 2405 int i, charset, default_reg_bits = 0; | 2426 int i, charset, default_reg_bits = 0; |
| 2406 | 2427 |
| 2548 ? 1 | 2569 ? 1 |
| 2549 : (coding->flags & CODING_FLAG_ISO_SINGLE_SHIFT | 2570 : (coding->flags & CODING_FLAG_ISO_SINGLE_SHIFT |
| 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 |
| 2561 : CODING_FLAG_BIG5_ETEN); | 2584 : CODING_FLAG_BIG5_ETEN); |
| 2562 break; | 2585 break; |
| 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) |
| 2569 && VECTORP (XCONS (val)->car) | 2594 && VECTORP (XCONS (val)->car) |
| 2570 && VECTORP (XCONS (val)->cdr)) | 2595 && VECTORP (XCONS (val)->cdr)) |
| 2573 setup_ccl_program (&(coding->spec.ccl.encoder), XCONS (val)->cdr); | 2598 setup_ccl_program (&(coding->spec.ccl.encoder), XCONS (val)->cdr); |
| 2574 } | 2599 } |
| 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: |
| 2582 coding->type = coding_type_raw_text; | 2607 coding->type = coding_type_raw_text; |
| 2583 break; | 2608 break; |
| 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; |
| 2591 } | 2619 } |
| 2592 return 0; | 2620 return 0; |
| 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; |
| 2599 return -1; | 2628 return -1; |
| 2600 } | 2629 } |
| 3432 beg = XINT (b); | 3461 beg = XINT (b); |
| 3433 TEMP_SET_PT (beg); | 3462 TEMP_SET_PT (beg); |
| 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); |
| 3441 len = XINT (insval); | 3470 len = XINT (insval); |
| 3442 } | 3471 } |
