comparison src/coding.c @ 22954:928b337d953b

Avoid using initializers for Lisp_Object.
author Richard M. Stallman <rms@gnu.org>
date Sat, 08 Aug 1998 21:32:57 +0000
parents b133f07a76db
children 87f4c88f4c59
comparison
equal deleted inserted replaced
22953:fbeacfb09096 22954:928b337d953b
2971 reg_bits |= 1 << i; 2971 reg_bits |= 1 << i;
2972 coding->flags |= CODING_FLAG_ISO_DESIGNATION; 2972 coding->flags |= CODING_FLAG_ISO_DESIGNATION;
2973 } 2973 }
2974 else if (CONSP (flags[i])) 2974 else if (CONSP (flags[i]))
2975 { 2975 {
2976 Lisp_Object tail = flags[i]; 2976 Lisp_Object tail;
2977 tail = flags[i];
2977 2978
2978 coding->flags |= CODING_FLAG_ISO_DESIGNATION; 2979 coding->flags |= CODING_FLAG_ISO_DESIGNATION;
2979 if (INTEGERP (XCONS (tail)->car) 2980 if (INTEGERP (XCONS (tail)->car)
2980 && (charset = XINT (XCONS (tail)->car), 2981 && (charset = XINT (XCONS (tail)->car),
2981 CHARSET_VALID_P (charset)) 2982 CHARSET_VALID_P (charset))
3055 case 4: 3056 case 4:
3056 coding->type = coding_type_ccl; 3057 coding->type = coding_type_ccl;
3057 coding->common_flags 3058 coding->common_flags
3058 |= CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK; 3059 |= CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK;
3059 { 3060 {
3060 Lisp_Object val = XVECTOR (coding_spec)->contents[4]; 3061 Lisp_Object val;
3061 Lisp_Object decoder, encoder; 3062 Lisp_Object decoder, encoder;
3062 3063
3064 val = XVECTOR (coding_spec)->contents[4];
3063 if (CONSP (val) 3065 if (CONSP (val)
3064 && SYMBOLP (XCONS (val)->car) 3066 && SYMBOLP (XCONS (val)->car)
3065 && !NILP (decoder = Fget (XCONS (val)->car, Qccl_program_idx)) 3067 && !NILP (decoder = Fget (XCONS (val)->car, Qccl_program_idx))
3066 && !NILP (decoder = Fcdr (Faref (Vccl_program_table, decoder))) 3068 && !NILP (decoder = Fcdr (Faref (Vccl_program_table, decoder)))
3067 && SYMBOLP (XCONS (val)->cdr) 3069 && SYMBOLP (XCONS (val)->cdr)
3133 { 3135 {
3134 coding->symbol = Qraw_text; 3136 coding->symbol = Qraw_text;
3135 coding->type = coding_type_raw_text; 3137 coding->type = coding_type_raw_text;
3136 if (coding->eol_type != CODING_EOL_UNDECIDED) 3138 if (coding->eol_type != CODING_EOL_UNDECIDED)
3137 { 3139 {
3138 Lisp_Object subsidiaries = Fget (Qraw_text, Qeol_type); 3140 Lisp_Object subsidiaries;
3141 subsidiaries = Fget (Qraw_text, Qeol_type);
3139 3142
3140 if (VECTORP (subsidiaries) 3143 if (VECTORP (subsidiaries)
3141 && XVECTOR (subsidiaries)->size == 3) 3144 && XVECTOR (subsidiaries)->size == 3)
3142 coding->symbol 3145 coding->symbol
3143 = XVECTOR (subsidiaries)->contents[coding->eol_type]; 3146 = XVECTOR (subsidiaries)->contents[coding->eol_type];
3386 unsigned char *src; 3389 unsigned char *src;
3387 int src_bytes; 3390 int src_bytes;
3388 { 3391 {
3389 unsigned int idx; 3392 unsigned int idx;
3390 int skip, mask, i; 3393 int skip, mask, i;
3391 Lisp_Object val = Vcoding_category_list; 3394 Lisp_Object val;
3392 3395
3396 val = Vcoding_category_list;
3393 mask = detect_coding_mask (src, src_bytes, coding_priorities, &skip); 3397 mask = detect_coding_mask (src, src_bytes, coding_priorities, &skip);
3394 coding->heading_ascii = skip; 3398 coding->heading_ascii = skip;
3395 3399
3396 if (!mask) return; 3400 if (!mask) return;
3397 3401
3403 3407
3404 val = XSYMBOL (XVECTOR (Vcoding_category_table)->contents[idx])->value; 3408 val = XSYMBOL (XVECTOR (Vcoding_category_table)->contents[idx])->value;
3405 3409
3406 if (coding->eol_type != CODING_EOL_UNDECIDED) 3410 if (coding->eol_type != CODING_EOL_UNDECIDED)
3407 { 3411 {
3408 Lisp_Object tmp = Fget (val, Qeol_type); 3412 Lisp_Object tmp;
3409 3413
3414 tmp = Fget (val, Qeol_type);
3410 if (VECTORP (tmp)) 3415 if (VECTORP (tmp))
3411 val = XVECTOR (tmp)->contents[coding->eol_type]; 3416 val = XVECTOR (tmp)->contents[coding->eol_type];
3412 } 3417 }
3413 setup_coding_system (val, coding); 3418 setup_coding_system (val, coding);
3414 /* Set this again because setup_coding_system reset this member. */ 3419 /* Set this again because setup_coding_system reset this member. */
4043 struct coding_system *coding; 4048 struct coding_system *coding;
4044 { 4049 {
4045 int len = to - from, len_byte = to_byte - from_byte; 4050 int len = to - from, len_byte = to_byte - from_byte;
4046 int require, inserted, inserted_byte; 4051 int require, inserted, inserted_byte;
4047 int head_skip, tail_skip, total_skip; 4052 int head_skip, tail_skip, total_skip;
4048 Lisp_Object saved_coding_symbol = Qnil; 4053 Lisp_Object saved_coding_symbol;
4049 int multibyte = !NILP (current_buffer->enable_multibyte_characters); 4054 int multibyte = !NILP (current_buffer->enable_multibyte_characters);
4050 int first = 1; 4055 int first = 1;
4051 int fake_multibyte = 0; 4056 int fake_multibyte = 0;
4052 unsigned char *src, *dst; 4057 unsigned char *src, *dst;
4053 Lisp_Object deletion = Qnil; 4058 Lisp_Object deletion;
4059
4060 deletion = Qnil;
4061 saved_coding_symbol = Qnil;
4054 4062
4055 if (from < PT && PT < to) 4063 if (from < PT && PT < to)
4056 SET_PT_BOTH (from, from_byte); 4064 SET_PT_BOTH (from, from_byte);
4057 4065
4058 if (replace) 4066 if (replace)
4400 int len; 4408 int len;
4401 char *buf; 4409 char *buf;
4402 int from = 0, to = XSTRING (str)->size; 4410 int from = 0, to = XSTRING (str)->size;
4403 int to_byte = STRING_BYTES (XSTRING (str)); 4411 int to_byte = STRING_BYTES (XSTRING (str));
4404 struct gcpro gcpro1; 4412 struct gcpro gcpro1;
4405 Lisp_Object saved_coding_symbol = Qnil; 4413 Lisp_Object saved_coding_symbol;
4406 int result; 4414 int result;
4407 4415
4416 saved_coding_symbol = Qnil;
4408 if (encodep && !NILP (coding->pre_write_conversion) 4417 if (encodep && !NILP (coding->pre_write_conversion)
4409 || !encodep && !NILP (coding->post_read_conversion)) 4418 || !encodep && !NILP (coding->post_read_conversion))
4410 { 4419 {
4411 /* Since we have to call Lisp functions which assume target text 4420 /* Since we have to call Lisp functions which assume target text
4412 is in a buffer, after setting a temporary buffer, call 4421 is in a buffer, after setting a temporary buffer, call
5090 "Update internal database for the current value of `coding-category-list'.\n\ 5099 "Update internal database for the current value of `coding-category-list'.\n\
5091 This function is internal use only.") 5100 This function is internal use only.")
5092 () 5101 ()
5093 { 5102 {
5094 int i = 0, idx; 5103 int i = 0, idx;
5095 Lisp_Object val = Vcoding_category_list; 5104 Lisp_Object val;
5105
5106 val = Vcoding_category_list;
5096 5107
5097 while (CONSP (val) && i < CODING_CATEGORY_IDX_MAX) 5108 while (CONSP (val) && i < CODING_CATEGORY_IDX_MAX)
5098 { 5109 {
5099 if (! SYMBOLP (XCONS (val)->car)) 5110 if (! SYMBOLP (XCONS (val)->car))
5100 break; 5111 break;