static GSList * get_connections (NMSystemConfigInterface *config) { SCPluginIfcfg *plugin = SC_PLUGIN_IFCFG (config); SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (plugin); GSList *list = NULL; GHashTableIter iter; NMIfcfgConnection *connection; if (!priv->initialized) { if (nm_config_get_monitor_connection_files (nm_config_get ())) setup_ifcfg_monitoring (plugin); read_connections (plugin); priv->initialized = TRUE; } g_hash_table_iter_init (&iter, priv->connections); while (g_hash_table_iter_next (&iter, NULL, (gpointer) &connection)) { if ( !nm_ifcfg_connection_get_unmanaged_spec (connection) && !nm_ifcfg_connection_get_unrecognized_spec (connection)) list = g_slist_prepend (list, connection); } return list; }
static void reload_connections (NMSystemConfigInterface *config) { SCPluginIfcfg *plugin = SC_PLUGIN_IFCFG (config); read_connections (plugin); }
object hydrator::read_object() { validate_current_element(dia_object); object object; object.type(read_xml_string_attribute(dia_type)); object.version(read_xml_int_attribute(dia_version)); object.id(read_xml_string_attribute(dia_id)); BOOST_LOG_SEV(lg, debug) << "Reading object: '" << object.id() << "' of type: " << object.type(); if (!reader_.read()) { BOOST_LOG_SEV(lg, error) << unexpected_eod; BOOST_THROW_EXCEPTION(hydration_error(unexpected_eod)); } std::vector<attribute> attributes; do { if (is_start_element(dia_attribute)) attributes.push_back(read_attribute()); else if (is_start_element(dia_child_node)) object.child_node(read_child_node()); else if (is_start_element(dia_connections)) { object.connections(read_connections()); } else { BOOST_LOG_SEV(lg, warn) << "Skipping element: '" << reader_.name(); reader_.skip(); } } while (!is_end_element(dia_object)); reader_.read(); object.attributes(attributes); BOOST_LOG_SEV(lg, debug) << "Read object: " << object.id(); return object; }
polygon_connection_attribute_array *read_connection_attribute_array(char *filename,short print) { /*! * * \author Emanuele Cordano * \author May 2008 * *\param (char*) - name of filename *\param (short) - * *\brief It creates and reads a polygonvector from the following options: */ polygon_connection_attribute_array *pca; FILE *fd; long j,n_po; fd=t_fopen(filename,"r"); n_po=(long)read_index(fd,no_PRINT); pca=new_connection_attributes(n_po); for (j=pca->nl;j<=pca->nh;j++) { pca->element[j]=read_connections(fd,print); // if (pca->element[j]->index!=j) printf ("Error in read_connection_attributes (polygon %ld) inconstancy: %ld %ld \n",j,j,pca->element[j]->index); } t_fclose(fd); if (print==1) printf("Function read_connection_attributes (number of polygons %ld) was successfully executed!!",pca->nh); return pca; }
// Read the spef data for the next net. // Return value indicates if the last read was successful or not. bool SpefParser::read_net_data (SpefNet& spefNet) { spefNet.clear() ; vector<string> tokens ; bool valid = read_line_as_tokens (is, tokens, true /*include special chars*/) ; // Read until a valid D_NET line is found while (valid) { if (tokens.size() == 4 && tokens[0] == "*" && tokens[1] == "D_NET") { spefNet.netName = tokens[2] ; spefNet.netLumpedCap = std::atof(tokens[3].c_str()) ; bool readConns = read_connections (spefNet.connections) ; if (readConns) { read_capacitances (spefNet.capacitances) ; read_resistances (spefNet.resistances) ; } return true ; } valid = read_line_as_tokens (is, tokens, true /*include special chars*/) ; } return false ; // a valid net was not read }
static void reload_connections (NMSettingsPlugin *config) { SettingsPluginIfcfg *plugin = SETTINGS_PLUGIN_IFCFG (config); read_connections (plugin); }
static gboolean read_connections_cb (gpointer data) { BMA_GCONF_SETTINGS_GET_PRIVATE (data)->read_connections_id = 0; read_connections (BMA_GCONF_SETTINGS (data)); return FALSE; }
static GSList * get_connections (NMSystemConfigInterface *config) { SCPluginKeyfilePrivate *priv = SC_PLUGIN_KEYFILE_GET_PRIVATE (config); if (!priv->initialized) { setup_monitoring (config); read_connections (config); priv->initialized = TRUE; } return _nm_utils_hash_values_to_slist (priv->connections); }
static GSList * list_connections (BMSettingsService *settings) { BMAGConfSettingsPrivate *priv = BMA_GCONF_SETTINGS_GET_PRIVATE (settings); if (priv->read_connections_id) { g_source_remove (priv->read_connections_id); priv->read_connections_id = 0; read_connections (BMA_GCONF_SETTINGS (settings)); } return g_slist_copy (priv->connections); }
/* Load all of the config filse */ gboolean load_remote_configs(tclient_c *tclient) { if(!read_types(tclient)) return FALSE; if(!read_connections(tclient)) return FALSE; if(!read_settings(tclient)) return FALSE; return TRUE; }
static GSList * get_connections (NMSettingsPlugin *config) { SettingsPluginIbft *self = SETTINGS_PLUGIN_IBFT (config); SettingsPluginIbftPrivate *priv = SETTINGS_PLUGIN_IBFT_GET_PRIVATE (self); GSList *list = NULL; GHashTableIter iter; NMIbftConnection *connection; if (!priv->initialized) { read_connections (self); priv->initialized = TRUE; } g_hash_table_iter_init (&iter, priv->connections); while (g_hash_table_iter_next (&iter, NULL, (gpointer) &connection)) list = g_slist_prepend (list, connection); return list; }
static void read_connections(GList *objects, xmlNodePtr layer_node, GHashTable *objects_hash) { ObjectNode obj_node; GList *list; xmlNodePtr connections; xmlNodePtr connection; char *handlestr; char *tostr; char *connstr; int handle, conn; DiaObject *to; list = objects; obj_node = layer_node->xmlChildrenNode; while ((list != NULL) && (obj_node != NULL)) { DiaObject *obj = (DiaObject *) list->data; /* the obj and there node must stay in sync to properly setup connections */ while (obj_node && (xmlIsBlankNode(obj_node) || XML_COMMENT_NODE == obj_node->type)) obj_node = obj_node->next; if (!obj_node) break; if IS_GROUP(obj) { read_connections(group_objects(obj), obj_node, objects_hash); } else { gboolean broken = FALSE; /* an invalid bounding box is a good sign for some need of corrections */ gboolean wants_update = obj->bounding_box.right >= obj->bounding_box.left || obj->bounding_box.top >= obj->bounding_box.bottom; connections = obj_node->xmlChildrenNode; while ((connections!=NULL) && (xmlStrcmp(connections->name, (const xmlChar *)"connections")!=0)) connections = connections->next; if (connections != NULL) { connection = connections->xmlChildrenNode; while (connection != NULL) { char *donestr; if (xmlIsBlankNode(connection)) { connection = connection->next; continue; } handlestr = (char * )xmlGetProp(connection, (const xmlChar *)"handle"); tostr = (char *) xmlGetProp(connection, (const xmlChar *)"to"); connstr = (char *) xmlGetProp(connection, (const xmlChar *)"connection"); handle = atoi(handlestr); conn = strtol(connstr, &donestr, 10); if (*donestr != '\0') { /* Didn't convert it all -- use string */ conn = -1; } to = g_hash_table_lookup(objects_hash, tostr); if (to == NULL) { message_error(_("Error loading diagram.\n" "Linked object not found in document.")); broken = TRUE; } else if (handle < 0 || handle >= obj->num_handles) { message_error(_("Error loading diagram.\n" "Connection handle %d does not exist on '%s'."), handle, to->type->name); broken = TRUE; } else { if (conn >= 0 && conn < to->num_connections) { object_connect(obj, obj->handles[handle], to->connections[conn]); /* force an update on the connection, helpful with (incomplete) generated files */ if (wants_update) { #if 0 obj->ops->move_handle(obj, obj->handles[handle], &to->connections[conn]->pos, to->connections[conn], HANDLE_MOVE_CONNECTED,0); #endif } } else { message_error(_("Error loading diagram.\n" "Connection point %d does not exist on '%s'."), conn, to->type->name); broken = TRUE; } } if (handlestr) xmlFree(handlestr); if (tostr) xmlFree(tostr); if (connstr) xmlFree(connstr); connection = connection->next; } /* Fix positions of the connection object for (de)generated files. * Only done for the last point connected otherwise the intermediate posisitions * may screw the auto-routing algorithm. */ if (!broken && obj && obj->ops->set_props && wants_update) { /* called for it's side-effect of update_data */ obj->ops->move(obj,&obj->position); for (handle = 0; handle < obj->num_handles; ++handle) { if (obj->handles[handle]->connected_to) obj->ops->move_handle(obj, obj->handles[handle], &obj->handles[handle]->pos, obj->handles[handle]->connected_to, HANDLE_MOVE_CONNECTED,0); } } } } /* Now set up parent relationships. */ connections = obj_node->xmlChildrenNode; while ((connections!=NULL) && (xmlStrcmp(connections->name, (const xmlChar *)"childnode")!=0)) connections = connections->next; if (connections != NULL) { tostr = (char *)xmlGetProp(connections, (const xmlChar *)"parent"); if (tostr) { obj->parent = g_hash_table_lookup(objects_hash, tostr); if (obj->parent == NULL) { message_error(_("Can't find parent %s of %s object\n"), tostr, obj->type->name); } else { obj->parent->children = g_list_prepend(obj->parent->children, obj); } } } list = g_list_next(list); obj_node = obj_node->next; }
static void reload_connections (NMSystemConfigInterface *config) { read_connections (config); }
void read_connections(GList *objects, xmlNodePtr layer_node, GHashTable *objects_hash) { ObjectNode obj_node; GList *list; xmlNodePtr connections; xmlNodePtr connection; char *handlestr; char *tostr; char *connstr; int handle, conn; Object *to; list = objects; obj_node = layer_node->childs; while (list != NULL) { Object *obj = (Object *) list->data; if IS_GROUP(obj) { read_connections(group_objects(obj), obj_node, objects_hash); } else { connections = obj_node->childs; while ((connections!=NULL) && (strcmp(connections->name, "connections")!=0)) connections = connections->next; if (connections != NULL) { connection = connections->childs; while (connection != NULL) { handlestr = xmlGetProp(connection, "handle"); tostr = xmlGetProp(connection, "to"); connstr = xmlGetProp(connection, "connection"); handle = atoi(handlestr); conn = atoi(connstr); to = g_hash_table_lookup(objects_hash, tostr); if (handlestr) free(handlestr); if (connstr) free(connstr); if (tostr) free(tostr); if (to == NULL) { message_error(_("Error loading diagram.\n" "Linked object not found in document.")); } else if (conn >= 0 && conn >= to->num_connections) { message_error(_("Error loading diagram.\n" "connection point does not exist.")); } else if (handle >= 0 && handle >= obj->num_handles) { message_error(_("Error loading diagram.\n" "connection handle does not exist.")); } else { object_connect(obj, obj->handles[handle], to->connections[conn]); } connection = connection->next; } } } list = g_list_next(list); obj_node = obj_node->next; }