@@ -103,3 +103,41 @@ Symbol * SYMBOLcreate( char * name, int line, const char * filename ) {
103103 */
104104 return sym ;
105105}
106+
107+ /**
108+ ** low-level function for type Entity
109+ **
110+ ** \note The attribute list of a new entity is defined as an
111+ ** empty list; all other aspects of the entity are initially
112+ ** undefined (i.e., have appropriate NULL values).
113+ */
114+ Entity ENTITYcreate ( Symbol * sym ) {
115+ Scope s = SCOPEcreate ( OBJ_ENTITY );
116+
117+ s -> u .entity = ENTITY_new ();
118+ s -> u .entity -> attributes = LISTcreate ();
119+ s -> u .entity -> inheritance = ENTITY_INHERITANCE_UNINITIALIZED ;
120+
121+ /* it's so useful to have a type hanging around for each entity */
122+ s -> u .entity -> type = TYPEcreate_name ( sym );
123+ s -> u .entity -> type -> u .type -> body = TYPEBODYcreate ( entity_ );
124+ s -> u .entity -> type -> u .type -> body -> entity = s ;
125+ return ( s );
126+ }
127+
128+ /** VARcreate
129+ ** \param name name of variable to create
130+ ** \param type type of new variable
131+ ** \return the Variable created
132+ ** Create and return a new variable.
133+ **
134+ ** \note The reference class of the variable is, by default,
135+ ** dynamic. Special flags associated with the variable
136+ ** (e.g., optional) are initially false.
137+ */
138+ Variable VARcreate ( Expression name , Type type ) {
139+ Variable v = VAR_new ();
140+ v -> name = name ;
141+ v -> type = type ;
142+ return v ;
143+ }
0 commit comments