Index: vtcross/trunk/src/main_cbr.c
===================================================================
--- vtcross/trunk/src/main_cbr.c	(revision 28)
+++ vtcross/trunk/src/main_cbr.c	(revision 31)
@@ -6,23 +6,10 @@
 #include "cbr.h"
 
-int main() {
+int main(int argc, char **argv) {
+    
     unsigned int num_cols = 7; 
     unsigned int i;
 
-    ezxml_t f1 = ezxml_parse_file("another.xml"), engine, column;
-    char * cols[num_cols];
-    
-    for (engine = ezxml_child(f1, "engine"); engine; engine = engine->next){
-        i = 0;
-        for (column = ezxml_child(engine, "column"); column; column = column->next){
-            cols[i] = ezxml_child(column, "name")->txt;
-            i++;
-        }
-    }
-
-
-    free(f1);
-                            
-    /* char * cols[] = {
+    /*char * cols[] = {
         "BER", "throughput",
         "mod_scheme", "tx_power",
@@ -31,4 +18,108 @@
     };*/
     
+    const char * xmlfilename;
+    if (argc == 1){
+        printf("wrong! please specify xml file as parameter.\n");
+        return 0;
+    } else {
+        xmlfilename = argv[1];
+    }
+
+    ezxml_t f2 = ezxml_parse_file(xmlfilename), engine2;
+    ezxml_t utilities, utility;
+    ezxml_t parameters, parameter, affect;
+    ezxml_t observables, observable;
+    const char *enginename, *enginefilename;
+    const char *utilityname[10], *utilityunits[10], *utilitygoal[10], *utilitytarget[10];
+    const char *parametername[10], *parameterunits[10], *parametermin[10], *parametermax[10], *parameterstep[10];
+    const char *affectutility_p[10], *affectrelationship_p[10];
+    const char *observablename[10];
+    const char *affectutility_o[10], *affectrelationship_o[10];
+
+    unsigned int i_u;
+    unsigned int i_p, i_pa;
+    unsigned int i_o, i_oa;
+
+    for (engine2 = ezxml_child(f2, "engine"); engine2; engine2 = engine2->next){
+        // get engine name
+        enginename = ezxml_attr(engine2, "name");
+
+        // get engine file name
+        enginefilename = ezxml_attr(engine2, "filename");
+        //printf("engine name: %s, engine file name: %s\n", enginename, enginefilename);
+        
+        // get utilities
+        utilities = ezxml_child(engine2, "utilities");
+        i_u = 0;    // index for utilities
+        //printf("utilities: ");
+        for (utility = ezxml_child(utilities, "utility"); utility; utility = utility->next){
+            utilityname[i_u] = ezxml_attr(utility, "name");
+            utilityunits[i_u] = ezxml_attr(utility, "units");
+            utilitygoal[i_u] = ezxml_attr(utility, "goal");
+            utilitytarget[i_u] = ezxml_attr(utility, "target");
+            //printf(" %s", utilityname[i_u]);
+            i_u++;
+        }
+        //printf("\n");
+        //printf("number of utilities: %d\n", i_u);
+
+        // get parameters
+        parameters = ezxml_child(engine2, "parameters");
+        i_p = 0;    // index for parameters
+        i_pa = 0;   // index for affect
+        //printf("parameters: ");
+        for (parameter = ezxml_child(parameters, "parameter"); parameter; parameter = parameter->next){
+            parametername[i_p] = ezxml_attr(parameter, "name");
+            parameterunits[i_p] = ezxml_attr(parameter, "units");
+            parametermin[i_p] = ezxml_attr(parameter, "min");
+            parametermax[i_p] = ezxml_attr(parameter, "max");
+            parameterstep[i_p] = ezxml_attr(parameter, "step");
+            //printf(" %s", parametername[i_p]);
+            i_p++;
+            for (affect = ezxml_child(parameter, "affect"); affect; affect = affect->next){
+                affectutility_p[i_pa] = ezxml_attr(affect, "utility");
+                affectrelationship_p[i_pa] = ezxml_attr(affect, "relationship");
+                i_pa++;
+            }
+        }
+        //printf("\n");
+        //printf("number of parameters: %d\n", i_p);
+        //printf("number of affects: %d\n", i_pa);
+
+        // get observables
+        observables = ezxml_child(engine2, "observables");
+        i_o = 0;    // index for observables
+        i_oa = 0;   // index for affect
+        //printf("observables: ");
+        for (observable = ezxml_child(observables, "observable"); observable; observable = observable->next){
+            observablename[i_o] = ezxml_attr(observable, "name");
+            //printf(" %s", observablename[i_o]);
+            i_o++;
+            for (affect = ezxml_child(observable, "affect"); affect; affect = affect->next){
+                affectutility_o[i_oa] = ezxml_attr(affect, "utility");
+                affectrelationship_o[i_oa] = ezxml_attr(affect, "relationship");
+                i_oa++;
+            }
+        }
+        //printf("\n");
+        //printf("number of observables: %d\n", i_o);
+        //printf("number of affects: %d\n", i_oa);
+    }
+
+    free(f2);
+    
+    char * cols[num_cols];
+    for (i = 0; i < i_u; i++){
+        cols[i] = utilityname[i];
+    }
+    for (; i < i_u+i_p; i++){
+        cols[i] = parametername[i-i_u];
+    }
+    for (; i < i_u+i_p+i_o; i++){
+        cols[i] = observablename[i-i_u-i_p];
+    }
+   
+    
+    printf("column names:");
     for (i = 0; i<num_cols; i++){
         printf(" %s",cols[i]);
