Ejemplo n.º 1
0
void initWay(WAY * way){
  int num = way->num;
  for(int i = 0; i < N - num; i++){
    way->tau[i] = defaultTau;
  }
  for(int i = 0; i < N - num; i++){
    initWay(way->next[i]);
  } 
}
Ejemplo n.º 2
0
Way* parseWay (xmlDocPtr doc, xmlNodePtr cur, Tag** refTag){
	Way* w = NULL;
	unsigned long id = -1;
	char *visible = "T";
	ListNode* ln = initListNode(0);
	Tag* tag = NULL;
	Tag* t = NULL;
	int size = 0;
	char* name = NULL;

	xmlAttr *node_attr = cur->properties;
	xmlNodePtr tmpcur = NULL;

	while(node_attr != NULL){
		if( xmlStrcmp(node_attr->name,(const xmlChar *)"id")==0 ){
			id = strtoul((const char *)((node_attr->children)->content),NULL,0);
		}
		else if( xmlStrcmp(node_attr->name,(const xmlChar *)"visible")==0  ){
			visible = (char *)((node_attr->children)->content);
		}
		node_attr = node_attr->next;
	}
	tmpcur = cur->xmlChildrenNode;

	while(tmpcur != NULL){
		if (tmpcur->type == XML_ELEMENT_NODE) {
			if( xmlStrcmp(tmpcur->name,(const xmlChar *)"tag")==0){
				t=goodTag((char *)xmlGetProp(tmpcur, (const xmlChar *)"k"),(char *) xmlGetProp(tmpcur, (const xmlChar *)"v"), refTag);
				if( xmlStrcmp( (const xmlChar *) xmlGetProp( tmpcur, (const xmlChar *)"k" ), (const xmlChar *)"name" ) ==0){
					name = (char *) xmlGetProp(tmpcur, (const xmlChar *)"v");
				}
				if((t != NULL && tag == NULL) ||  ( t != NULL && tag != NULL && (t->priority>tag->priority))){
					tag = t;
				}
			}
			if( xmlStrcmp(tmpcur->name,(const xmlChar *)"nd")==0 ){
				ln=addRefListNode(strtoul((const char *)(xmlGetProp(tmpcur, (const xmlChar *)"ref")),NULL,0), ln);
				size++;
			}
		}
		tmpcur = tmpcur->next;
	}
	if(tag != NULL){
		w = initWay(id,visible,ln,tag,size,name);
		return w;
	}
	else{
		return NULL;
	}
}
Ejemplo n.º 3
0
void initACO(WAY * way){
  initWay(way);
  if(!isAlloced) allocAnts();
  initAnts();
  printf("initialized\n");
}