1 /* objects.c
2 *
3 * $Id$
4 *
5 * Copyright 1990, 1991, 1992, 1993, 1994, 1995, Oliver Laumann, Berlin
6 * Copyright 2002, 2003 Sam Hocevar <sam@hocevar.net>, Paris
7 *
8 * This software was derived from Elk 1.2, which was Copyright 1987, 1988,
9 * 1989, Nixdorf Computer AG and TELES GmbH, Berlin (Elk 1.2 has been written
10 * by Oliver Laumann for TELES Telematic Services, Berlin, in a joint project
11 * between TELES and Nixdorf Microprocessor Engineering, Berlin).
12 *
13 * Oliver Laumann, TELES GmbH, Nixdorf Computer AG and Sam Hocevar, as co-
14 * owners or individual owners of copyright in this software, grant to any
15 * person or company a worldwide, royalty free, license to
16 *
17 * i) copy this software,
18 * ii) prepare derivative works based on this software,
19 * iii) distribute copies of this software or derivative works,
20 * iv) perform this software, or
21 * v) display this software,
22 *
23 * provided that this notice is not removed and that neither Oliver Laumann
24 * nor Teles nor Nixdorf are deemed to have made any representations as to
25 * the suitability of this software for any purpose nor are held responsible
26 * for any defects of this software.
27 *
28 * THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
29 */
30
31 #include <stdarg.h>
32
33 #include "xlib.h"
34
35 Object Sym_None;
36
Match_X_Obj(Object x,va_list v)37 int Match_X_Obj (Object x, va_list v) {
38 register int type = TYPE(x);
39
40 if (type == T_Display) {
41 return 1;
42 } else if (type == T_Gc) {
43 return va_arg (v, GC) == GCONTEXT(x)->gc;
44 } else if (type == T_Pixel) {
45 return va_arg (v, unsigned long) == PIXEL(x)->pix;
46 } else if (type == T_Pixmap) {
47 return va_arg (v, Pixmap) == PIXMAP(x)->pm;
48 } else if (type == T_Window) {
49 return va_arg (v, Window) == WINDOW(x)->win;
50 } else if (type == T_Font) {
51 return va_arg (v, Font) == FONT(x)->id;
52 } else if (type == T_Colormap) {
53 return va_arg (v, Colormap) == COLORMAP(x)->cm;
54 } else if (type == T_Color) {
55 return va_arg (v, unsigned int) == COLOR(x)->c.red
56 && va_arg (v, unsigned int) == COLOR(x)->c.green
57 && va_arg (v, unsigned int) == COLOR(x)->c.blue;
58 } else if (type == T_Cursor) {
59 return va_arg (v, Cursor) == CURSOR(x)->cursor;
60 } else if (type == T_Atom) {
61 return va_arg (v, Atom) == ATOM(x)->atom;
62 } else Panic ("Match_X_Obj");
63 return 0;
64 }
65
elk_init_xlib_objects()66 void elk_init_xlib_objects () {
67 Define_Symbol (&Sym_None, "none");
68 }
69