Mercurial > hg > xemacs-beta
comparison src/file-coding.c @ 1494:210683f31426
[xemacs-hg @ 2003-05-22 06:09:03 by stephent]
coding detection debug code <87vfw3tt4b.fsf@tleepslib.sk.tsukuba.ac.jp>
typo in comment <87r86rtt18.fsf@tleepslib.sk.tsukuba.ac.jp>
author | stephent |
---|---|
date | Thu, 22 May 2003 06:09:04 +0000 |
parents | 31b70e3e9ce7 |
children | a8d8f419b459 |
comparison
equal
deleted
inserted
replaced
1493:277e2dba97ac | 1494:210683f31426 |
---|---|
472 | 472 |
473 Lisp_Object Qconvert_eol_lf, Qconvert_eol_cr, Qconvert_eol_crlf; | 473 Lisp_Object Qconvert_eol_lf, Qconvert_eol_cr, Qconvert_eol_crlf; |
474 Lisp_Object Qconvert_eol_autodetect; | 474 Lisp_Object Qconvert_eol_autodetect; |
475 | 475 |
476 Lisp_Object Qnear_certainty, Qquite_probable, Qsomewhat_likely; | 476 Lisp_Object Qnear_certainty, Qquite_probable, Qsomewhat_likely; |
477 Lisp_Object Qslightly_likely; | |
477 Lisp_Object Qas_likely_as_unlikely, Qsomewhat_unlikely, Qquite_improbable; | 478 Lisp_Object Qas_likely_as_unlikely, Qsomewhat_unlikely, Qquite_improbable; |
478 Lisp_Object Qnearly_impossible; | 479 Lisp_Object Qnearly_impossible; |
479 | 480 |
480 Lisp_Object Qdo_eol, Qdo_coding; | 481 Lisp_Object Qdo_eol, Qdo_coding; |
481 | 482 |
3486 } | 3487 } |
3487 | 3488 |
3488 static Lisp_Object | 3489 static Lisp_Object |
3489 detection_result_number_to_symbol (enum detection_result result) | 3490 detection_result_number_to_symbol (enum detection_result result) |
3490 { | 3491 { |
3491 #define FROB(sym, num) if (result == num) return (sym) | 3492 /* let compiler warn if not all enumerators are handled */ |
3493 switch (result) { | |
3494 #define FROB(sym, num) case num: return (sym) | |
3492 FROB (Qnear_certainty, DET_NEAR_CERTAINTY); | 3495 FROB (Qnear_certainty, DET_NEAR_CERTAINTY); |
3493 FROB (Qquite_probable, DET_QUITE_PROBABLE); | 3496 FROB (Qquite_probable, DET_QUITE_PROBABLE); |
3494 FROB (Qsomewhat_likely, DET_SOMEWHAT_LIKELY); | 3497 FROB (Qsomewhat_likely, DET_SOMEWHAT_LIKELY); |
3498 FROB (Qslightly_likely, DET_SLIGHTLY_LIKELY); | |
3495 FROB (Qas_likely_as_unlikely, DET_AS_LIKELY_AS_UNLIKELY); | 3499 FROB (Qas_likely_as_unlikely, DET_AS_LIKELY_AS_UNLIKELY); |
3496 FROB (Qsomewhat_unlikely, DET_SOMEWHAT_UNLIKELY); | 3500 FROB (Qsomewhat_unlikely, DET_SOMEWHAT_UNLIKELY); |
3497 FROB (Qquite_improbable, DET_QUITE_IMPROBABLE); | 3501 FROB (Qquite_improbable, DET_QUITE_IMPROBABLE); |
3498 FROB (Qnearly_impossible, DET_NEARLY_IMPOSSIBLE); | 3502 FROB (Qnearly_impossible, DET_NEARLY_IMPOSSIBLE); |
3499 #undef FROB | 3503 #undef FROB |
3504 } | |
3500 | 3505 |
3501 abort (); | 3506 abort (); |
3502 return Qnil; /* (usually) not reached */ | 3507 return Qnil; /* (usually) not reached */ |
3503 } | 3508 } |
3504 | 3509 |
3505 #if 0 /* not used */ | 3510 #if 0 /* not used */ |
3506 static enum detection_result | 3511 static enum detection_result |
3507 detection_result_symbol_to_number (Lisp_Object symbol) | 3512 detection_result_symbol_to_number (Lisp_Object symbol) |
3508 { | 3513 { |
3514 /* using switch here would be bad style, and doesn't help */ | |
3509 #define FROB(sym, num) if (EQ (symbol, sym)) return (num) | 3515 #define FROB(sym, num) if (EQ (symbol, sym)) return (num) |
3510 FROB (Qnear_certainty, DET_NEAR_CERTAINTY); | 3516 FROB (Qnear_certainty, DET_NEAR_CERTAINTY); |
3511 FROB (Qquite_probable, DET_QUITE_PROBABLE); | 3517 FROB (Qquite_probable, DET_QUITE_PROBABLE); |
3512 FROB (Qsomewhat_likely, DET_SOMEWHAT_LIKELY); | 3518 FROB (Qsomewhat_likely, DET_SOMEWHAT_LIKELY); |
3519 FROB (Qslightly_likely, DET_SLIGHTLY_LIKELY); | |
3513 FROB (Qas_likely_as_unlikely, DET_AS_LIKELY_AS_UNLIKELY); | 3520 FROB (Qas_likely_as_unlikely, DET_AS_LIKELY_AS_UNLIKELY); |
3514 FROB (Qsomewhat_unlikely, DET_SOMEWHAT_UNLIKELY); | 3521 FROB (Qsomewhat_unlikely, DET_SOMEWHAT_UNLIKELY); |
3515 FROB (Qquite_improbable, DET_QUITE_IMPROBABLE); | 3522 FROB (Qquite_improbable, DET_QUITE_IMPROBABLE); |
3516 FROB (Qnearly_impossible, DET_NEARLY_IMPOSSIBLE); | 3523 FROB (Qnearly_impossible, DET_NEARLY_IMPOSSIBLE); |
3517 #undef FROB | 3524 #undef FROB |
3640 | 3647 |
3641 #ifdef DEBUG_XEMACS | 3648 #ifdef DEBUG_XEMACS |
3642 if (!NILP (Vdebug_coding_detection)) | 3649 if (!NILP (Vdebug_coding_detection)) |
3643 { | 3650 { |
3644 stderr_out ("seen_non_ascii: %d\n", st->seen_non_ascii); | 3651 stderr_out ("seen_non_ascii: %d\n", st->seen_non_ascii); |
3652 if (coding_detector_category_count <= 0) | |
3653 stderr_out ("found %d detector categories\n", | |
3654 coding_detector_category_count); | |
3645 for (i = 0; i < coding_detector_category_count; i++) | 3655 for (i = 0; i < coding_detector_category_count; i++) |
3646 stderr_out_lisp | 3656 stderr_out_lisp |
3647 ("%s: %s\n", | 3657 ("%s: %s\n", |
3648 2, | 3658 2, |
3649 coding_category_id_to_symbol (i), | 3659 coding_category_id_to_symbol (i), |
3921 Lstream_seekable_p (lst) && | 3931 Lstream_seekable_p (lst) && |
3922 csdata->do_coding) | 3932 csdata->do_coding) |
3923 /* We can determine the coding system now. */ | 3933 /* We can determine the coding system now. */ |
3924 data->actual = determine_real_coding_system (lst); | 3934 data->actual = determine_real_coding_system (lst); |
3925 } | 3935 } |
3936 | |
3937 #ifdef DEBUG_XEMACS | |
3938 if (!NILP (Vdebug_coding_detection)) | |
3939 stderr_out_lisp ("detected coding system: %s\n", 1, data->actual); | |
3940 #endif /* DEBUG_XEMACS */ | |
3926 } | 3941 } |
3927 | 3942 |
3928 static void | 3943 static void |
3929 undecided_rewind_coding_stream (struct coding_stream *str) | 3944 undecided_rewind_coding_stream (struct coding_stream *str) |
3930 { | 3945 { |
4619 DEFSYMBOL (Qdecode); | 4634 DEFSYMBOL (Qdecode); |
4620 | 4635 |
4621 DEFSYMBOL (Qnear_certainty); | 4636 DEFSYMBOL (Qnear_certainty); |
4622 DEFSYMBOL (Qquite_probable); | 4637 DEFSYMBOL (Qquite_probable); |
4623 DEFSYMBOL (Qsomewhat_likely); | 4638 DEFSYMBOL (Qsomewhat_likely); |
4639 DEFSYMBOL (Qslightly_likely); | |
4624 DEFSYMBOL (Qas_likely_as_unlikely); | 4640 DEFSYMBOL (Qas_likely_as_unlikely); |
4625 DEFSYMBOL (Qsomewhat_unlikely); | 4641 DEFSYMBOL (Qsomewhat_unlikely); |
4626 DEFSYMBOL (Qquite_improbable); | 4642 DEFSYMBOL (Qquite_improbable); |
4627 DEFSYMBOL (Qnearly_impossible); | 4643 DEFSYMBOL (Qnearly_impossible); |
4628 | 4644 |