1 /*
2 * Automatically generated - DO NOT EDIT!
3 */
4
5 #ifndef __objectClass
6 #define __objectClass
7 /***********************************************************************/
8 /* Open Visualization Data Explorer */
9 /* (C) Copyright IBM Corp. 1989,1999 */
10 /* ALL RIGHTS RESERVED */
11 /* This code licensed under the */
12 /* "IBM PUBLIC LICENSE - Open Visualization Data Explorer" */
13 /***********************************************************************/
14
15 /*
16 \section{Object class}
17
18 Every object begins with an object preamble, which contains the class
19 number and a reference count.
20 */
21
22 #include <dx/dx.h>
23
24 /* the following make ANSI compilers happier */
25 struct shade;
26 struct buffer;
27 struct tile;
28 struct gather;
29 struct survey;
30 struct count;
31
32 struct _root {
33 int size;
34 Class class;
35 char *name;
36 };
37 #define CLASS_SIZE(x) (((struct _root *)(x))->size)
38 #define CLASS_CLASS(x) (((struct _root *)(x))->class)
39 #define CLASS_NAME(x) (((struct _root *)(x))->name)
40
41
42 extern struct object_class _dxdobject_class;
43 Error _dxfDelete(Object);
44 Error _dxfno_Delete(Object);
45 Error _dxfShade(Object, struct shade *);
46 Error _dxfno_Shade(Object, struct shade *);
47 Object _dxfBoundingBox(Object, Point*, Matrix*, int);
48 Object _dxfno_BoundingBox(Object, Point*, Matrix*, int);
49 Object _dxfPaint(Object, struct buffer *, int, struct tile *);
50 Object _dxfno_Paint(Object, struct buffer *, int, struct tile *);
51 Object _dxfGather(Object, struct gather *, struct tile *);
52 Object _dxfno_Gather(Object, struct gather *, struct tile *);
53 Error _dxfPartition(Object, int*, int, Object*, int);
54 Error _dxfno_Partition(Object, int*, int, Object*, int);
55 Object _dxfGetType(Object, Type*, Category*, int*, int*);
56 Object _dxfno_GetType(Object, Type*, Category*, int*, int*);
57 Object _dxfCopy(Object, enum _dxd_copy);
58 Object _dxfno_Copy(Object, enum _dxd_copy);
59 Error _dxfObject_Delete(Object);
60 Object _dxfObject_BoundingBox(Object, Point*, Matrix*, int);
61 Error _dxfObject_Shade(Object, struct shade *);
62
63 #define NATTRIBUTES 2 /* number of attributes in object */
64
65 struct object { /* object preamble */
66 struct object_class *class; /* class vector */
67 Class class_id; /* class id (for debugging only!) */
68 lock_type lock; /* for Reference and Delete */
69 int count; /* reference count */
70 int tag; /* object tag */
71 struct attribute { /* object attributes */
72 char *name; /* attribute name */
73 Object value; /* attribue value */
74 } local[NATTRIBUTES], *attributes; /* the attributes */
75 int nattributes; /* number of attributes */
76 int attr_alloc; /* allocated space for attributes */
77 };
78
79 #if 0 /* was if OPTIMIZED */
80 #define CHECK(obj, cls) { \
81 if (!obj) \
82 return ERROR; \
83 }
84 #else
85 #define CHECK(obj, cls) { \
86 if (!obj) \
87 return ERROR; \
88 if (DXGetObjectClass((Object)(obj)) != cls) \
89 DXErrorReturn(ERROR_BAD_CLASS, "called with object of wrong class"); \
90 }
91 #endif
92 /**
93 This macro eases the task of checking argument class. Note: This is not needed
94 when a method implementation is called, because {\tt o} and its class will
95 both have been checked by the method.
96 **/
97
98 Object _dxf_NewObject(struct object_class *class);
99 /**
100 This internal routine is called only by other {\tt New...} routines to
101 create and initialize the object preamble.
102 **/
103
104 Object _dxf_CopyObject(Object new, Object old, enum _dxd_copy copy);
105 /**
106 Copies the portion of the data of {\tt old} managed by the {\tt
107 Object} class to {\tt new}. This is provided for subclasses of {\tt Object}
108 to use in their copy routines. Copying works something like creating
109 an object. Every class {\tt X} that implements copying should provide
110 an {\tt \_CopyX} routine that copies relevant data from an old object
111 to a new object, so that subclass copy routines may call this routine
112 to copy the superclass's data. The {\tt CopyX} routine just creates a
113 new object of the appropriate type and then calls {\tt \_CopyX} to copy
114 the data.
115 **/
116 #endif
117
118 struct object_class {
119 struct _root root;
120 Class class;
121 char *name;
122 Error (*Delete)();
123 Error (*Shade)();
124 Object (*BoundingBox)();
125 Object (*Paint)();
126 Object (*Gather)();
127 Error (*Partition)();
128 Object (*GetType)();
129 Object (*Copy)();
130 };
131
_dxfno_Delete(Object a)132 Error _dxfno_Delete(Object a) {
133 char *name;
134 name = (*(struct object_class **)a)->name;
135 DXSetError(ERROR_BAD_PARAMETER, "#12130", "DXDelete", name);
136 return ERROR;
137 }
138
_dxfno_Shade(Object a,struct shade * b)139 Error _dxfno_Shade(Object a, struct shade * b) {
140 char *name;
141 name = (*(struct object_class **)a)->name;
142 DXSetError(ERROR_BAD_PARAMETER, "#12130", "DXShade", name);
143 return ERROR;
144 }
145
_dxfno_BoundingBox(Object a,Point * b,Matrix * c,int d)146 Object _dxfno_BoundingBox(Object a, Point* b, Matrix* c, int d) {
147 char *name;
148 name = (*(struct object_class **)a)->name;
149 DXSetError(ERROR_BAD_PARAMETER, "#12130", "DXBoundingBox", name);
150 return NULL;
151 }
152
_dxfno_Paint(Object a,struct buffer * b,int c,struct tile * d)153 Object _dxfno_Paint(Object a, struct buffer * b, int c, struct tile * d) {
154 char *name;
155 name = (*(struct object_class **)a)->name;
156 DXSetError(ERROR_BAD_PARAMETER, "#12130", "DXPaint", name);
157 return NULL;
158 }
159
_dxfno_Gather(Object a,struct gather * b,struct tile * c)160 Object _dxfno_Gather(Object a, struct gather * b, struct tile * c) {
161 char *name;
162 name = (*(struct object_class **)a)->name;
163 DXSetError(ERROR_BAD_PARAMETER, "#12130", "DXGather", name);
164 return NULL;
165 }
166
_dxfno_Partition(Object a,int * b,int c,Object * d,int e)167 Error _dxfno_Partition(Object a, int* b, int c, Object* d, int e) {
168 char *name;
169 name = (*(struct object_class **)a)->name;
170 DXSetError(ERROR_BAD_PARAMETER, "#12130", "DXPartition", name);
171 return ERROR;
172 }
173
_dxfno_GetType(Object a,Type * b,Category * c,int * d,int * e)174 Object _dxfno_GetType(Object a, Type* b, Category* c, int* d, int* e) {
175 char *name;
176 name = (*(struct object_class **)a)->name;
177 DXSetError(ERROR_BAD_PARAMETER, "#12130", "DXGetType", name);
178 return NULL;
179 }
180
_dxfno_Copy(Object a,enum _dxd_copy b)181 Object _dxfno_Copy(Object a, enum _dxd_copy b) {
182 char *name;
183 name = (*(struct object_class **)a)->name;
184 DXSetError(ERROR_BAD_PARAMETER, "#12130", "DXCopy", name);
185 return NULL;
186 }
187
188 struct object_class _dxdobject_class = {
189 sizeof(struct object),
190 CLASS_OBJECT,
191 "object",
192 CLASS_OBJECT,
193 "object",
194 _dxfObject_Delete,
195 _dxfObject_Shade,
196 _dxfObject_BoundingBox,
197 _dxfno_Paint,
198 _dxfno_Gather,
199 _dxfno_Partition,
200 _dxfno_GetType,
201 _dxfno_Copy,
202 };
203
_dxfDelete(Object a)204 Error _dxfDelete(Object a) {
205 if (!a)
206 return ERROR;
207 return (*(struct object_class **)a)->Delete((Object)a);
208 }
209
_dxfShade(Object a,struct shade * b)210 Error _dxfShade(Object a, struct shade * b) {
211 if (!a)
212 return ERROR;
213 return (*(struct object_class **)a)->Shade((Object)a,b);
214 }
215
_dxfBoundingBox(Object a,Point * b,Matrix * c,int d)216 Object _dxfBoundingBox(Object a, Point* b, Matrix* c, int d) {
217 if (!a)
218 return NULL;
219 return (*(struct object_class **)a)->BoundingBox((Object)a,b,c,d);
220 }
221
_dxfPaint(Object a,struct buffer * b,int c,struct tile * d)222 Object _dxfPaint(Object a, struct buffer * b, int c, struct tile * d) {
223 if (!a)
224 return NULL;
225 return (*(struct object_class **)a)->Paint((Object)a,b,c,d);
226 }
227
_dxfGather(Object a,struct gather * b,struct tile * c)228 Object _dxfGather(Object a, struct gather * b, struct tile * c) {
229 if (!a)
230 return NULL;
231 return (*(struct object_class **)a)->Gather((Object)a,b,c);
232 }
233
_dxfPartition(Object a,int * b,int c,Object * d,int e)234 Error _dxfPartition(Object a, int* b, int c, Object* d, int e) {
235 if (!a)
236 return ERROR;
237 return (*(struct object_class **)a)->Partition((Object)a,b,c,d,e);
238 }
239
_dxfGetType(Object a,Type * b,Category * c,int * d,int * e)240 Object _dxfGetType(Object a, Type* b, Category* c, int* d, int* e) {
241 if (!a)
242 return NULL;
243 return (*(struct object_class **)a)->GetType((Object)a,b,c,d,e);
244 }
245
_dxfCopy(Object a,enum _dxd_copy b)246 Object _dxfCopy(Object a, enum _dxd_copy b) {
247 if (!a)
248 return NULL;
249 return (*(struct object_class **)a)->Copy((Object)a,b);
250 }
251
DXGetObjectClass(Object o)252 Class DXGetObjectClass(Object o) {
253 return o? (*(struct object_class **)o)->class: CLASS_MIN;
254 }
255
256