comparison src/coding.h @ 88155:d7ddb3e565de

sync with trunk
author Henrik Enberg <henrik.enberg@telia.com>
date Mon, 16 Jan 2006 00:03:54 +0000
parents e79464fe61d7
children
comparison
equal deleted inserted replaced
88154:8ce476d3ba36 88155:d7ddb3e565de
1 /* Header for coding system handler. 1 /* Header for coding system handler.
2 Copyright (C) 1995, 1997 Electrotechnical Laboratory, JAPAN. 2 Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
3 Licensed to the Free Software Foundation. 3 Copyright (C) 1995, 1997, 1998, 2000
4 National Institute of Advanced Industrial Science and Technology (AIST)
5 Registration Number H14PRO021
4 6
5 This file is part of GNU Emacs. 7 This file is part of GNU Emacs.
6 8
7 GNU Emacs is free software; you can redistribute it and/or modify 9 GNU Emacs is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 17 GNU General Public License for more details.
16 18
17 You should have received a copy of the GNU General Public License 19 You should have received a copy of the GNU General Public License
18 along with GNU Emacs; see the file COPYING. If not, write to 20 along with GNU Emacs; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02111-1307, USA. */ 22 Boston, MA 02110-1301, USA. */
21 23
22 #ifndef EMACS_CODING_H 24 #ifndef EMACS_CODING_H
23 #define EMACS_CODING_H 25 #define EMACS_CODING_H
24 26
25 #include "ccl.h" 27 #include "ccl.h"
142 144
143 /* If set, use designation escape sequence. */ 145 /* If set, use designation escape sequence. */
144 #define CODING_FLAG_ISO_DESIGNATION 0x10000 146 #define CODING_FLAG_ISO_DESIGNATION 0x10000
145 147
146 /* A character to be produced on output if encoding of the original 148 /* A character to be produced on output if encoding of the original
147 character is prohibited by CODING_FLAG_ISO_SAFE. */ 149 character is inhibitted by CODING_MODE_INHIBIT_UNENCODABLE_CHAR.
148 #define CODING_INHIBIT_CHARACTER_SUBSTITUTION 077 /* 077 == `?' */ 150 It must be an ASCII character. */
151 #define CODING_REPLACEMENT_CHARACTER '?'
149 152
150 /* Structure of the field `spec.iso2022' in the structure `coding_system'. */ 153 /* Structure of the field `spec.iso2022' in the structure `coding_system'. */
151 struct iso2022_spec 154 struct iso2022_spec
152 { 155 {
153 /* The current graphic register invoked to each graphic plane. */ 156 /* The current graphic register invoked to each graphic plane. */
335 338
336 /* If set, it means that the current source text is in a buffer which 339 /* If set, it means that the current source text is in a buffer which
337 enables selective display. */ 340 enables selective display. */
338 #define CODING_MODE_SELECTIVE_DISPLAY 0x04 341 #define CODING_MODE_SELECTIVE_DISPLAY 0x04
339 342
343 /* If set, replace unencodabae characters by `?' on encoding. */
344 #define CODING_MODE_INHIBIT_UNENCODABLE_CHAR 0x08
345
340 /* This flag is used by the decoding/encoding routines on the fly. If 346 /* This flag is used by the decoding/encoding routines on the fly. If
341 set, it means that right-to-left text is being processed. */ 347 set, it means that right-to-left text is being processed. */
342 #define CODING_MODE_DIRECTION 0x08 348 #define CODING_MODE_DIRECTION 0x10
343 349
344 struct coding_system 350 struct coding_system
345 { 351 {
346 /* Type of the coding system. */ 352 /* Type of the coding system. */
347 enum coding_type type; 353 enum coding_type type;
566 572
567 /* Encode the file name NAME using the specified coding system 573 /* Encode the file name NAME using the specified coding system
568 for file names, if any. */ 574 for file names, if any. */
569 #define ENCODE_FILE(name) \ 575 #define ENCODE_FILE(name) \
570 (! NILP (Vfile_name_coding_system) \ 576 (! NILP (Vfile_name_coding_system) \
571 && XFASTINT (Vfile_name_coding_system) != 0 \ 577 && !EQ (Vfile_name_coding_system, make_number (0)) \
572 ? code_convert_string_norecord (name, Vfile_name_coding_system, 1) \ 578 ? code_convert_string_norecord (name, Vfile_name_coding_system, 1) \
573 : (! NILP (Vdefault_file_name_coding_system) \ 579 : (! NILP (Vdefault_file_name_coding_system) \
574 && XFASTINT (Vdefault_file_name_coding_system) != 0 \ 580 && !EQ (Vdefault_file_name_coding_system, make_number (0)) \
575 ? code_convert_string_norecord (name, Vdefault_file_name_coding_system, 1) \ 581 ? code_convert_string_norecord (name, Vdefault_file_name_coding_system, 1) \
576 : name)) 582 : name))
577 583
578 /* Decode the file name NAME using the specified coding system 584 /* Decode the file name NAME using the specified coding system
579 for file names, if any. */ 585 for file names, if any. */
580 #define DECODE_FILE(name) \ 586 #define DECODE_FILE(name) \
581 (! NILP (Vfile_name_coding_system) \ 587 (! NILP (Vfile_name_coding_system) \
582 && XFASTINT (Vfile_name_coding_system) != 0 \ 588 && !EQ (Vfile_name_coding_system, make_number (0)) \
583 ? code_convert_string_norecord (name, Vfile_name_coding_system, 0) \ 589 ? code_convert_string_norecord (name, Vfile_name_coding_system, 0) \
584 : (! NILP (Vdefault_file_name_coding_system) \ 590 : (! NILP (Vdefault_file_name_coding_system) \
585 && XFASTINT (Vdefault_file_name_coding_system) != 0 \ 591 && !EQ (Vdefault_file_name_coding_system, make_number (0)) \
586 ? code_convert_string_norecord (name, Vdefault_file_name_coding_system, 0) \ 592 ? code_convert_string_norecord (name, Vdefault_file_name_coding_system, 0) \
587 : name)) 593 : name))
588 594
589 #ifdef WINDOWSNT
590 /* Encode the string STR using the specified coding system 595 /* Encode the string STR using the specified coding system
591 for w32 system functions, if any. */ 596 for system functions, if any. */
592 #define ENCODE_SYSTEM(str) \ 597 #define ENCODE_SYSTEM(str) \
593 (! NILP (Vlocale_coding_system) \ 598 (! NILP (Vlocale_coding_system) \
594 && XFASTINT (Vlocale_coding_system) != 0 \ 599 && !EQ (Vlocale_coding_system, make_number (0)) \
595 ? code_convert_string_norecord (str, Vlocale_coding_system, 1) \ 600 ? code_convert_string_norecord (str, Vlocale_coding_system, 1) \
596 : str) 601 : str)
597 602
598 /* Decode the string STR using the specified coding system 603 /* Decode the string STR using the specified coding system
599 for w32 system functions, if any. */ 604 for system functions, if any. */
600 #define DECODE_SYSTEM(name) \ 605 #define DECODE_SYSTEM(str) \
601 (! NILP (Vlocale_coding_system) \ 606 (! NILP (Vlocale_coding_system) \
602 && XFASTINT (Vlocale_coding_system) != 0 \ 607 && !EQ (Vlocale_coding_system, make_number (0)) \
603 ? code_convert_string_norecord (str, Vlocale_coding_system, 0) \ 608 ? code_convert_string_norecord (str, Vlocale_coding_system, 0) \
604 : str) 609 : str)
605 610
606 #else /* WINDOWSNT */ 611 #define ENCODE_UTF_8(str) code_convert_string_norecord (str, Qutf_8, 1)
607
608 #define ENCODE_SYSTEM(str) string_make_unibyte(str)
609 #define DECODE_SYSTEM(name) name
610
611 #endif /* !WINDOWSNT */
612 612
613 /* Extern declarations. */ 613 /* Extern declarations. */
614 extern int decode_coding P_ ((struct coding_system *, const unsigned char *, 614 extern int decode_coding P_ ((struct coding_system *, const unsigned char *,
615 unsigned char *, int, int)); 615 unsigned char *, int, int));
616 extern int encode_coding P_ ((struct coding_system *, const unsigned char *, 616 extern int encode_coding P_ ((struct coding_system *, const unsigned char *,
627 extern int code_convert_region P_ ((int, int, int, int, struct coding_system *, 627 extern int code_convert_region P_ ((int, int, int, int, struct coding_system *,
628 int, int)); 628 int, int));
629 extern Lisp_Object run_pre_post_conversion_on_str P_ ((Lisp_Object, 629 extern Lisp_Object run_pre_post_conversion_on_str P_ ((Lisp_Object,
630 struct coding_system *, 630 struct coding_system *,
631 int)); 631 int));
632 extern void run_pre_write_conversin_on_c_str P_ ((unsigned char **, int *,
633 int, int,
634 struct coding_system *));
635
632 extern int decoding_buffer_size P_ ((struct coding_system *, int)); 636 extern int decoding_buffer_size P_ ((struct coding_system *, int));
633 extern int encoding_buffer_size P_ ((struct coding_system *, int)); 637 extern int encoding_buffer_size P_ ((struct coding_system *, int));
634 extern void detect_coding P_ ((struct coding_system *, const unsigned char *, 638 extern void detect_coding P_ ((struct coding_system *, const unsigned char *,
635 int)); 639 int));
636 extern void detect_eol P_ ((struct coding_system *, const unsigned char *, 640 extern void detect_eol P_ ((struct coding_system *, const unsigned char *,
649 struct coding_system *, int)); 653 struct coding_system *, int));
650 extern Lisp_Object Qcoding_system, Qeol_type, Qcoding_category_index; 654 extern Lisp_Object Qcoding_system, Qeol_type, Qcoding_category_index;
651 extern Lisp_Object Qraw_text, Qemacs_mule; 655 extern Lisp_Object Qraw_text, Qemacs_mule;
652 extern Lisp_Object Qbuffer_file_coding_system; 656 extern Lisp_Object Qbuffer_file_coding_system;
653 extern Lisp_Object Vcoding_category_list; 657 extern Lisp_Object Vcoding_category_list;
658 extern Lisp_Object Qutf_8;
654 659
655 extern Lisp_Object Qtranslation_table; 660 extern Lisp_Object Qtranslation_table;
656 extern Lisp_Object Qtranslation_table_id; 661 extern Lisp_Object Qtranslation_table_id;
657 662
658 /* Mnemonic strings to indicate each type of end-of-line. */ 663 /* Mnemonic strings to indicate each type of end-of-line. */
660 /* Mnemonic string to indicate type of end-of-line is not yet decided. */ 665 /* Mnemonic string to indicate type of end-of-line is not yet decided. */
661 extern Lisp_Object eol_mnemonic_undecided; 666 extern Lisp_Object eol_mnemonic_undecided;
662 667
663 #ifdef emacs 668 #ifdef emacs
664 extern Lisp_Object Qfile_coding_system; 669 extern Lisp_Object Qfile_coding_system;
665 extern Lisp_Object Qcall_process, Qcall_process_region, Qprocess_argument; 670 extern Lisp_Object Qcall_process, Qcall_process_region;
666 extern Lisp_Object Qstart_process, Qopen_network_stream; 671 extern Lisp_Object Qstart_process, Qopen_network_stream;
667 extern Lisp_Object Qwrite_region; 672 extern Lisp_Object Qwrite_region;
668 673
669 extern char *emacs_strerror P_ ((int)); 674 extern char *emacs_strerror P_ ((int));
670 675
720 725
721 /* Error signaled when there's a problem with detecting coding system */ 726 /* Error signaled when there's a problem with detecting coding system */
722 extern Lisp_Object Qcoding_system_error; 727 extern Lisp_Object Qcoding_system_error;
723 728
724 #endif /* EMACS_CODING_H */ 729 #endif /* EMACS_CODING_H */
730
731 /* arch-tag: 2bc3b4fa-6870-4f64-8135-b962b2d290e4
732 (do not change this comment) */