XEmacs 21.2.28 "Hermes".
[chise/xemacs-chise.git.1] / src / objects.h
1 /* Generic object functions.
2    Copyright (C) 1995 Board of Trustees, University of Illinois.
3    Copyright (C) 1995, 1996 Ben Wing.
4
5 This file is part of XEmacs.
6
7 XEmacs is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 2, or (at your option) any
10 later version.
11
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with XEmacs; see the file COPYING.  If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.  */
21
22 /* Synched up with: Not in FSF. */
23
24 #ifndef INCLUDED_objects_h_
25 #define INCLUDED_objects_h_
26
27 #include "specifier.h"
28
29 void finalose (void *ptr);
30
31 /*****************************************************************************
32  *                        Color Specifier Object                             *
33  *****************************************************************************/
34
35 struct color_specifier
36 {
37   Lisp_Object face;             /* face this is attached to, or nil */
38   Lisp_Object face_property;    /* property of that face */
39 };
40
41 #define COLOR_SPECIFIER_DATA(g) SPECIFIER_TYPE_DATA (g, color)
42 #define COLOR_SPECIFIER_FACE(g) (COLOR_SPECIFIER_DATA (g)->face)
43 #define COLOR_SPECIFIER_FACE_PROPERTY(g) \
44   (COLOR_SPECIFIER_DATA (g)->face_property)
45
46 DECLARE_SPECIFIER_TYPE (color);
47 #define XCOLOR_SPECIFIER(x) XSPECIFIER_TYPE (x, color)
48 #define XSETCOLOR_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, color)
49 #define COLOR_SPECIFIERP(x) SPECIFIER_TYPEP (x, color)
50 #define CHECK_COLOR_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, color)
51 #define CONCHECK_COLOR_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, color)
52
53 void set_color_attached_to (Lisp_Object obj, Lisp_Object face,
54                             Lisp_Object property);
55
56 /*****************************************************************************
57  *                         Font Specifier Object                             *
58  *****************************************************************************/
59
60 struct font_specifier
61 {
62   Lisp_Object face;             /* face this is attached to, or nil */
63   Lisp_Object face_property;    /* property of that face */
64 };
65
66 #define FONT_SPECIFIER_DATA(g) SPECIFIER_TYPE_DATA (g, font)
67 #define FONT_SPECIFIER_FACE(g) (FONT_SPECIFIER_DATA (g)->face)
68 #define FONT_SPECIFIER_FACE_PROPERTY(g) \
69   (FONT_SPECIFIER_DATA (g)->face_property)
70
71 DECLARE_SPECIFIER_TYPE (font);
72 #define XFONT_SPECIFIER(x) XSPECIFIER_TYPE (x, font)
73 #define XSETFONT_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, font)
74 #define FONT_SPECIFIERP(x) SPECIFIER_TYPEP (x, font)
75 #define CHECK_FONT_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, font)
76 #define CONCHECK_FONT_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, font)
77
78 void set_font_attached_to (Lisp_Object obj, Lisp_Object face,
79                            Lisp_Object property);
80
81 /*****************************************************************************
82  *                       Face Boolean Specifier Object                       *
83  *****************************************************************************/
84
85 struct face_boolean_specifier
86 {
87   Lisp_Object face;             /* face this is attached to, or nil */
88   Lisp_Object face_property;    /* property of that face */
89 };
90
91 #define FACE_BOOLEAN_SPECIFIER_DATA(g) SPECIFIER_TYPE_DATA (g, face_boolean)
92 #define FACE_BOOLEAN_SPECIFIER_FACE(g) (FACE_BOOLEAN_SPECIFIER_DATA (g)->face)
93 #define FACE_BOOLEAN_SPECIFIER_FACE_PROPERTY(g) \
94   (FACE_BOOLEAN_SPECIFIER_DATA (g)->face_property)
95
96 DECLARE_SPECIFIER_TYPE (face_boolean);
97 extern Lisp_Object Qface_boolean;
98 #define XFACE_BOOLEAN_SPECIFIER(x) XSPECIFIER_TYPE (x, face_boolean)
99 #define XSETFACE_BOOLEAN_SPECIFIER(x, p) \
100   XSETSPECIFIER_TYPE (x, p, face_boolean)
101 #define FACE_BOOLEAN_SPECIFIERP(x) SPECIFIER_TYPEP (x, face_boolean)
102 #define CHECK_FACE_BOOLEAN_SPECIFIER(x) \
103   CHECK_SPECIFIER_TYPE (x, face_boolean)
104 #define CONCHECK_FACE_BOOLEAN_SPECIFIER(x) \
105   CONCHECK_SPECIFIER_TYPE (x, face_boolean)
106
107 void set_face_boolean_attached_to (Lisp_Object obj, Lisp_Object face,
108                                    Lisp_Object property);
109
110 /****************************************************************************
111  *                           Color Instance Object                          *
112  ****************************************************************************/
113
114 EXFUN (Fmake_color_instance, 3);
115
116 extern Lisp_Object Vthe_null_color_instance;
117
118 struct Lisp_Color_Instance
119 {
120   struct lcrecord_header header;
121   Lisp_Object name;
122   Lisp_Object device;
123
124   /* console-type-specific data */
125   void *data;
126 };
127
128 DECLARE_LRECORD (color_instance, Lisp_Color_Instance);
129 #define XCOLOR_INSTANCE(x) XRECORD (x, color_instance, Lisp_Color_Instance)
130 #define XSETCOLOR_INSTANCE(x, p) XSETRECORD (x, p, color_instance)
131 #define COLOR_INSTANCEP(x) RECORDP (x, color_instance)
132 #define CHECK_COLOR_INSTANCE(x) CHECK_RECORD (x, color_instance)
133 #define CONCHECK_COLOR_INSTANCE(x) CONCHECK_RECORD (x, color_instance)
134
135 #define COLOR_INSTANCE_NAME(c)   ((c)->name)
136 #define COLOR_INSTANCE_DEVICE(c) ((c)->device)
137
138 /****************************************************************************
139  *                            Font Instance Object                          *
140  ****************************************************************************/
141
142 DECLARE_LRECORD (font_instance, Lisp_Font_Instance);
143 #define XFONT_INSTANCE(x) XRECORD (x, font_instance, Lisp_Font_Instance)
144 #define XSETFONT_INSTANCE(x, p) XSETRECORD (x, p, font_instance)
145 #define FONT_INSTANCEP(x) RECORDP (x, font_instance)
146 #define CHECK_FONT_INSTANCE(x) CHECK_RECORD (x, font_instance)
147 #define CONCHECK_FONT_INSTANCE(x) CONCHECK_RECORD (x, font_instance)
148
149 #ifdef MULE
150 int font_spec_matches_charset (struct device *d, Lisp_Object charset,
151                                CONST Bufbyte *nonreloc,
152                                Lisp_Object reloc, Bytecount offset,
153                                Bytecount length);
154 #endif
155
156 EXFUN (Fmake_font_instance, 3);
157 EXFUN (Ffont_instance_name, 1);
158 EXFUN (Ffont_instance_p, 1);
159 EXFUN (Ffont_instance_truename, 1);
160
161 extern Lisp_Object Vthe_null_font_instance;
162
163 struct Lisp_Font_Instance
164 {
165   struct lcrecord_header header;
166   Lisp_Object name;
167   Lisp_Object device;
168
169   unsigned short ascent;        /* extracted from `font', or made up */
170   unsigned short descent;
171   unsigned short width;
172   unsigned short height;
173   int proportional_p;
174
175   /* console-type-specific data */
176   void *data;
177 };
178
179 #define FONT_INSTANCE_NAME(f)    ((f)->name)
180 #define FONT_INSTANCE_DEVICE(f)  ((f)->device)
181 #define FONT_INSTANCE_ASCENT(f)  ((f)->ascent)
182 #define FONT_INSTANCE_DESCENT(f) ((f)->descent)
183 #define FONT_INSTANCE_WIDTH(f)   ((f)->width)
184 #define FONT_INSTANCE_HEIGHT(f)  ((f)->height)
185
186 #endif /* INCLUDED_objects_h_ */