comparison src/mule-charset.c @ 3025:facf3239ba30

[xemacs-hg @ 2005-10-25 11:16:19 by ben] rename new->new_, convert 'foo to `foo' EmacsFrame.c, ExternalClient.c, ExternalShell.c, chartab.c, cmdloop.c, compiler.h, console.c, database.c, device-msw.c, device-x.c, device.c, doc.c, dragdrop.c, eval.c, event-msw.c, event-stream.c, events.c, extents.c, file-coding.c, fns.c, frame-tty.c, frame.c, gpmevent.c, gutter.c, hash.c, imgproc.c, indent.c, keymap.c, lisp-union.h, macros.c, malloc.c, marker.c, menubar-x.c, menubar.c, mule-charset.c, number.c, process.c, profile.h, ralloc.c, redisplay.c, select-common.h, select.c, syntax.c, sysfile.h, sysproc.h, systime.h, syswindows.h, toolbar.c, tooltalk.c, tparam.c, unexaix.c, unexalpha.c, unexconvex.c, unexec.c, unexhp9k800.c, unexmips.c, unicode.c, window.c: new -> new_. 'foo -> `foo'. lwlib-internal.h: redo assert macros to follow lisp.h and not trigger warnings. lwlib.c, xlwtabs.c: new -> new_.
author ben
date Tue, 25 Oct 2005 11:16:49 +0000
parents b7f26b2f78bd
children d1754e7f0cea 3742ea8250b5
comparison
equal deleted inserted replaced
3024:b7f26b2f78bd 3025:facf3239ba30
1 /* Functions to handle multilingual characters. 1 /* Functions to handle multilingual characters.
2 Copyright (C) 1992, 1995 Free Software Foundation, Inc. 2 Copyright (C) 1992, 1995 Free Software Foundation, Inc.
3 Copyright (C) 1995 Sun Microsystems, Inc. 3 Copyright (C) 1995 Sun Microsystems, Inc.
4 Copyright (C) 2001, 2002, 2004 Ben Wing. 4 Copyright (C) 2001, 2002, 2004, 2005 Ben Wing.
5 5
6 This file is part of XEmacs. 6 This file is part of XEmacs.
7 7
8 XEmacs is free software; you can redistribute it and/or modify it 8 XEmacs is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the 9 under the terms of the GNU General Public License as published by the
414 NAME is a symbol, the name by which the character set is normally referred. 414 NAME is a symbol, the name by which the character set is normally referred.
415 DOC-STRING is a string describing the character set. 415 DOC-STRING is a string describing the character set.
416 PROPS is a property list, describing the specific nature of the 416 PROPS is a property list, describing the specific nature of the
417 character set. Recognized properties are: 417 character set. Recognized properties are:
418 418
419 'short-name Short version of the charset name (ex: Latin-1) 419 `short-name' Short version of the charset name (ex: Latin-1)
420 'long-name Long version of the charset name (ex: ISO8859-1 (Latin-1)) 420 `long-name' Long version of the charset name (ex: ISO8859-1 (Latin-1))
421 'registry A regular expression matching the font registry field for 421 `registry' A regular expression matching the font registry field for
422 this character set. 422 this character set.
423 'dimension Number of octets used to index a character in this charset. 423 `dimension' Number of octets used to index a character in this charset.
424 Either 1 or 2. Defaults to 1. 424 Either 1 or 2. Defaults to 1.
425 'columns Number of columns used to display a character in this charset. 425 `columns' Number of columns used to display a character in this charset.
426 Only used in TTY mode. (Under X, the actual width of a 426 Only used in TTY mode. (Under X, the actual width of a
427 character can be derived from the font used to display the 427 character can be derived from the font used to display the
428 characters.) If unspecified, defaults to the dimension 428 characters.) If unspecified, defaults to the dimension
429 (this is almost always the correct value). 429 (this is almost always the correct value).
430 'chars Number of characters in each dimension (94 or 96). 430 `chars' Number of characters in each dimension (94 or 96).
431 Defaults to 94. Note that if the dimension is 2, the 431 Defaults to 94. Note that if the dimension is 2, the
432 character set thus described is 94x94 or 96x96. 432 character set thus described is 94x94 or 96x96.
433 'final Final byte of ISO 2022 escape sequence. Must be 433 `final' Final byte of ISO 2022 escape sequence. Must be
434 supplied. Each combination of (DIMENSION, CHARS) defines a 434 supplied. Each combination of (DIMENSION, CHARS) defines a
435 separate namespace for final bytes. Note that ISO 435 separate namespace for final bytes. Note that ISO
436 2022 restricts the final byte to the range 436 2022 restricts the final byte to the range
437 0x30 - 0x7E if dimension == 1, and 0x30 - 0x5F if 437 0x30 - 0x7E if dimension == 1, and 0x30 - 0x5F if
438 dimension == 2. Note also that final bytes in the range 438 dimension == 2. Note also that final bytes in the range
439 0x30 - 0x3F are reserved for user-defined (not official) 439 0x30 - 0x3F are reserved for user-defined (not official)
440 character sets. 440 character sets.
441 'graphic 0 (use left half of font on output) or 1 (use right half 441 `graphic' 0 (use left half of font on output) or 1 (use right half
442 of font on output). Defaults to 0. For example, for 442 of font on output). Defaults to 0. For example, for
443 a font whose registry is ISO8859-1, the left half 443 a font whose registry is ISO8859-1, the left half
444 (octets 0x20 - 0x7F) is the `ascii' character set, while 444 (octets 0x20 - 0x7F) is the `ascii' character set, while
445 the right half (octets 0xA0 - 0xFF) is the `latin-1' 445 the right half (octets 0xA0 - 0xFF) is the `latin-1'
446 character set. With 'graphic set to 0, the octets 446 character set. With `graphic' set to 0, the octets
447 will have their high bit cleared; with it set to 1, 447 will have their high bit cleared; with it set to 1,
448 the octets will have their high bit set. 448 the octets will have their high bit set.
449 'direction 'l2r (left-to-right) or 'r2l (right-to-left). 449 `direction' `l2r' (left-to-right) or `r2l' (right-to-left).
450 Defaults to 'l2r. 450 Defaults to `l2r'.
451 'ccl-program A compiled CCL program used to convert a character in 451 `ccl-program' A compiled CCL program used to convert a character in
452 this charset into an index into the font. This is in 452 this charset into an index into the font. This is in
453 addition to the 'graphic property. The CCL program 453 addition to the `graphic' property. The CCL program
454 is passed the octets of the character, with the high 454 is passed the octets of the character, with the high
455 bit cleared and set depending upon whether the value 455 bit cleared and set depending upon whether the value
456 of the 'graphic property is 0 or 1. 456 of the `graphic' property is 0 or 1.
457 */ 457 */
458 (name, doc_string, props)) 458 (name, doc_string, props))
459 { 459 {
460 int id, dimension = 1, chars = 94, graphic = 0, columns = -1; 460 int id, dimension = 1, chars = 94, graphic = 0, columns = -1;
461 Ibyte final = 0; 461 Ibyte final = 0;
501 else if (EQ (keyword, Qdimension)) 501 else if (EQ (keyword, Qdimension))
502 { 502 {
503 CHECK_INT (value); 503 CHECK_INT (value);
504 dimension = XINT (value); 504 dimension = XINT (value);
505 if (dimension < 1 || dimension > 2) 505 if (dimension < 1 || dimension > 2)
506 invalid_constant ("Invalid value for 'dimension", value); 506 invalid_constant ("Invalid value for `dimension'", value);
507 } 507 }
508 508
509 else if (EQ (keyword, Qchars)) 509 else if (EQ (keyword, Qchars))
510 { 510 {
511 CHECK_INT (value); 511 CHECK_INT (value);
512 chars = XINT (value); 512 chars = XINT (value);
513 if (chars != 94 && chars != 96) 513 if (chars != 94 && chars != 96)
514 invalid_constant ("Invalid value for 'chars", value); 514 invalid_constant ("Invalid value for `chars'", value);
515 } 515 }
516 516
517 else if (EQ (keyword, Qcolumns)) 517 else if (EQ (keyword, Qcolumns))
518 { 518 {
519 CHECK_INT (value); 519 CHECK_INT (value);
520 columns = XINT (value); 520 columns = XINT (value);
521 if (columns != 1 && columns != 2) 521 if (columns != 1 && columns != 2)
522 invalid_constant ("Invalid value for 'columns", value); 522 invalid_constant ("Invalid value for `columns'", value);
523 } 523 }
524 524
525 else if (EQ (keyword, Qgraphic)) 525 else if (EQ (keyword, Qgraphic))
526 { 526 {
527 CHECK_INT (value); 527 CHECK_INT (value);
528 graphic = XINT (value); 528 graphic = XINT (value);
529 if (graphic < 0 || graphic > 1) 529 if (graphic < 0 || graphic > 1)
530 invalid_constant ("Invalid value for 'graphic", value); 530 invalid_constant ("Invalid value for `graphic'", value);
531 } 531 }
532 532
533 else if (EQ (keyword, Qregistry)) 533 else if (EQ (keyword, Qregistry))
534 { 534 {
535 CHECK_STRING (value); 535 CHECK_STRING (value);
541 if (EQ (value, Ql2r)) 541 if (EQ (value, Ql2r))
542 direction = CHARSET_LEFT_TO_RIGHT; 542 direction = CHARSET_LEFT_TO_RIGHT;
543 else if (EQ (value, Qr2l)) 543 else if (EQ (value, Qr2l))
544 direction = CHARSET_RIGHT_TO_LEFT; 544 direction = CHARSET_RIGHT_TO_LEFT;
545 else 545 else
546 invalid_constant ("Invalid value for 'direction", value); 546 invalid_constant ("Invalid value for `direction'", value);
547 } 547 }
548 548
549 else if (EQ (keyword, Qfinal)) 549 else if (EQ (keyword, Qfinal))
550 { 550 {
551 CHECK_CHAR_COERCE_INT (value); 551 CHECK_CHAR_COERCE_INT (value);
552 final = XCHAR (value); 552 final = XCHAR (value);
553 if (final < '0' || final > '~') 553 if (final < '0' || final > '~')
554 invalid_constant ("Invalid value for 'final", value); 554 invalid_constant ("Invalid value for `final'", value);
555 } 555 }
556 556
557 else if (EQ (keyword, Qccl_program)) 557 else if (EQ (keyword, Qccl_program))
558 { 558 {
559 struct ccl_program test_ccl; 559 struct ccl_program test_ccl;
560 560
561 if (setup_ccl_program (&test_ccl, value) < 0) 561 if (setup_ccl_program (&test_ccl, value) < 0)
562 invalid_argument ("Invalid value for 'ccl-program", value); 562 invalid_argument ("Invalid value for `ccl-program'", value);
563 ccl_program = value; 563 ccl_program = value;
564 } 564 }
565 else 565 else
566 invalid_constant ("Unrecognized property", keyword); 566 invalid_constant ("Unrecognized property", keyword);
567 } 567 }
568 } 568 }
569 569
570 if (!final) 570 if (!final)
571 invalid_argument ("'final must be specified", Qunbound); 571 invalid_argument ("`final' must be specified", Qunbound);
572 if (dimension == 2 && final > 0x5F) 572 if (dimension == 2 && final > 0x5F)
573 invalid_constant 573 invalid_constant
574 ("Final must be in the range 0x30 - 0x5F for dimension == 2", 574 ("Final must be in the range 0x30 - 0x5F for dimension == 2",
575 make_char (final)); 575 make_char (final));
576 576
785 } 785 }
786 786
787 DEFUN ("charset-property", Fcharset_property, 2, 2, 0, /* 787 DEFUN ("charset-property", Fcharset_property, 2, 2, 0, /*
788 Return property PROP of CHARSET, a charset object or symbol naming a charset. 788 Return property PROP of CHARSET, a charset object or symbol naming a charset.
789 Recognized properties are those listed in `make-charset', as well as 789 Recognized properties are those listed in `make-charset', as well as
790 'name and 'doc-string. 790 `name' and `doc-string'.
791 */ 791 */
792 (charset, prop)) 792 (charset, prop))
793 { 793 {
794 Lisp_Charset *cs; 794 Lisp_Charset *cs;
795 795
830 830
831 /* #### We need to figure out which properties we really want to 831 /* #### We need to figure out which properties we really want to
832 allow to be set. */ 832 allow to be set. */
833 833
834 DEFUN ("set-charset-ccl-program", Fset_charset_ccl_program, 2, 2, 0, /* 834 DEFUN ("set-charset-ccl-program", Fset_charset_ccl_program, 2, 2, 0, /*
835 Set the 'ccl-program property of CHARSET to CCL-PROGRAM. 835 Set the `ccl-program' property of CHARSET to CCL-PROGRAM.
836 */ 836 */
837 (charset, ccl_program)) 837 (charset, ccl_program))
838 { 838 {
839 struct ccl_program test_ccl; 839 struct ccl_program test_ccl;
840 840
846 return Qnil; 846 return Qnil;
847 } 847 }
848 848
849 /* Japanese folks may want to (set-charset-registry 'ascii "jisx0201") */ 849 /* Japanese folks may want to (set-charset-registry 'ascii "jisx0201") */
850 DEFUN ("set-charset-registry", Fset_charset_registry, 2, 2, 0, /* 850 DEFUN ("set-charset-registry", Fset_charset_registry, 2, 2, 0, /*
851 Set the 'registry property of CHARSET to REGISTRY. 851 Set the `registry' property of CHARSET to REGISTRY.
852 */ 852 */
853 (charset, registry)) 853 (charset, registry))
854 { 854 {
855 charset = Fget_charset (charset); 855 charset = Fget_charset (charset);
856 CHECK_STRING (registry); 856 CHECK_STRING (registry);