#include <stdio.h>
#include "ShapeP.h"
static void init(Core p);
ShapeClassDescriptor shape_class_descriptor = {
/* Core part */
{
"Shape", /* class_name */
&core_class_descriptor, /* super_class */
sizeof(ShapeObj), /* size_of_instance */
NULL, /* class_initializer */
init, /* initializer */
NULL, /* finalizer */
},
/* Shape part */
{
NULL, /* draw */
},
};
CoreClassDescriptor *shapeClass
= (CoreClassDescriptor*)&shape_class_descriptor;
static void
init(Core p)
{
Shape shape = (Shape)p;
shape->shape.color = BLACK;
shape->shape.boundary[0].x = 0.0;
shape->shape.boundary[0].y = 0.0;
shape->shape.boundary[1].x = 0.0;
shape->shape.boundary[1].y = 0.0;
printf("shape initialized.\n");
}
void
draw_shape(Shape shape)
{
ShapeClassDescriptor *shape_class;
shape_class = (ShapeClassDescriptor*)shape->core.class_descriptor;
shape_class->shape.draw(shape);
}