void hw_find_ihandle_runtime_property (struct hw *me, const char *property, ihandle_runtime_property_spec *ihandle) { struct hw_property_data *entry = find_property_data (me, property); if (entry == NULL) hw_abort (me, "property \"%s\" not found", property); if (entry->property->type != ihandle_property || entry->property->disposition != permenant_object) hw_abort (me, "property \"%s\" of wrong type", property); ASSERT (entry->init_array != NULL); /* the full path */ ihandle->full_path = entry->init_array; }
const struct hw_property * hw_find_property (struct hw *me, const char *property) { if (me == NULL) { return NULL; } else if (property == NULL || strcmp (property, "") == 0) { if (me->properties_of_hw == NULL) return NULL; else return me->properties_of_hw->property; } else { struct hw_property_data *entry = find_property_data (me, property); if (entry != NULL) return entry->property; } return NULL; }
static void hw_set_property (struct hw *me, const char *property, hw_property_type type, const void *array, int sizeof_array) { /* find the property */ struct hw_property_data *entry = find_property_data (me, property); if (entry != NULL) { /* existing property - update it */ void *new_array = 0; struct hw_property *value = entry->property; /* check the type matches */ if (value->type != type) hw_abort (me, "conflict between type of new and old value for property %s", property); /* replace its value */ if (value->array != NULL) hw_free (me, (void*)value->array); new_array = (sizeof_array > 0 ? hw_zalloc (me, sizeof_array) : (void*)0); value->array = new_array; value->sizeof_array = sizeof_array; if (sizeof_array > 0) memcpy (new_array, array, sizeof_array); return; } else { /* new property - create it */ hw_add_property (me, property, type, NULL, 0, array, sizeof_array, NULL, temporary_object); } }