comparison src/file-coding.c @ 263:727739f917cb r20-5b30

Import from CVS: tag r20-5b30
author cvs
date Mon, 13 Aug 2007 10:24:41 +0200
parents 405dd6d1825b
children 8efd647ea9ca
comparison
equal deleted inserted replaced
262:9d8607af9e13 263:727739f917cb
68 Lisp_Object Qcharset_g0, Qcharset_g1, Qcharset_g2, Qcharset_g3; 68 Lisp_Object Qcharset_g0, Qcharset_g1, Qcharset_g2, Qcharset_g3;
69 Lisp_Object Qforce_g0_on_output, Qforce_g1_on_output; 69 Lisp_Object Qforce_g0_on_output, Qforce_g1_on_output;
70 Lisp_Object Qforce_g2_on_output, Qforce_g3_on_output; 70 Lisp_Object Qforce_g2_on_output, Qforce_g3_on_output;
71 Lisp_Object Qno_iso6429; 71 Lisp_Object Qno_iso6429;
72 Lisp_Object Qinput_charset_conversion, Qoutput_charset_conversion; 72 Lisp_Object Qinput_charset_conversion, Qoutput_charset_conversion;
73 Lisp_Object Qctext; 73 Lisp_Object Qctext, Qescape_quoted;
74 Lisp_Object Qshort, Qno_ascii_eol, Qno_ascii_cntl, Qseven, Qlock_shift;
74 #endif 75 #endif
75 Lisp_Object Qshort, Qno_ascii_eol, Qno_ascii_cntl, Qseven, Qlock_shift; 76 Lisp_Object Qencode, Qdecode;
76
77 Lisp_Object Qencode, Qdecode, Qescape_quoted;
78 77
79 Lisp_Object Vcoding_system_hashtable; 78 Lisp_Object Vcoding_system_hashtable;
80 79
81 int enable_multibyte_characters; 80 int enable_multibyte_characters;
82 81
392 build_string(codesys_mnemonic); \ 391 build_string(codesys_mnemonic); \
393 CODING_SYSTEM_##Type (codesys) = sub_codesys_obj; \ 392 CODING_SYSTEM_##Type (codesys) = sub_codesys_obj; \
394 } while (0) 393 } while (0)
395 394
396 DEFINE_SUB_CODESYS("unix", "", EOL_LF); 395 DEFINE_SUB_CODESYS("unix", "", EOL_LF);
397 DEFINE_SUB_CODESYS("dos", "(T)", EOL_CRLF); 396 DEFINE_SUB_CODESYS("dos", ":T", EOL_CRLF);
398 DEFINE_SUB_CODESYS("mac", "(t)", EOL_CR); 397 DEFINE_SUB_CODESYS("mac", ":t", EOL_CR);
399 } 398 }
400 399
401 DEFUN ("coding-system-p", Fcoding_system_p, 1, 1, 0, /* 400 DEFUN ("coding-system-p", Fcoding_system_p, 1, 1, 0, /*
402 T if OBJECT is a coding system. 401 T if OBJECT is a coding system.
403 A coding system is an object that defines how text containing multiple 402 A coding system is an object that defines how text containing multiple
4494 ((NILP (Vfile_name_coding_system) || \ 4493 ((NILP (Vfile_name_coding_system) || \
4495 (EQ ((Vfile_name_coding_system), Qbinary))) ? \ 4494 (EQ ((Vfile_name_coding_system), Qbinary))) ? \
4496 Qnil : Fget_coding_system (Vfile_name_coding_system)) 4495 Qnil : Fget_coding_system (Vfile_name_coding_system))
4497 4496
4498 /* #### not correct for all values of `fmt'! */ 4497 /* #### not correct for all values of `fmt'! */
4498 #ifdef MULE
4499 #define FMT_CODING_SYSTEM(fmt) \ 4499 #define FMT_CODING_SYSTEM(fmt) \
4500 (((fmt) == FORMAT_FILENAME) ? FILE_NAME_CODING_SYSTEM : \ 4500 (((fmt) == FORMAT_FILENAME) ? FILE_NAME_CODING_SYSTEM : \
4501 ((fmt) == FORMAT_CTEXT ) ? Fget_coding_system (Qctext) : \ 4501 ((fmt) == FORMAT_CTEXT ) ? Fget_coding_system (Qctext) : \
4502 ((fmt) == FORMAT_TERMINAL) ? FILE_NAME_CODING_SYSTEM : \ 4502 ((fmt) == FORMAT_TERMINAL) ? FILE_NAME_CODING_SYSTEM : \
4503 Qnil) 4503 Qnil)
4504 #else
4505 #define FMT_CODING_SYSTEM(fmt) \
4506 (((fmt) == FORMAT_FILENAME) ? FILE_NAME_CODING_SYSTEM : \
4507 ((fmt) == FORMAT_TERMINAL) ? FILE_NAME_CODING_SYSTEM : \
4508 Qnil)
4509 #endif
4504 4510
4505 extern CONST Extbyte * 4511 extern CONST Extbyte *
4506 convert_to_external_format (CONST Bufbyte *ptr, 4512 convert_to_external_format (CONST Bufbyte *ptr,
4507 Bytecount len, 4513 Bytecount len,
4508 Extcount *len_out, 4514 Extcount *len_out,
4509 enum external_data_format fmt) 4515 enum external_data_format fmt)
4510 { 4516 {
4511 #ifdef MULE
4512 Lisp_Object coding_system = FMT_CODING_SYSTEM (fmt); 4517 Lisp_Object coding_system = FMT_CODING_SYSTEM (fmt);
4513 #else
4514 Lisp_Object coding_system = Qnil;
4515 #endif
4516 4518
4517 if (!conversion_out_dynarr) 4519 if (!conversion_out_dynarr)
4518 conversion_out_dynarr = Dynarr_new (Extbyte); 4520 conversion_out_dynarr = Dynarr_new (Extbyte);
4519 else 4521 else
4520 Dynarr_reset (conversion_out_dynarr); 4522 Dynarr_reset (conversion_out_dynarr);
4578 convert_from_external_format (CONST Extbyte *ptr, 4580 convert_from_external_format (CONST Extbyte *ptr,
4579 Extcount len, 4581 Extcount len,
4580 Bytecount *len_out, 4582 Bytecount *len_out,
4581 enum external_data_format fmt) 4583 enum external_data_format fmt)
4582 { 4584 {
4583 #ifdef MULE
4584 Lisp_Object coding_system = FMT_CODING_SYSTEM (fmt); 4585 Lisp_Object coding_system = FMT_CODING_SYSTEM (fmt);
4585 #else
4586 Lisp_Object coding_system = Qnil;
4587 #endif
4588 4586
4589 if (!conversion_in_dynarr) 4587 if (!conversion_in_dynarr)
4590 conversion_in_dynarr = Dynarr_new (Bufbyte); 4588 conversion_in_dynarr = Dynarr_new (Bufbyte);
4591 else 4589 else
4592 Dynarr_reset (conversion_in_dynarr); 4590 Dynarr_reset (conversion_in_dynarr);
4707 defsymbol (&Qforce_g2_on_output, "force-g2-on-output"); 4705 defsymbol (&Qforce_g2_on_output, "force-g2-on-output");
4708 defsymbol (&Qforce_g3_on_output, "force-g3-on-output"); 4706 defsymbol (&Qforce_g3_on_output, "force-g3-on-output");
4709 defsymbol (&Qno_iso6429, "no-iso6429"); 4707 defsymbol (&Qno_iso6429, "no-iso6429");
4710 defsymbol (&Qinput_charset_conversion, "input-charset-conversion"); 4708 defsymbol (&Qinput_charset_conversion, "input-charset-conversion");
4711 defsymbol (&Qoutput_charset_conversion, "output-charset-conversion"); 4709 defsymbol (&Qoutput_charset_conversion, "output-charset-conversion");
4712 #endif
4713 defsymbol (&Qshort, "short"); 4710 defsymbol (&Qshort, "short");
4714 defsymbol (&Qno_ascii_eol, "no-ascii-eol"); 4711 defsymbol (&Qno_ascii_eol, "no-ascii-eol");
4715 defsymbol (&Qno_ascii_cntl, "no-ascii-cntl"); 4712 defsymbol (&Qno_ascii_cntl, "no-ascii-cntl");
4716 defsymbol (&Qseven, "seven"); 4713 defsymbol (&Qseven, "seven");
4717 defsymbol (&Qlock_shift, "lock-shift"); 4714 defsymbol (&Qlock_shift, "lock-shift");
4718 defsymbol (&Qescape_quoted, "escape-quoted"); 4715 defsymbol (&Qescape_quoted, "escape-quoted");
4719 4716 #endif
4720 defsymbol (&Qencode, "encode"); 4717 defsymbol (&Qencode, "encode");
4721 defsymbol (&Qdecode, "decode"); 4718 defsymbol (&Qdecode, "decode");
4722 4719
4723 #ifdef MULE 4720 #ifdef MULE
4724 defsymbol (&Qctext, "ctext"); 4721 defsymbol (&Qctext, "ctext");