|
| 1 | +#ifndef CLASSES_H |
| 2 | +#define CLASSES_H |
| 3 | +/* |
| 4 | +** Fed-x parser output module for generating C++ class definitions |
| 5 | +** December 5, 1989 |
| 6 | +** release 2 17-Feb-1992 |
| 7 | +** release 3 March 1993 |
| 8 | +** release 4 December 1993 |
| 9 | +** K. C. Morris |
| 10 | +** |
| 11 | +** Development of Fed-x was funded by the United States Government, |
| 12 | +** and is not subject to copyright. |
| 13 | +
|
| 14 | +******************************************************************* |
| 15 | +The conventions used in this binding follow the proposed specification |
| 16 | +for the STEP Standard Data Access Interface as defined in document |
| 17 | +N350 ( August 31, 1993 ) of ISO 10303 TC184/SC4/WG7. |
| 18 | +*******************************************************************/ |
| 19 | + |
| 20 | +#include <stdio.h> |
| 21 | +#include <string.h> |
| 22 | +#include <ctype.h> |
| 23 | + |
| 24 | + |
| 25 | +#include "express.h" |
| 26 | +#include "exppp.h" |
| 27 | +#include "dict.h" |
| 28 | + |
| 29 | +#define MAX_LEN 240 |
| 30 | +#define DEBUG if (0) printf |
| 31 | + |
| 32 | +/* Values for multiple schema support: */ |
| 33 | +#define NOTKNOWN 1 |
| 34 | +#define UNPROCESSED 2 |
| 35 | +#define CANTPROCESS 3 |
| 36 | +#define CANPROCESS 4 |
| 37 | +#define PROCESSED 5 |
| 38 | + |
| 39 | +#define TD_PREFIX "t_" |
| 40 | +#define ATTR_PREFIX "a_" |
| 41 | +#define ENT_PREFIX "e_" |
| 42 | +#define SCHEMA_PREFIX "s_" |
| 43 | + |
| 44 | +#define TYPEprefix(t) (TYPEis_entity (t) ? ENT_PREFIX : TD_PREFIX) |
| 45 | + |
| 46 | +#define SCHEMA_FILE_PREFIX "Sdai" |
| 47 | +#define TYPE_PREFIX "Sdai" |
| 48 | +#define ENTITYCLASS_PREFIX TYPE_PREFIX |
| 49 | +#define ENUM_PREFIX "" |
| 50 | + |
| 51 | +#define move(b) (b = (b + strlen(b))) |
| 52 | +#define TYPEtd_name(t) TypeDescriptorName (t) |
| 53 | + |
| 54 | +typedef struct file_holder { |
| 55 | + FILE * inc; /**< include file */ |
| 56 | + FILE * lib; /**< library file */ |
| 57 | + FILE * incall; /**< include file for collecting all include files */ |
| 58 | + FILE * initall; /**< for registering all entities from all schemas */ |
| 59 | + FILE * init; /**< contains function to initialize program to use schema's entities */ |
| 60 | + FILE * create; /**< DAR - added - to create all schema & ent descriptors. In multiple |
| 61 | + * interrelated schemas, must be done before attribute descriptors and |
| 62 | + * sub-super links created. |
| 63 | + */ |
| 64 | + FILE * classes; /**< DAR - added - a new .h file to contain declarations of all the |
| 65 | + * classes, so that all the .h files can refer any of the entity classes. |
| 66 | + * Nec. if ent1 of schemaA has attribute ent2 from schemaB. |
| 67 | + */ |
| 68 | + FILE * names; /**< MAP Nov 2011 - header with namespace for entity and attr descriptors */ |
| 69 | + FILE * helpers; /**< MAP Mar 2012 - header with inline helper functions. Currently only used for |
| 70 | + helper functions to find runtime aggregate bounds */ |
| 71 | +} File_holder, FILES; |
| 72 | + |
| 73 | +/** these fields are used so that ENTITY types are processed in order |
| 74 | + * when appearing in differnt schemas |
| 75 | + */ |
| 76 | +typedef struct EntityTag_ * EntityTag; |
| 77 | +struct EntityTag_ { |
| 78 | + unsigned int started : 1; /**< marks the beginning of processing */ |
| 79 | + unsigned int complete : 1; /**< marks the end of processing */ |
| 80 | + Entity superclass; /**< the entity being used as the supertype - with multiple inheritance only chose one */ |
| 81 | +}; |
| 82 | + |
| 83 | +Entity ENTITYget_superclass( Entity entity ); |
| 84 | +Entity ENTITYput_superclass( Entity entity ); |
| 85 | +int ENTITYhas_explicit_attributes( Entity e ); |
| 86 | +void ENTITYget_first_attribs( Entity entity, Linked_List result ); |
| 87 | + |
| 88 | +/** these fields are used so that SELECT types are processed in order */ |
| 89 | +typedef struct SelectTag_ * SelectTag; |
| 90 | +struct SelectTag_ { |
| 91 | + unsigned int started : 1; /**< marks the beginning of processing */ |
| 92 | + unsigned int complete : 1; /**< marks the end of processing */ |
| 93 | +}; |
| 94 | + |
| 95 | +const char * GetTypeDescriptorName( Type t ); |
| 96 | +char * format_for_stringout( char * orig_buf, char * return_buf ); |
| 97 | +void format_for_std_stringout( FILE* f, char* orig_buf ); |
| 98 | +const char * CheckWord( const char * ); |
| 99 | +const char * StrToLower( const char * ); |
| 100 | +const char * StrToUpper( const char * ); |
| 101 | +const char * FirstToUpper( const char * ); |
| 102 | +const char * SelectName( const char * ); |
| 103 | +FILE * FILEcreate( const char * ); |
| 104 | +void FILEclose( FILE * ); |
| 105 | +const char * ClassName( const char * ); |
| 106 | +const char * ENTITYget_classname( Entity ); |
| 107 | +void FUNCPrint( Function, FILES *, Schema ); |
| 108 | +void RULEPrint( Rule, FILES *, Schema ); |
| 109 | +void ENTITYPrint( Entity, FILES *, Schema ); |
| 110 | +const char * StrToConstant( const char * ); |
| 111 | +void TYPEselect_print( Type, FILES *, Schema ); |
| 112 | +void ENTITYprint_new( Entity, FILES *, Schema, int ); |
| 113 | +void TYPEprint_definition( Type, FILES *, Schema ); |
| 114 | +void TYPEprint_new( const Type, FILE *, Schema ); |
| 115 | +void TYPEprint_typedefs( Type, FILE * ); |
| 116 | +void TYPEprint_descriptions( const Type, FILES *, Schema ); |
| 117 | +void TYPEprint_init( const Type type, FILES * files, Schema schema ); |
| 118 | +void AGGRprint_init( FILES * files, const Type t, |
| 119 | + const char * var_name, const char * aggr_name ); |
| 120 | +void TYPEselect_init_print( const Type type, FILE* f ); |
| 121 | +void MODELPrint( Entity, FILES *, Schema, int ); |
| 122 | +void MODELprint_new( Entity entity, FILES* files ); |
| 123 | +void MODELPrintConstructorBody( Entity, FILES *, Schema/*, int*/ ); |
| 124 | +const char * PrettyTmpName( const char * oldname ); |
| 125 | +const char * EnumName( const char * oldname ); |
| 126 | +const char * TypeDescriptorName( Type ); |
| 127 | +char * TypeDescription( const Type t ); |
| 128 | +const char * TypeName( Type t ); |
| 129 | +const char * AccessType( Type t ); |
| 130 | +const char * TYPEget_ctype( const Type t ); |
| 131 | +void print_file( Express ); |
| 132 | +void resolution_success( void ); |
| 133 | +void SCHEMAprint( Schema schema, FILES* files, int suffix ); |
| 134 | +Type TYPEget_ancestor( Type ); |
| 135 | +const char * FundamentalType( const Type t, int report_reftypes ); |
| 136 | + |
| 137 | +/*Variable*/ |
| 138 | +#define VARis_simple_explicit(a) (!VARis_type_shifter(a)) |
| 139 | + |
| 140 | +/*Variable*/ |
| 141 | +#define VARis_simple_derived(a) (!VARis_overrider(a)) |
| 142 | + |
| 143 | +Variable VARis_overrider( Entity e, Variable a ); |
| 144 | + |
| 145 | +/* Added for multiple schema support: */ |
| 146 | +void print_schemas_separate( Express, FILES * ); |
| 147 | +void getMCPrint( Express, FILE *, FILE * ); |
| 148 | +int sameSchema( Scope, Scope ); |
| 149 | + |
| 150 | +void USEREFout( Schema schema, Dictionary refdict, Linked_List reflist, char * type, FILE * file ); |
| 151 | + |
| 152 | +#endif |
| 153 | + |
0 commit comments