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

Function property_set_create

src/engine/modules/property-set.cpp:148–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146static struct ps_map all_property_sets;
147
148LIST * property_set_create( FRAME * frame, int flags )
149{
150 LIST * properties = lol_get( frame->args, 0 );
151 LIST * sorted = list_sort( properties );
152 LIST * unique = list_unique( sorted );
153 struct ps_map_entry * pos = ps_map_insert( &all_property_sets, unique );
154 list_free( sorted );
155 if ( pos->value )
156 {
157 list_free( unique );
158 return list_new( object_copy( pos->value ) );
159 }
160 else
161 {
162 OBJECT * rulename = object_new( "new" );
163 OBJECT * varname = object_new( "self.raw" );
164 LIST * val = call_rule( rulename, frame,
165 list_new( object_new( "property-set" ) ), 0 );
166 LISTITER iter, end;
167 object_free( rulename );
168 pos->value = object_copy( list_front( val ) );
169 var_set( bindmodule( pos->value ), varname, unique, VAR_SET );
170 object_free( varname );
171
172 for ( iter = list_begin( unique ), end = list_end( unique ); iter != end; ++iter )
173 {
174 const char * str = object_str( list_item( iter ) );
175 if ( str[ 0 ] != '<' || ! strchr( str, '>' ) )
176 {
177 string message[ 1 ];
178 string_new( message );
179 string_append( message, "Invalid property: '" );
180 string_append( message, str );
181 string_append( message, "'" );
182 LIST * imports = list_new( object_new( "errors" ) );
183 import_module( imports, frame->module );
184 rulename = object_new( "errors.error" );
185 call_rule( rulename, frame,
186 list_new( object_new( message->value ) ), 0 );
187 /* unreachable */
188 string_free( message );
189 object_free( list_front( imports ) );
190 list_free( imports );
191 object_free( rulename );
192 }
193 }
194
195 return val;
196 }
197}
198
199/* binary search for the property value */
200LIST * property_set_get( FRAME * frame, int flags )

Callers

nothing calls this directly

Calls 15

lol_getFunction · 0.85
list_sortFunction · 0.85
list_uniqueFunction · 0.85
ps_map_insertFunction · 0.85
list_freeFunction · 0.85
list_newFunction · 0.85
object_copyFunction · 0.85
object_newFunction · 0.85
call_ruleFunction · 0.85
object_freeFunction · 0.85
var_setFunction · 0.85
bindmoduleFunction · 0.85

Tested by

no test coverage detected