MCPcopy Create free account
hub / github.com/boostorg/build / make_class_module

Function make_class_module

src/engine/class.cpp:127–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125
126
127OBJECT * make_class_module( LIST * xname, LIST * bases, FRAME * frame )
128{
129 OBJECT * name = class_module_name( list_front( xname ) );
130 OBJECT * * pp;
131 module_t * class_module = 0;
132 int found;
133
134 if ( !classes )
135 classes = hashinit( sizeof( OBJECT * ), "classes" );
136
137 pp = (OBJECT * *)hash_insert( classes, list_front( xname ), &found );
138 if ( !found )
139 {
140 *pp = object_copy( list_front( xname ) );
141 }
142 else
143 {
144 out_printf( "Class %s already defined\n", object_str( list_front( xname ) )
145 );
146 abort();
147 }
148 check_defined( bases );
149
150 class_module = bindmodule( name );
151
152 {
153 /*
154 Initialize variables that B2 inserts in every object.
155 We want to avoid creating the object's hash if it isn't needed.
156 */
157 int num = class_module->num_fixed_variables;
158 module_add_fixed_var( class_module, constant_name, &num );
159 module_add_fixed_var( class_module, constant_class, &num );
160 module_set_fixed_variables( class_module, num );
161 }
162
163 var_set( class_module, constant_name, xname, VAR_SET );
164 var_set( class_module, constant_bases, bases, VAR_SET );
165
166 {
167 LISTITER iter = list_begin( bases );
168 LISTITER const end = list_end( bases );
169 for ( ; iter != end; iter = list_next( iter ) )
170 import_base_rules( class_module, list_item( iter ) );
171 }
172
173 return name;
174}
175
176
177static void free_class( void * xclass, void * data )

Callers 1

function_runFunction · 0.85

Calls 14

class_module_nameFunction · 0.85
hashinitFunction · 0.85
hash_insertFunction · 0.85
object_copyFunction · 0.85
out_printfFunction · 0.85
object_strFunction · 0.85
check_definedFunction · 0.85
bindmoduleFunction · 0.85
module_add_fixed_varFunction · 0.85
var_setFunction · 0.85
list_beginFunction · 0.85

Tested by

no test coverage detected