gint property_item_int_get_data (PropertySet* propertySet, const gchar* name) { gint result = 0; GError * _inner_error_ = NULL; g_return_val_if_fail (propertySet != NULL, 0); g_return_val_if_fail (name != NULL, 0); { PropertySet* _tmp0_; const gchar* _tmp1_; gint _tmp2_ = 0; gint _tmp3_; _tmp0_ = propertySet; _tmp1_ = name; _tmp2_ = property_item_int_get_data_throw (_tmp0_, _tmp1_, &_inner_error_); _tmp3_ = _tmp2_; if (_inner_error_ != NULL) { goto __catch58_g_error; } result = _tmp3_; return result; } goto __finally58; __catch58_g_error: { g_clear_error (&_inner_error_); _inner_error_ = NULL; result = 0; return result; } __finally58: g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); return 0; }
static void clock_component_def_real_compile_component (ComponentDef* base, CompiledCircuit* compiledCircuit, ComponentInst* componentInst, Connection** connections, int connections_length1, ComponentInst** ancestry, int ancestry_length1) { ClockComponentDef * self; Connection* _tmp0_; Connection* outputWire; gint onFor = 0; gint offFor = 0; Connection** _tmp1_; gint _tmp1__length1; gint _tmp21_; gint _tmp22_; Connection* _tmp23_; gint _tmp24_; gint _tmp25_; ComponentInst** _tmp26_; gint _tmp26__length1; ComponentInst* _tmp27_; ClockComponentState* _tmp28_; ComponentState* componentState; CompiledCircuit* _tmp29_; GError * _inner_error_ = NULL; self = (ClockComponentDef*) base; g_return_if_fail (compiledCircuit != NULL); _tmp0_ = connection_new_fake (); outputWire = _tmp0_; _tmp1_ = connections; _tmp1__length1 = connections_length1; { Connection** connection_collection = NULL; gint connection_collection_length1 = 0; gint _connection_collection_size_ = 0; gint connection_it = 0; connection_collection = _tmp1_; connection_collection_length1 = _tmp1__length1; for (connection_it = 0; connection_it < _tmp1__length1; connection_it = connection_it + 1) { Connection* _tmp2_; Connection* connection = NULL; _tmp2_ = _connection_ref0 (connection_collection[connection_it]); connection = _tmp2_; { Connection* _tmp3_; WireInst* _tmp4_; WireInst* _tmp5_; ComponentInst* _tmp6_; PinInst** _tmp7_; gint _tmp7__length1; PinInst* _tmp8_; WireInst** _tmp9_; gint _tmp9__length1; WireInst* _tmp10_; _tmp3_ = connection; _tmp4_ = connection_get_wireInst (_tmp3_); _tmp5_ = _tmp4_; _tmp6_ = componentInst; _tmp7_ = _tmp6_->pinInsts; _tmp7__length1 = _tmp6_->pinInsts_length1; _tmp8_ = _tmp7_[0]; _tmp9_ = _tmp8_->wireInsts; _tmp9__length1 = _tmp8_->wireInsts_length1; _tmp10_ = _tmp9_[0]; if (_tmp5_ == _tmp10_) { Connection* _tmp11_; Connection* _tmp12_; _tmp11_ = connection; _tmp12_ = _connection_ref0 (_tmp11_); _connection_unref0 (outputWire); outputWire = _tmp12_; } _connection_unref0 (connection); } } } { ComponentInst* _tmp13_; PropertySet* _tmp14_; gint _tmp15_ = 0; gint _tmp16_; _tmp13_ = componentInst; _tmp14_ = _tmp13_->configuration; _tmp15_ = property_item_int_get_data_throw (_tmp14_, "On For", &_inner_error_); _tmp16_ = _tmp15_; if (_inner_error_ != NULL) { goto __catch18_g_error; } onFor = _tmp16_; } goto __finally18; __catch18_g_error: { g_clear_error (&_inner_error_); _inner_error_ = NULL; onFor = 25; } __finally18: if (_inner_error_ != NULL) { _connection_unref0 (outputWire); g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); return; } { ComponentInst* _tmp17_; PropertySet* _tmp18_; gint _tmp19_ = 0; gint _tmp20_; _tmp17_ = componentInst; _tmp18_ = _tmp17_->configuration; _tmp19_ = property_item_int_get_data_throw (_tmp18_, "Off For", &_inner_error_); _tmp20_ = _tmp19_; if (_inner_error_ != NULL) { goto __catch19_g_error; } offFor = _tmp20_; } goto __finally19; __catch19_g_error: { g_clear_error (&_inner_error_); _inner_error_ = NULL; offFor = 25; } __finally19: if (_inner_error_ != NULL) { _connection_unref0 (outputWire); g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); return; } _tmp21_ = onFor; if (_tmp21_ < 1) { onFor = 1; } _tmp22_ = offFor; if (_tmp22_ < 1) { offFor = 1; } _tmp23_ = outputWire; _tmp24_ = onFor; _tmp25_ = offFor; _tmp26_ = ancestry; _tmp26__length1 = ancestry_length1; _tmp27_ = componentInst; _tmp28_ = clock_component_state_new (_tmp23_, _tmp24_, _tmp25_, _tmp26_, _tmp26__length1, _tmp27_); componentState = (ComponentState*) _tmp28_; _tmp29_ = compiledCircuit; compiled_circuit_add_component (_tmp29_, componentState); _component_state_unref0 (componentState); _connection_unref0 (outputWire); }
static void clock_component_def_real_save_properties (ComponentDef* base, xmlTextWriter* xmlWriter, PropertySet* configurationProperty) { ClockComponentDef * self; gint onFor = 0; gint offFor = 0; xmlTextWriter* _tmp6_; gint _tmp7_; gchar* _tmp8_ = NULL; gchar* _tmp9_; xmlTextWriter* _tmp10_; gint _tmp11_; gchar* _tmp12_ = NULL; gchar* _tmp13_; GError * _inner_error_ = NULL; self = (ClockComponentDef*) base; g_return_if_fail (xmlWriter != NULL); g_return_if_fail (configurationProperty != NULL); { PropertySet* _tmp0_; gint _tmp1_ = 0; gint _tmp2_; _tmp0_ = configurationProperty; _tmp1_ = property_item_int_get_data_throw (_tmp0_, "On For", &_inner_error_); _tmp2_ = _tmp1_; if (_inner_error_ != NULL) { goto __catch16_g_error; } onFor = _tmp2_; } goto __finally16; __catch16_g_error: { g_clear_error (&_inner_error_); _inner_error_ = NULL; onFor = 25; } __finally16: if (_inner_error_ != NULL) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); return; } { PropertySet* _tmp3_; gint _tmp4_ = 0; gint _tmp5_; _tmp3_ = configurationProperty; _tmp4_ = property_item_int_get_data_throw (_tmp3_, "Off For", &_inner_error_); _tmp5_ = _tmp4_; if (_inner_error_ != NULL) { goto __catch17_g_error; } offFor = _tmp5_; } goto __finally17; __catch17_g_error: { g_clear_error (&_inner_error_); _inner_error_ = NULL; offFor = 25; } __finally17: if (_inner_error_ != NULL) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); return; } _tmp6_ = xmlWriter; _tmp7_ = onFor; _tmp8_ = g_strdup_printf ("%i", _tmp7_); _tmp9_ = _tmp8_; xmlTextWriterWriteAttribute (_tmp6_, "on", _tmp9_); _g_free0 (_tmp9_); _tmp10_ = xmlWriter; _tmp11_ = offFor; _tmp12_ = g_strdup_printf ("%i", _tmp11_); _tmp13_ = _tmp12_; xmlTextWriterWriteAttribute (_tmp10_, "off", _tmp13_); _g_free0 (_tmp13_); }
static void clock_component_def_real_add_properties (ComponentDef* base, PropertySet* queryProperty, PropertySet* configurationProperty) { ClockComponentDef * self; gint onFor = 0; gint offFor = 0; PropertySet* _tmp3_; gint _tmp4_; gint _tmp5_; PropertyItemInt* _tmp6_; PropertyItemInt* _tmp7_; PropertySet* _tmp11_; gint _tmp12_; gint _tmp13_; PropertyItemInt* _tmp14_; PropertyItemInt* _tmp15_; GError * _inner_error_ = NULL; self = (ClockComponentDef*) base; g_return_if_fail (queryProperty != NULL); g_return_if_fail (configurationProperty != NULL); { PropertySet* _tmp0_; gint _tmp1_ = 0; gint _tmp2_; _tmp0_ = configurationProperty; _tmp1_ = property_item_int_get_data_throw (_tmp0_, "On For", &_inner_error_); _tmp2_ = _tmp1_; if (_inner_error_ != NULL) { goto __catch14_g_error; } onFor = _tmp2_; } goto __finally14; __catch14_g_error: { g_clear_error (&_inner_error_); _inner_error_ = NULL; onFor = 25; } __finally14: if (_inner_error_ != NULL) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); return; } _tmp3_ = queryProperty; _tmp4_ = onFor; _tmp5_ = G_MAXINT; _tmp6_ = property_item_int_new ("On For", "Duration which clock is on.", _tmp4_, 1, _tmp5_); _tmp7_ = _tmp6_; property_set_add_item (_tmp3_, (PropertyItem*) _tmp7_); _property_item_unref0 (_tmp7_); { PropertySet* _tmp8_; gint _tmp9_ = 0; gint _tmp10_; _tmp8_ = configurationProperty; _tmp9_ = property_item_int_get_data_throw (_tmp8_, "Off For", &_inner_error_); _tmp10_ = _tmp9_; if (_inner_error_ != NULL) { goto __catch15_g_error; } offFor = _tmp10_; } goto __finally15; __catch15_g_error: { g_clear_error (&_inner_error_); _inner_error_ = NULL; offFor = 25; } __finally15: if (_inner_error_ != NULL) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); return; } _tmp11_ = queryProperty; _tmp12_ = offFor; _tmp13_ = G_MAXINT; _tmp14_ = property_item_int_new ("Off For", "Duration which clock is off.", _tmp12_, 1, _tmp13_); _tmp15_ = _tmp14_; property_set_add_item (_tmp11_, (PropertyItem*) _tmp15_); _property_item_unref0 (_tmp15_); }