comparison src/mule-coding.c @ 96:dbb370e3c29e r20-0final

Import from CVS: tag r20-0final
author cvs
date Mon, 13 Aug 2007 09:12:40 +0200
parents 54cc21c15cbb
children fe104dbd9147
comparison
equal deleted inserted replaced
95:e8c07a565f9c 96:dbb370e3c29e
1989 Lisp_Object instream, outstream; 1989 Lisp_Object instream, outstream;
1990 int speccount = specpdl_depth (); 1990 int speccount = specpdl_depth ();
1991 struct gcpro gcpro1, gcpro2; 1991 struct gcpro gcpro1, gcpro2;
1992 1992
1993 get_buffer_range_char (buf, start, end, &b, &e, 0); 1993 get_buffer_range_char (buf, start, end, &b, &e, 0);
1994
1995 barf_if_buffer_read_only (buf, b, e);
1996
1994 coding_system = Fget_coding_system (coding_system); 1997 coding_system = Fget_coding_system (coding_system);
1995 instream = make_lisp_buffer_input_stream (buf, b, e, 0); 1998 instream = make_lisp_buffer_input_stream (buf, b, e, 0);
1996 outstream = make_lisp_buffer_output_stream (buf, b, 0); 1999 outstream = make_lisp_buffer_output_stream (buf, b, 0);
1997 outstream = make_decoding_output_stream (XLSTREAM (outstream), 2000 outstream = make_decoding_output_stream (XLSTREAM (outstream),
1998 coding_system); 2001 coding_system);
2377 char tempbuf[1024]; /* some random amount */ 2380 char tempbuf[1024]; /* some random amount */
2378 int speccount = specpdl_depth (); 2381 int speccount = specpdl_depth ();
2379 struct gcpro gcpro1, gcpro2; 2382 struct gcpro gcpro1, gcpro2;
2380 2383
2381 get_buffer_range_char (buf, start, end, &b, &e, 0); 2384 get_buffer_range_char (buf, start, end, &b, &e, 0);
2385
2386 barf_if_buffer_read_only (buf, b, e);
2387
2382 coding_system = Fget_coding_system (coding_system); 2388 coding_system = Fget_coding_system (coding_system);
2383 instream = make_lisp_buffer_input_stream (buf, b, e, 0); 2389 instream = make_lisp_buffer_input_stream (buf, b, e, 0);
2384 outstream = make_lisp_buffer_output_stream (buf, b, 0); 2390 outstream = make_lisp_buffer_output_stream (buf, b, 0);
2385 outstream = make_decoding_output_stream (XLSTREAM (outstream), 2391 outstream = make_decoding_output_stream (XLSTREAM (outstream),
2386 Fget_coding_system (Qbinary)); 2392 Fget_coding_system (Qbinary));
2484 (c1, c2) into Shift-JIS code (sj1, sj2). The leading byte is 2490 (c1, c2) into Shift-JIS code (sj1, sj2). The leading byte is
2485 assumed. */ 2491 assumed. */
2486 2492
2487 #define ENCODE_SJIS(c1, c2, sj1, sj2) \ 2493 #define ENCODE_SJIS(c1, c2, sj1, sj2) \
2488 do { \ 2494 do { \
2489 int I1 = c1, I2 = sj2; \ 2495 int I1 = c1, I2 = c2; \
2490 if (I1 & 1) \ 2496 if (I1 & 1) \
2491 sj1 = (I1 >> 1) + ((I1 < 0xdf) ? 0x31 : 0x71), \ 2497 sj1 = (I1 >> 1) + ((I1 < 0xdf) ? 0x31 : 0x71), \
2492 sj2 = I2 - ((I2 >= 0xe0) ? 0x60 : 0x61); \ 2498 sj2 = I2 - ((I2 >= 0xe0) ? 0x60 : 0x61); \
2493 else \ 2499 else \
2494 sj1 = (I1 >> 1) + ((I1 < 0xdf) ? 0x30 : 0x70), \ 2500 sj1 = (I1 >> 1) + ((I1 < 0xdf) ? 0x30 : 0x70), \