diff options
| author | Kenichi Handa | 1999-12-15 00:05:57 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1999-12-15 00:05:57 +0000 |
| commit | 279d9f7b8d033be6b1b5bd3ef6d776513d66db12 (patch) | |
| tree | 52d4eab7c88ef87eb513a1513f1359bd661d444a /src/coding.h | |
| parent | e55d9cfd36f5cb983159968cd059626f82616a05 (diff) | |
| download | emacs-279d9f7b8d033be6b1b5bd3ef6d776513d66db12.tar.gz emacs-279d9f7b8d033be6b1b5bd3ef6d776513d66db12.zip | |
(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.
Diffstat (limited to 'src/coding.h')
| -rw-r--r-- | src/coding.h | 97 |
1 files changed, 75 insertions, 22 deletions
diff --git a/src/coding.h b/src/coding.h index 5ef9f2a08ca..055131942db 100644 --- a/src/coding.h +++ b/src/coding.h | |||
| @@ -40,8 +40,6 @@ enum emacs_code_class_type | |||
| 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 |
| @@ -260,21 +258,60 @@ enum coding_type | |||
| 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. */ |
| @@ -282,7 +319,8 @@ enum coding_type | |||
| 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 | ||
| @@ -329,13 +367,23 @@ struct coding_system | |||
| 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 |
| @@ -522,6 +570,11 @@ 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)); |