comparison src/coding.c @ 90394:263867fe7b55

(system_eol_type): Sync with HEAD. (coding_inherit_eol_type): If PARENT is nil, inherit from system_eol_type. (syms_of_coding): Initialize system_eol_type.
author Kenichi Handa <handa@m17n.org>
date Mon, 15 May 2006 02:48:46 +0000
parents 4bf7966e0788
children a8190f7e546e
comparison
equal deleted inserted replaced
90393:6592da24d351 90394:263867fe7b55
337 /* Mnemonic string for each format of end-of-line. */ 337 /* Mnemonic string for each format of end-of-line. */
338 Lisp_Object eol_mnemonic_unix, eol_mnemonic_dos, eol_mnemonic_mac; 338 Lisp_Object eol_mnemonic_unix, eol_mnemonic_dos, eol_mnemonic_mac;
339 /* Mnemonic string to indicate format of end-of-line is not yet 339 /* Mnemonic string to indicate format of end-of-line is not yet
340 decided. */ 340 decided. */
341 Lisp_Object eol_mnemonic_undecided; 341 Lisp_Object eol_mnemonic_undecided;
342
343 /* Format of end-of-line decided by system. This is Qunix on
344 Unix and Mac, Qdos on DOS/Windows.
345 This has an effect only for external encoding (i.e. for output to
346 file and process), not for in-buffer or Lisp string encoding. */
347 static Lisp_Object system_eol_type;
342 348
343 #ifdef emacs 349 #ifdef emacs
344 350
345 Lisp_Object Vcoding_system_list, Vcoding_system_alist; 351 Lisp_Object Vcoding_system_list, Vcoding_system_alist;
346 352
5172 } 5178 }
5173 5179
5174 5180
5175 /* If CODING_SYSTEM doesn't specify end-of-line format but PARENT 5181 /* If CODING_SYSTEM doesn't specify end-of-line format but PARENT
5176 does, return one of the subsidiary that has the same eol-spec as 5182 does, return one of the subsidiary that has the same eol-spec as
5177 PARENT. Otherwise, return CODING_SYSTEM. */ 5183 PARENT. Otherwise, return CODING_SYSTEM. If PARENT is nil,
5184 inherit end-of-line format from the system's setting
5185 (system_eol_type). */
5178 5186
5179 Lisp_Object 5187 Lisp_Object
5180 coding_inherit_eol_type (coding_system, parent) 5188 coding_inherit_eol_type (coding_system, parent)
5181 Lisp_Object coding_system, parent; 5189 Lisp_Object coding_system, parent;
5182 { 5190 {
5184 5192
5185 if (NILP (coding_system)) 5193 if (NILP (coding_system))
5186 coding_system = Qraw_text; 5194 coding_system = Qraw_text;
5187 spec = CODING_SYSTEM_SPEC (coding_system); 5195 spec = CODING_SYSTEM_SPEC (coding_system);
5188 eol_type = AREF (spec, 2); 5196 eol_type = AREF (spec, 2);
5189 if (VECTORP (eol_type) 5197 if (VECTORP (eol_type))
5190 && ! NILP (parent)) 5198 {
5191 {
5192 Lisp_Object parent_spec;
5193 Lisp_Object parent_eol_type; 5199 Lisp_Object parent_eol_type;
5194 5200
5195 parent_spec 5201 if (! NILP (parent))
5196 = CODING_SYSTEM_SPEC (buffer_defaults.buffer_file_coding_system); 5202 {
5197 parent_eol_type = AREF (parent_spec, 2); 5203 Lisp_Object parent_spec;
5204
5205 parent_spec
5206 = CODING_SYSTEM_SPEC (buffer_defaults.buffer_file_coding_system);
5207 parent_eol_type = AREF (parent_spec, 2);
5208 }
5209 else
5210 parent_eol_type = system_eol_type;
5198 if (EQ (parent_eol_type, Qunix)) 5211 if (EQ (parent_eol_type, Qunix))
5199 coding_system = AREF (eol_type, 0); 5212 coding_system = AREF (eol_type, 0);
5200 else if (EQ (parent_eol_type, Qdos)) 5213 else if (EQ (parent_eol_type, Qdos))
5201 coding_system = AREF (eol_type, 1); 5214 coding_system = AREF (eol_type, 1);
5202 else if (EQ (parent_eol_type, Qmac)) 5215 else if (EQ (parent_eol_type, Qmac))
9737 int i; 9750 int i;
9738 9751
9739 for (i = 0; i < coding_category_max; i++) 9752 for (i = 0; i < coding_category_max; i++)
9740 Fset (AREF (Vcoding_category_table, i), Qno_conversion); 9753 Fset (AREF (Vcoding_category_table, i), Qno_conversion);
9741 } 9754 }
9755 #if defined (MSDOS) || defined (WINDOWSNT)
9756 system_eol_type = Qdos;
9757 #else
9758 system_eol_type = Qunix;
9759 #endif
9760 staticpro (&system_eol_type);
9742 } 9761 }
9743 9762
9744 char * 9763 char *
9745 emacs_strerror (error_number) 9764 emacs_strerror (error_number)
9746 int error_number; 9765 int error_number;