comparison src/glyphs-x.c @ 259:11cf20601dec r20-5b28

Import from CVS: tag r20-5b28
author cvs
date Mon, 13 Aug 2007 10:23:02 +0200
parents 677f6a0ee643
children 8efd647ea9ca
comparison
equal deleted inserted replaced
258:58424f6abf56 259:11cf20601dec
64 } 64 }
65 #endif 65 #endif
66 #else 66 #else
67 #include <setjmp.h> 67 #include <setjmp.h>
68 #endif 68 #endif
69 69 #ifdef FILE_CODING
70 #ifdef MULE 70 #include "file-coding.h"
71 #include "mule-coding.h"
72 #endif 71 #endif
73 72
74 #define LISP_DEVICE_TO_X_SCREEN(dev) \ 73 #define LISP_DEVICE_TO_X_SCREEN(dev) \
75 XDefaultScreenOfDisplay (DEVICE_X_DISPLAY (XDEVICE (dev))) 74 XDefaultScreenOfDisplay (DEVICE_X_DISPLAY (XDEVICE (dev)))
76 75
450 int fubar = 0; 449 int fubar = 0;
451 FILE *tmpfil; 450 FILE *tmpfil;
452 static Extbyte_dynarr *conversion_out_dynarr = NULL; 451 static Extbyte_dynarr *conversion_out_dynarr = NULL;
453 Bytecount bstart, bend; 452 Bytecount bstart, bend;
454 struct gcpro gcpro1, gcpro2; 453 struct gcpro gcpro1, gcpro2;
455 #ifdef MULE 454 #ifdef FILE_CODING
456 Lisp_Object conv_out_stream; 455 Lisp_Object conv_out_stream;
457 Lstream *costr; 456 Lstream *costr;
458 struct gcpro gcpro3; 457 struct gcpro gcpro3;
459 #endif 458 #endif
460 459
487 instream = make_lisp_string_input_stream (string, bstart, bend); 486 instream = make_lisp_string_input_stream (string, bstart, bend);
488 istr = XLSTREAM (instream); 487 istr = XLSTREAM (instream);
489 /* setup the out stream */ 488 /* setup the out stream */
490 outstream = make_dynarr_output_stream((unsigned_char_dynarr *)conversion_out_dynarr); 489 outstream = make_dynarr_output_stream((unsigned_char_dynarr *)conversion_out_dynarr);
491 ostr = XLSTREAM (outstream); 490 ostr = XLSTREAM (outstream);
492 #ifdef MULE 491 #ifdef FILE_CODING
493 /* setup the conversion stream */ 492 /* setup the conversion stream */
494 conv_out_stream = make_encoding_output_stream (ostr, Fget_coding_system(Qbinary)); 493 conv_out_stream = make_encoding_output_stream (ostr, Fget_coding_system(Qbinary));
495 costr = XLSTREAM (conv_out_stream); 494 costr = XLSTREAM (conv_out_stream);
496 GCPRO3 (instream, outstream, conv_out_stream); 495 GCPRO3 (instream, outstream, conv_out_stream);
497 #else 496 #else
502 while (1) { 501 while (1) {
503 int size_in_bytes = Lstream_read (istr, tempbuf, sizeof (tempbuf)); 502 int size_in_bytes = Lstream_read (istr, tempbuf, sizeof (tempbuf));
504 if (!size_in_bytes) 503 if (!size_in_bytes)
505 break; 504 break;
506 /* It does seem the flushes are necessary... */ 505 /* It does seem the flushes are necessary... */
507 #ifdef MULE 506 #ifdef FILE_CODING
508 Lstream_write (costr, tempbuf, size_in_bytes); 507 Lstream_write (costr, tempbuf, size_in_bytes);
509 Lstream_flush (costr); 508 Lstream_flush (costr);
510 #else 509 #else
511 Lstream_write (ostr, tempbuf, size_in_bytes); 510 Lstream_write (ostr, tempbuf, size_in_bytes);
512 #endif 511 #endif
522 } 521 }
523 522
524 if (fclose (tmpfil) != 0) 523 if (fclose (tmpfil) != 0)
525 fubar = 1; 524 fubar = 1;
526 Lstream_close (istr); 525 Lstream_close (istr);
527 #ifdef MULE 526 #ifdef FILE_CODING
528 Lstream_close (costr); 527 Lstream_close (costr);
529 #endif 528 #endif
530 Lstream_close (ostr); 529 Lstream_close (ostr);
531 530
532 UNGCPRO; 531 UNGCPRO;
533 Lstream_delete (istr); 532 Lstream_delete (istr);
534 Lstream_delete (ostr); 533 Lstream_delete (ostr);
535 #ifdef MULE 534 #ifdef FILE_CODING
536 Lstream_delete (costr); 535 Lstream_delete (costr);
537 #endif 536 #endif
537
538 if (fubar) 538 if (fubar)
539 report_file_error ("Writing temp file", 539 report_file_error ("Writing temp file",
540 list1 (build_string (filename_out))); 540 list1 (build_string (filename_out)));
541 } 541 }
542 542