/* ECP: FILEname=fig9_30.c */ /* 1*/ /* To Add A New Shape */ /* 2*/ /* 1. Create Appropriate Header And Source */ /* 3*/ /* Read, Write, And Area Functions; */ /* 4*/ /* 2. Update #include Statements Below; */ /* 5*/ /* 3. Adjust typedef Shape */ /* 6*/ /* 7*/ #include "circle.h" /* 8*/ #include "square.h" /* 9*/ #include "rectangle.h" /*10*/ typedef struct /*11*/ { /*12*/ char *ShapeName; /*13*/ ShapeType * ( *ReadShape )( void ); /*14*/ void ( *WriteShape )( const ShapeType *Shape ); /*15*/ void ( *Area )( ShapeType *Shape ); /*16*/ } ShapeSwitch; /*17*/ static ShapeSwitch ShapeTable[ ] = /*18*/ { /*19*/ { "circle", ReadCircle, WriteCircle, AreaCircle }, /*20*/ { "rectangle", ReadRectangle, WriteRectangle, AreaRectangle }, /*21*/ { "square", ReadSquare, WriteSquare, AreaSquare }, /*22*/ { NULL, NULL, NULL, NULL } /*23*/ }; /*24*/ #include