Skip to content

Commit 18f81e1

Browse files
committed
move VARcreate and ENTITYcreate to factory.c
1 parent a25ee56 commit 18f81e1

File tree

3 files changed

+38
-38
lines changed

3 files changed

+38
-38
lines changed

src/express/entity.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -285,27 +285,6 @@ Variable ENTITYresolve_attr_ref( Entity e, Symbol * grp_ref, Symbol * attr_ref )
285285
return attr;
286286
}
287287

288-
/**
289-
** low-level function for type Entity
290-
**
291-
** \note The attribute list of a new entity is defined as an
292-
** empty list; all other aspects of the entity are initially
293-
** undefined (i.e., have appropriate NULL values).
294-
*/
295-
Entity ENTITYcreate( Symbol * sym ) {
296-
Scope s = SCOPEcreate( OBJ_ENTITY );
297-
298-
s->u.entity = ENTITY_new();
299-
s->u.entity->attributes = LISTcreate();
300-
s->u.entity->inheritance = ENTITY_INHERITANCE_UNINITIALIZED;
301-
302-
/* it's so useful to have a type hanging around for each entity */
303-
s->u.entity->type = TYPEcreate_name( sym );
304-
s->u.entity->type->u.type->body = TYPEBODYcreate( entity_ );
305-
s->u.entity->type->u.type->body->entity = s;
306-
return( s );
307-
}
308-
309288
/**
310289
* currently, this is only used by USEresolve
311290
* low-level function for type Entity

src/express/factory.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
}

src/express/variable.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -120,20 +120,3 @@ extern char * VARget_simple_name( Variable v ) {
120120
}
121121
return EXPget_name( e );
122122
}
123-
124-
/** VARcreate
125-
** \param name name of variable to create
126-
** \param type type of new variable
127-
** \return the Variable created
128-
** Create and return a new variable.
129-
**
130-
** \note The reference class of the variable is, by default,
131-
** dynamic. Special flags associated with the variable
132-
** (e.g., optional) are initially false.
133-
*/
134-
Variable VARcreate( Expression name, Type type ) {
135-
Variable v = VAR_new();
136-
v->name = name;
137-
v->type = type;
138-
return v;
139-
}

0 commit comments

Comments
 (0)