Mercurial > emacs
comparison src/coding.c @ 110829:4d672e9d91bf
Complement a coding system for encoding arguments and input to a process.
| author | Kenichi Handa <handa@m17n.org> |
|---|---|
| date | Thu, 30 Sep 2010 13:28:34 +0900 |
| parents | 3ffb3b102dae |
| children | b997f43af473 |
comparison
equal
deleted
inserted
replaced
| 110824:bf3b8d29e992 | 110829:4d672e9d91bf |
|---|---|
| 6110 coding_system = AREF (eol_type, 2); | 6110 coding_system = AREF (eol_type, 2); |
| 6111 } | 6111 } |
| 6112 return coding_system; | 6112 return coding_system; |
| 6113 } | 6113 } |
| 6114 | 6114 |
| 6115 | |
| 6116 /* Check if text-conversion and eol-conversion of CODING_SYSTEM are | |
| 6117 decided for writing to a process. If not, complement them, and | |
| 6118 return a new coding system. */ | |
| 6119 | |
| 6120 Lisp_Object | |
| 6121 complement_process_encoding_system (coding_system) | |
| 6122 Lisp_Object coding_system; | |
| 6123 { | |
| 6124 Lisp_Object spec, attrs, coding_type, eol_type; | |
| 6125 | |
| 6126 if (NILP (coding_system)) | |
| 6127 coding_system = Qundecided; | |
| 6128 spec = CODING_SYSTEM_SPEC (coding_system); | |
| 6129 attrs = AREF (spec, 0); | |
| 6130 coding_type = CODING_ATTR_TYPE (attrs); | |
| 6131 eol_type = AREF (spec, 2); | |
| 6132 | |
| 6133 if (EQ (coding_type, Qundecided)) | |
| 6134 { | |
| 6135 /* We must decide the text-conversion part. */ | |
| 6136 if (CONSP (Vdefault_process_coding_system)) | |
| 6137 { | |
| 6138 coding_system = XCDR (Vdefault_process_coding_system); | |
| 6139 if (! NILP (coding_system)) | |
| 6140 { | |
| 6141 spec = CODING_SYSTEM_SPEC (coding_system); | |
| 6142 attrs = AREF (spec, 0); | |
| 6143 coding_type = CODING_ATTR_TYPE (attrs); | |
| 6144 eol_type = AREF (spec, 2); | |
| 6145 } | |
| 6146 } | |
| 6147 if (EQ (coding_type, Qundecided)) | |
| 6148 { | |
| 6149 coding_system = preferred_coding_system (); | |
| 6150 spec = CODING_SYSTEM_SPEC (coding_system); | |
| 6151 attrs = AREF (spec, 0); | |
| 6152 coding_type = CODING_ATTR_TYPE (attrs); | |
| 6153 eol_type = AREF (spec, 2); | |
| 6154 } | |
| 6155 if (EQ (coding_type, Qundecided)) | |
| 6156 { | |
| 6157 coding_system = Qraw_text; | |
| 6158 coding_type = Qraw_text; | |
| 6159 eol_type = Qnil; | |
| 6160 } | |
| 6161 } | |
| 6162 if (NILP (eol_type) || VECTORP (eol_type)) | |
| 6163 { | |
| 6164 /* We must decide the eol-conversion part. */ | |
| 6165 coding_system = coding_inherit_eol_type (coding_system, Qnil); | |
| 6166 } | |
| 6167 | |
| 6168 return coding_system; | |
| 6169 } | |
| 6170 | |
| 6171 | |
| 6115 /* Emacs has a mechanism to automatically detect a coding system if it | 6172 /* Emacs has a mechanism to automatically detect a coding system if it |
| 6116 is one of Emacs' internal format, ISO2022, SJIS, and BIG5. But, | 6173 is one of Emacs' internal format, ISO2022, SJIS, and BIG5. But, |
| 6117 it's impossible to distinguish some coding systems accurately | 6174 it's impossible to distinguish some coding systems accurately |
| 6118 because they use the same range of codes. So, at first, coding | 6175 because they use the same range of codes. So, at first, coding |
| 6119 systems are categorized into 7, those are: | 6176 systems are categorized into 7, those are: |
