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 #ifndef __fieldClass
118 #define __fieldClass
119 /***********************************************************************/
120 /* Open Visualization Data Explorer */
121 /* (C) Copyright IBM Corp. 1989,1999 */
122 /* ALL RIGHTS RESERVED */
123 /* This code licensed under the */
124 /* "IBM PUBLIC LICENSE - Open Visualization Data Explorer" */
125 /***********************************************************************/
126
127 /*
128 \section{Field class}
129 */
130
131
132 extern struct field_class _dxdfield_class;
133 Object _dxfField_Copy(Field, enum _dxd_copy);
134 Object _dxfField_GetType(Field, Type*, Category*, int*, int*);
135 Error _dxfField_Delete(Field);
136 Object _dxfField_BoundingBox(Field, Point*, Matrix*, int);
137 Object _dxfField_Gather(Field, struct gather *, struct tile *);
138 Object _dxfField_Paint(Field, struct buffer *, int, struct tile *);
139 Error _dxfField_Shade(Field, struct shade *);
140 Error _dxfField_Partition(Field, int*, int, Object*, int);
141
142 #define NCOMPONENTS 8
143
144 struct field {
145
146 struct object object; /* object preamble */
147
148 /* the component/attribute table */
149 struct component { /* the components */
150 char *name; /* component name */
151 Object value; /* component value */
152 } local[NCOMPONENTS], *components; /* the components */
153 int ncomponents; /* number of components */
154 int comp_alloc; /* allocated space for components */
155
156 /* helper stuff */
157 int cell; /* whether we'r in a cell or not */
158 PointId *pts; /* the points in current face */
159 int npts; /* number of pts in current face */
160 int pts_alloc; /* allocated size of pts array */
161 struct hash { /* hash table to eliminate dup faces */
162 Triangle tri; /* the triangle */
163 int count; /* multiplicity */
164 } *hash;
165 int nsurface, ninner; /* counts in hash table */
166 int hash_alloc; /* allocate size of hash table */
167 };
168
169
170
171 #endif
172
173 struct object_class {
174 struct _root root;
175 Class class;
176 char *name;
177 Error (*Delete)();
178 Error (*Shade)();
179 Object (*BoundingBox)();
180 Object (*Paint)();
181 Object (*Gather)();
182 Error (*Partition)();
183 Object (*GetType)();
184 Object (*Copy)();
185 };
186
187 struct field_class {
188 struct object_class super;
189 Class class;
190 char *name;
191 };
192
193 struct field_class _dxdfield_class = {
194 sizeof(struct field),
195 CLASS_FIELD,
196 "field",
197 CLASS_FIELD,
198 "field",
199 _dxfField_Delete,
200 _dxfField_Shade,
201 _dxfField_BoundingBox,
202 _dxfField_Paint,
203 _dxfField_Gather,
204 _dxfField_Partition,
205 _dxfField_GetType,
206 _dxfField_Copy,
207 CLASS_FIELD,
208 "field",
209 };
210
DXGetFieldClass(Field o)211 Class DXGetFieldClass(Field o) {
212 return o? (*(struct field_class **)o)->class: CLASS_MIN;
213 }
214
215