Mercurial > emacs
comparison src/coding.h @ 26846:1a0f5960e65e
(emacs_code_class_type): Delete the member
EMACS_leading_code_composition.
(COMPOSING_NO) (COMPOSING_WITH_RULE_HEAD) (COMPOSING_NO_RULE_HEAD)
(COMPOSING_WITH_RULE_TAIL) (COMPOSING_NO_RULE_TAIL)
(COMPOSING_WITH_RULE_RULE) (COMPOSING_HEAD_P)
(COMPOSING_WITH_RULE_P): Macros deleted.
(COMPOSITION_DATA_SIZE) (COMPOSITION_DATA_MAX_BUNCH_LENGTH): New
macros.
(struct composition_data): New structure.
(CODING_FINISH_INSUFFICIENT_CMP): New macro.
(struct coding_system): New members composition_rule_follows,
cmp_data, cmp_data_start, cmp_data_index.
(coding_save_composition) (coding_free_composition_data)
(coding_adjust_composition_offset): Extern them.
| author | Kenichi Handa <handa@m17n.org> |
|---|---|
| date | Wed, 15 Dec 1999 00:05:57 +0000 |
| parents | b7aa6ac26872 |
| children | e34a172ee77e |
comparison
equal
deleted
inserted
replaced
| 26845:5c3e047bbf23 | 26846:1a0f5960e65e |
|---|---|
| 38 EMACS_linefeed_code, /* 0x0A (linefeed) to denote | 38 EMACS_linefeed_code, /* 0x0A (linefeed) to denote |
| 39 end-of-line. */ | 39 end-of-line. */ |
| 40 EMACS_carriage_return_code, /* 0x0D (carriage-return) to be used | 40 EMACS_carriage_return_code, /* 0x0D (carriage-return) to be used |
| 41 in selective display mode. */ | 41 in selective display mode. */ |
| 42 EMACS_ascii_code, /* ASCII characters. */ | 42 EMACS_ascii_code, /* ASCII characters. */ |
| 43 EMACS_leading_code_composition, /* Leading code of a composite | |
| 44 character. */ | |
| 45 EMACS_leading_code_2, /* Base leading code of official | 43 EMACS_leading_code_2, /* Base leading code of official |
| 46 TYPE9N character. */ | 44 TYPE9N character. */ |
| 47 EMACS_leading_code_3, /* Base leading code of private TYPE9N | 45 EMACS_leading_code_3, /* Base leading code of private TYPE9N |
| 48 or official TYPE9Nx9N character. */ | 46 or official TYPE9Nx9N character. */ |
| 49 EMACS_leading_code_4, /* Base leading code of private | 47 EMACS_leading_code_4, /* Base leading code of private |
| 258 eol-type is not yet decided. */ | 256 eol-type is not yet decided. */ |
| 259 #define CODING_EOL_INCONSISTENT 4 /* This value is used to denote the | 257 #define CODING_EOL_INCONSISTENT 4 /* This value is used to denote the |
| 260 eol-type is not consistent | 258 eol-type is not consistent |
| 261 through the file. */ | 259 through the file. */ |
| 262 | 260 |
| 263 /* Character composition status while encoding/decoding. */ | |
| 264 #define COMPOSING_NO 0 /* not composing */ | |
| 265 #define COMPOSING_WITH_RULE_HEAD 1 /* 1st char of with-rule composing follow */ | |
| 266 #define COMPOSING_NO_RULE_HEAD 2 /* 1st char of no-rule composing follow */ | |
| 267 #define COMPOSING_WITH_RULE_TAIL 3 /* Nth char of with-rule composing follow */ | |
| 268 #define COMPOSING_NO_RULE_TAIL 4 /* Nth char of no-rule composing follow */ | |
| 269 #define COMPOSING_WITH_RULE_RULE 5 /* composition rule follow */ | |
| 270 | |
| 271 /* 1 iff composing. */ | 261 /* 1 iff composing. */ |
| 272 #define COMPOSING_P(composing) (composing) | 262 #define COMPOSING_P(coding) ((int) coding->composing > (int) COMPOSITION_NO) |
| 273 /* 1 iff 1st char of composing element follows. */ | 263 |
| 274 #define COMPOSING_HEAD_P(composing) \ | 264 #define COMPOSITION_DATA_SIZE 4080 |
| 275 ((composing) && (composing) <= COMPOSING_NO_RULE_HEAD) | 265 #define COMPOSITION_DATA_MAX_BUNCH_LENGTH (4 + MAX_COMPOSITION_COMPONENTS*2) |
| 276 /* 1 iff composing with embeded composition rule. */ | 266 |
| 277 #define COMPOSING_WITH_RULE_P(composing) ((composing) & 1) | 267 /* Data structure to hold information about compositions of text that |
| 268 is being decoded or encode. ISO 2022 base code conversion routines | |
| 269 handle special ESC sequences for composition specification. But, | |
| 270 they can't get/put such information directly from/to a buffer in | |
| 271 the deepest place. So, they store or retrieve the information | |
| 272 through this structure. | |
| 273 | |
| 274 The encoder stores the information in this structure when it meets | |
| 275 ESC sequences for composition while encoding codes, then, after all | |
| 276 text codes are encoded, puts `composition' properties on the text | |
| 277 by refering the structure. | |
| 278 | |
| 279 The decoder at first stores the information of a text to be | |
| 280 decoded, then, while decoding codes, generates ESC sequences for | |
| 281 composition at proper places by refering the structure. */ | |
| 282 | |
| 283 struct composition_data | |
| 284 { | |
| 285 /* The character position of the first character to be encoded or | |
| 286 decoded. START and END (see below) are relative to this | |
| 287 position. */ | |
| 288 int char_offset; | |
| 289 | |
| 290 /* The composition data. These elements are repeated for each | |
| 291 composition: | |
| 292 LENGTH START END METHOD [ COMPONENT ... ] | |
| 293 where, | |
| 294 LENGTH is the number of elements for this composition. | |
| 295 | |
| 296 START and END are starting and ending character positions of | |
| 297 the composition relative to `char_offset'. | |
| 298 | |
| 299 METHOD is one of `enum cmposing_status' specifying the way of | |
| 300 composition. | |
| 301 | |
| 302 COMPONENT is a character or an encoded composition rule. */ | |
| 303 int data[COMPOSITION_DATA_SIZE]; | |
| 304 | |
| 305 /* The number of elements in `data' currently used. */ | |
| 306 int used; | |
| 307 | |
| 308 /* Pointers to the previous and next structures. When `data' is | |
| 309 filled up, another structure is allocated and linked in `next'. | |
| 310 The new struture has backward link to this struture in `prev'. | |
| 311 The number of chaind structures depends on how many compositions | |
| 312 the text being encoded or decoded contains. */ | |
| 313 struct composition_data *prev, *next; | |
| 314 }; | |
| 278 | 315 |
| 279 /* Macros used for the member finish_status of the struct | 316 /* Macros used for the member finish_status of the struct |
| 280 coding_system. */ | 317 coding_system. */ |
| 281 #define CODING_FINISH_NORMAL 0 | 318 #define CODING_FINISH_NORMAL 0 |
| 282 #define CODING_FINISH_INSUFFICIENT_SRC 1 | 319 #define CODING_FINISH_INSUFFICIENT_SRC 1 |
| 283 #define CODING_FINISH_INSUFFICIENT_DST 2 | 320 #define CODING_FINISH_INSUFFICIENT_DST 2 |
| 284 #define CODING_FINISH_INCONSISTENT_EOL 3 | 321 #define CODING_FINISH_INCONSISTENT_EOL 3 |
| 285 #define CODING_FINISH_INTERRUPT 4 | 322 #define CODING_FINISH_INSUFFICIENT_CMP 4 |
| 323 #define CODING_FINISH_INTERRUPT 5 | |
| 286 | 324 |
| 287 /* Macros used for the member `mode' of the struct coding_system. */ | 325 /* Macros used for the member `mode' of the struct coding_system. */ |
| 288 | 326 |
| 289 /* If set, recover the original CR or LF of the already decoded text | 327 /* If set, recover the original CR or LF of the already decoded text |
| 290 when the decoding routine encounters an inconsistent eol format. */ | 328 when the decoding routine encounters an inconsistent eol format. */ |
| 327 element is 0, the charset of ID N is not a safe character set. | 365 element is 0, the charset of ID N is not a safe character set. |
| 328 Such a character set is not encoded when CODING_ISO_FLAG_SAFE is | 366 Such a character set is not encoded when CODING_ISO_FLAG_SAFE is |
| 329 set. */ | 367 set. */ |
| 330 unsigned char safe_charsets[MAX_CHARSET + 1]; | 368 unsigned char safe_charsets[MAX_CHARSET + 1]; |
| 331 | 369 |
| 332 /* Non-zero means that characters are being composed currently while | 370 /* The current status of composition handling. */ |
| 333 decoding or encoding. See macros COMPOSING_XXXX above for the | |
| 334 meaing of each non-zero value. */ | |
| 335 int composing; | 371 int composing; |
| 336 | 372 |
| 337 /* Number of composed characters in the current composing sequence. */ | 373 /* 1 iff the next character is a composition rule. */ |
| 338 int composed_chars; | 374 int composition_rule_follows; |
| 375 | |
| 376 /* Information of compositions are stored here on decoding and set | |
| 377 in advance on encoding. */ | |
| 378 struct composition_data *cmp_data; | |
| 379 | |
| 380 /* Index to cmp_data->data for the first element for the current | |
| 381 composition. */ | |
| 382 int cmp_data_start; | |
| 383 | |
| 384 /* Index to cmp_data->data for the current element for the current | |
| 385 composition. */ | |
| 386 int cmp_data_index; | |
| 339 | 387 |
| 340 /* Detailed information specific to each type of coding system. */ | 388 /* Detailed information specific to each type of coding system. */ |
| 341 union spec | 389 union spec |
| 342 { | 390 { |
| 343 struct iso2022_spec iso2022; | 391 struct iso2022_spec iso2022; |
| 520 /* Extern declarations. */ | 568 /* Extern declarations. */ |
| 521 extern int decode_coding P_ ((struct coding_system *, unsigned char *, | 569 extern int decode_coding P_ ((struct coding_system *, unsigned char *, |
| 522 unsigned char *, int, int)); | 570 unsigned char *, int, int)); |
| 523 extern int encode_coding P_ ((struct coding_system *, unsigned char *, | 571 extern int encode_coding P_ ((struct coding_system *, unsigned char *, |
| 524 unsigned char *, int, int)); | 572 unsigned char *, int, int)); |
| 573 extern void coding_save_composition P_ ((struct coding_system *, int, int, | |
| 574 Lisp_Object)); | |
| 575 extern void coding_free_composition_data P_ ((struct coding_system *)); | |
| 576 extern void coding_adjust_composition_offset P_ ((struct coding_system *, | |
| 577 int)); | |
| 525 extern int code_convert_region P_ ((int, int, int, int, struct coding_system *, | 578 extern int code_convert_region P_ ((int, int, int, int, struct coding_system *, |
| 526 int, int)); | 579 int, int)); |
| 527 extern int decoding_buffer_size P_ ((struct coding_system *, int)); | 580 extern int decoding_buffer_size P_ ((struct coding_system *, int)); |
| 528 extern int encoding_buffer_size P_ ((struct coding_system *, int)); | 581 extern int encoding_buffer_size P_ ((struct coding_system *, int)); |
| 529 extern void detect_coding P_ ((struct coding_system *, unsigned char *, int)); | 582 extern void detect_coding P_ ((struct coding_system *, unsigned char *, int)); |
