Logo Search packages:      
Sourcecode: tablix2 version File versions  Download package

void parser_gettable ( table tab  ) 

Loads definitions of variable resources for all events in the XML tree to a table struct.

tab Pointer to the table struct.

Definition at line 916 of file xmlsup.c.

References table_t::chr, config, dat_restype, dat_typenum, error(), fatal(), table_t::fitness, chromo_t::gen, parser_event_get_res(), parser_getprop_int(), resource_t::resid, and resourcetype_t::var.

{
        xmlNodePtr cur, root;
      xmlNodePtr events=NULL;
      int tupleid, repeats;

      int fitness;
      int n;

      char *temp;

      resourcetype *restype;
      resource *res;

      assert(tab!=NULL);

        root=xmlDocGetRootElement(config);

      temp=xmlGetProp(root, "fitness");
      if(temp==NULL) error(_("This file does not seem to contain a solution"));
      free(temp);
      
      fitness=parser_getprop_int(root, "fitness");

        cur=root->children;
        while (cur!=NULL) {
                if (!strcmp(cur->name, "events")) events=cur;
                cur=cur->next;
        }

      assert(events!=NULL);

        cur=events->children;
        while (cur!=NULL) {
                if (!strcmp(cur->name, "event")) {
                  tupleid=parser_getprop_int(cur, "tupleid");
                  repeats=parser_getprop_int(cur, "repeats");

                  if(repeats!=1) {
                        fatal(_("Configuration file does not contain"
                              "a complete solution"));
                  }

                  for(n=0;n<dat_typenum;n++) {
                        restype=&dat_restype[n];

                        if(!restype->var) continue;

                        res=parser_event_get_res(cur, restype);

                        if(res==NULL) {   
                              fatal(_("Configuration file does not"
                                    "contain a complete solution"));
                        }

                        tab->chr[n].gen[tupleid]=res->resid;
                  }
                }
                cur=cur->next;
        }

      tab->fitness=fitness;
}


Generated by  Doxygen 1.6.0   Back to index