aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarl Heuer1997-02-20 06:51:43 +0000
committerKarl Heuer1997-02-20 06:51:43 +0000
commit6b768554054e8ab90d359bf6dd167813d3cb7fed (patch)
treeb4df78a7236f82c71a7a2ca311e5104c06537a12 /src
parenta98f1d1dbc78aa6b0003eea3e6fa21a9320203a3 (diff)
downloademacs-6b768554054e8ab90d359bf6dd167813d3cb7fed.tar.gz
emacs-6b768554054e8ab90d359bf6dd167813d3cb7fed.zip
(CHARACTERBITS, GLYPH_MASK_REV_DIR): New macros.
(GLYPH_MASK_PADDING, GLYPH_MASK_FACE, GLYPH_MASK_CHAR): New macros. [HAVE_FACES] (FAST_MAKE_GLYPH, FAST_GLYPH_CHAR, FAST_GLYPH_FACE): Use CHARACTERBITS. [!HAVE_FACES] (FAST_MAKE_GLYPH, FAST_GLYPH_CHAR, FAST_GLYPH_FACE): New macros. [!HAVE_FACES] (GLYPH_CHAR, GLYPH_FACE): Mask appropriate bits. (Fcoding_system_p, Fcheck_coding_system): Declare external. (Fread_coding_system, Fread_non_nil_coding_system): Likewise.
Diffstat (limited to 'src')
-rw-r--r--src/lisp.h47
1 files changed, 35 insertions, 12 deletions
diff --git a/src/lisp.h b/src/lisp.h
index e6a7e6ed04f..399053fc156 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -833,6 +833,10 @@ typedef unsigned char UCHAR;
833#define CHAR_CTL (0x4000000) 833#define CHAR_CTL (0x4000000)
834#define CHAR_META (0x8000000) 834#define CHAR_META (0x8000000)
835 835
836/* Actually, the current Emacs uses 19 bits for the character value
837 itself. */
838#define CHARACTERBITS 19
839
836#ifdef USE_X_TOOLKIT 840#ifdef USE_X_TOOLKIT
837#ifdef NO_UNION_TYPE 841#ifdef NO_UNION_TYPE
838/* Use this for turning a (void *) into a Lisp_Object, as when the 842/* Use this for turning a (void *) into a Lisp_Object, as when the
@@ -864,26 +868,38 @@ typedef unsigned char UCHAR;
864 868
865/* The glyph datatype, used to represent characters on the display. */ 869/* The glyph datatype, used to represent characters on the display. */
866 870
867/* The low eight bits are the character code, and the bits above them 871/* The low 19 bits (CHARACTERBITS) are the character code, and the
868 are the numeric face ID. If FID is the face ID of a glyph on a 872 bits above them except for the topmost two bits are the numeric
869 frame F, then F->display.x->faces[FID] contains the description of 873 face ID. If FID is the face ID of a glyph on a frame F, then
870 that face. This is an int instead of a short, so we can support a 874 F->display.x->faces[FID] contains the description of that face.
871 good bunch of face ID's; given that we have no mechanism for 875 This is an int instead of a short, so we can support a good bunch
872 tossing unused frame face ID's yet, we'll probably run out of 255 876 of face ID's (i.e. 2^(32 - 19 - 2) = 2048 ID's) ; given that we
873 pretty quickly. */ 877 have no mechanism for tossing unused frame face ID's yet, we'll
878 probably run out of 255 pretty quickly. */
874#define GLYPH unsigned int 879#define GLYPH unsigned int
875 880
881/* Mask bit for a glyph of a character which should be written from
882 right to left. */
883#define GLYPH_MASK_REV_DIR 0x80000000
884/* Mask bit for a padding glyph of a multi-column character. */
885#define GLYPH_MASK_PADDING 0x40000000
886/* Mask bits for face. */
887#define GLYPH_MASK_FACE 0x3FF80000
888/* Mask bits for character code. */
889#define GLYPH_MASK_CHAR 0x0007FFFF /* The lowest 19 bits */
890
876#ifdef HAVE_FACES 891#ifdef HAVE_FACES
877/* The FAST macros assume that we already know we're in an X window. */ 892/* The FAST macros assume that we already know we're in an X window. */
878 893
879/* Given a character code and a face ID, return the appropriate glyph. */ 894/* Given a character code and a face ID, return the appropriate glyph. */
880#define FAST_MAKE_GLYPH(CHAR, FACE) ((unsigned char) (CHAR) | ((FACE) << 8)) 895#define FAST_MAKE_GLYPH(CHAR, FACE) ((unsigned char) (CHAR) | \
896 ((FACE) << CHARACTERBITS))
881 897
882/* Return a glyph's character code. */ 898/* Return a glyph's character code. */
883#define FAST_GLYPH_CHAR(glyph) ((glyph) & 0xff) 899#define FAST_GLYPH_CHAR(glyph) ((glyph) & GLYPH_MASK_CHAR)
884 900
885/* Return a glyph's face ID. */ 901/* Return a glyph's face ID. */
886#define FAST_GLYPH_FACE(glyph) (((glyph) >> 8) & ((1 << 24) - 1)) 902#define FAST_GLYPH_FACE(glyph) (((glyph) & GLYPH_MASK_FACE) >> CHARACTERBITS)
887 903
888/* Slower versions that test the frame type first. */ 904/* Slower versions that test the frame type first. */
889#define MAKE_GLYPH(f, char, face) (FRAME_TERMCAP_P (f) ? (char) \ 905#define MAKE_GLYPH(f, char, face) (FRAME_TERMCAP_P (f) ? (char) \
@@ -892,8 +908,11 @@ typedef unsigned char UCHAR;
892#define GLYPH_FACE(f, g) (FRAME_TERMCAP_P (f) ? (0) : FAST_GLYPH_FACE (g)) 908#define GLYPH_FACE(f, g) (FRAME_TERMCAP_P (f) ? (0) : FAST_GLYPH_FACE (g))
893#else /* not HAVE_FACES */ 909#else /* not HAVE_FACES */
894#define MAKE_GLYPH(f, char, face) (char) 910#define MAKE_GLYPH(f, char, face) (char)
895#define GLYPH_CHAR(f, g) (g) 911#define FAST_MAKE_GLYPH(char, face) (char)
896#define GLYPH_FACE(f, g) (g) 912#define GLYPH_CHAR(f, g) ((g) & GLYPH_MASK_CHAR)
913#define FAST_GLYPH_CHAR(g) ((g) & GLYPH_MASK_CHAR)
914#define GLYPH_FACE(f, g) ((g) & GLYPH_MASK_FACE)
915#define FAST_GLYPH_FACE(g) ((g) & GLYPH_MASK_FACE)
897#endif /* not HAVE_FACES */ 916#endif /* not HAVE_FACES */
898 917
899/* The ID of the mode line highlighting face. */ 918/* The ID of the mode line highlighting face. */
@@ -1430,6 +1449,10 @@ extern Lisp_Object Ffloat ();
1430/* Defined in cmds.c */ 1449/* Defined in cmds.c */
1431extern Lisp_Object Fend_of_line (), Fforward_char (), Fforward_line (); 1450extern Lisp_Object Fend_of_line (), Fforward_char (), Fforward_line ();
1432 1451
1452/* Defined in coding.c */
1453extern Lisp_Object Fcoding_system_p (), Fcheck_coding_system ();
1454extern Lisp_Object Fread_coding_system (), Fread_non_nil_coding_system ();
1455
1433/* Defined in syntax.c */ 1456/* Defined in syntax.c */
1434extern Lisp_Object Fforward_word (); 1457extern Lisp_Object Fforward_word ();
1435 1458