Ignore:
Timestamp:
Sep 14, 2010, 2:04:55 PM (14 years ago)
Author:
djay
Message:

Update of both ZOO Kernel and ZOO Services (ogr base-vect-ops ServicesProvider?).
All the ZCFG files have been corrected to remove all references to wrong metadata (Test = Demo) to avoid validation issues.
Main Memory leaks has been removed from this version.
Addition of the Simplify Service in the C ogr base-vect-ops ServicesProvider? and addition of the Python version (without Simplify).
Update of the configure.ac and Makefile.in to follow dicussions on the mailing list and ensure to use our cgic206 and not another one, path to our cgic library is now directly in the Makefile.in file.
Accept the "-" character to name inputs, to solve issue on GRASS 7 integration.
Addition of the extension keyword for ZCFG file to be able to store resulting outputs in a file name using the extension suffix.
This version after a testing period shall be considerate as 1.0.1 version of the ZOO Project.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-kernel/service_conf.y

    r1 r9  
    1313#include <ctype.h>
    1414#include <service.h>
    15 #include <vector>
     15  //#include <vector>
    1616
    1717static int tmp_count=1;
     
    6565// srlex
    6666extern int srlex(void);
    67 
    68 vector<char*> lattribute;
     67extern int srlex_destroy(void);
     68
     69//vector<char*> lattribute;
    6970
    7071%}
     
    132133 : STag contentetoile ETag     
    133134{
    134   if (strcmp($1,$3) != 0)
     135  /*if (strcasecmp($1,$3) != 0)
    135136    {
    136       //srerror("Opening and ending tag mismatch");
    137137      fprintf(stderr,"Opening and ending tag mismatch\n  ::details : tag '%s' et '%s' \n",$1,$3);
    138       lattribute.clear();
     138      //lattribute.clear();
    139139      //return 1;
    140     }
     140      }*/
     141  free($3);
    141142}
    142143// pour neutre
     
    159160  /* parce que cet element est reconnu AVANT la balise fermante */
    160161  /* et APRES l'analyse des eventuelles balises internes ou successeur */
    161   lattribute.clear();
    162        
     162  //lattribute.clear();
     163
    163164  if(my_service->content==NULL){
    164165#ifdef DEBUG_SERVICE_CONF
    165166    fprintf(stderr,"NO CONTENT\n");
    166167#endif
    167     //addMapToMap(&my_service->content,current_content);
    168     //freeMap(&current_content);
    169     my_service->content=current_content;
     168    addMapToMap(&my_service->content,current_content);
     169    freeMap(&current_content);
     170    free(current_content);
    170171    current_content=NULL;
    171172    my_service->metadata=NULL;
     
    173174  }
    174175
    175   if(strcmp($2,"DataInputs")==0){
     176  if(strncasecmp($2,"DataInputs",10)==0){
    176177    if(wait_mainmetadata==true){
    177       if(my_service->metadata==NULL)
    178         my_service->metadata=current_content;
    179       else{
    180         addMapToMap(&my_service->metadata,current_content);
    181         freeMap(&current_content);
    182       }
     178      addMapToMap(&my_service->metadata,current_content);
     179      freeMap(&current_content);
     180      free(current_content);
    183181      current_content=NULL;
    184182    }
     
    208206  }
    209207  else
    210     if(strcmp($2,"DataOutputs")==0){
     208    if(strncasecmp($2,"DataOutputs",11)==0){
    211209      if(wait_inputs==true){
    212210#ifdef DEBUG_SERVICE_CONF
    213211        fprintf(stderr,"(DATAOUTPUTS) DUP INPUTS current_element\n");
    214 #endif
    215         if(my_service->inputs==NULL)
     212        fprintf(stderr,"CURRENT_ELEMENT\n");
     213        dumpElements(current_element);
     214        fprintf(stderr,"SERVICE INPUTS\n");
     215        dumpElements(my_service->inputs);
     216        dumpService(my_service);
     217#endif
     218        if(my_service->inputs==NULL){
    216219          my_service->inputs=dupElements(current_element);
     220          my_service->inputs->next=NULL;
     221        }
    217222        else
    218           addToElements(my_service->inputs,current_element);
    219 #ifdef DEBUG_SERVICE_CONF
     223          addToElements(&my_service->inputs,current_element);
     224#ifdef DEBUG_SERVICE_CONF
     225        fprintf(stderr,"CURRENT_ELEMENT\n");
    220226        dumpElements(current_element);
     227        fprintf(stderr,"SERVICE INPUTS\n");
    221228        dumpElements(my_service->inputs);
    222229        fprintf(stderr,"(DATAOUTPUTS) FREE current_element\n");
     
    245252    }
    246253    else
    247       if(strcmp($2,"MetaData")==0){
     254      if(strncasecmp($2,"MetaData",8)==0){
    248255        current_data=3;
    249256        if(current_element!=NULL){
     
    263270      }
    264271      else
    265         if(strcmp($2,"ComplexData")==0 || strcmp($2,"LiteralData")==0
    266         || strcmp($2,"ComplexOutput")==0 || strcmp($2,"LiteralOutput")==0){
     272        if(strncasecmp($2,"ComplexData",11)==0 || strncasecmp($2,"LiteralData",10)==0
     273           || strncasecmp($2,"ComplexOutput",13)==0 || strncasecmp($2,"LiteralOutput",12)==0){
    267274          current_data=4;
    268275          if(wait_metadata==true){
    269276            if(current_content!=NULL){
    270               current_element->metadata=current_content;
     277              addMapToMap(&current_element->metadata,current_content);
    271278              current_element->next=NULL;
    272279              current_element->format=$2;
    273280              current_element->defaults=NULL;
     281              current_element->supported=NULL;
     282              freeMap(&current_content);
     283              free(current_content);
    274284            }
    275           }else{ // No MainMetaData
    276             //addMapToMap(&current_element->content,current_content);
    277             //freeMap(&current_content);
    278             //free(current_content);
    279             current_element->content=current_content;
     285          }else{
     286            // No MainMetaData
     287            addMapToMap(&current_element->content,current_content);
     288            freeMap(&current_content);
     289            free(current_content);
    280290            current_element->metadata=NULL;
    281291            current_element->next=NULL;
    282292            current_element->format=$2;
    283293            current_element->defaults=NULL;
     294            current_element->supported=NULL;
    284295          }
    285296          current_content=NULL;
     
    287298        }
    288299        else
    289           if(strcmp($2,"Default")==0){
     300          if(strncasecmp($2,"Default",7)==0){
    290301            wait_defaults=true;
    291302            current_data=5;
    292303          }
    293304          else
    294             if(strcmp($2,"Supported")==0){
     305            if(strncasecmp($2,"Supported",9)==0){
    295306              wait_supporteds=true;
    296307              if(wait_defaults==true){
     
    304315  printf("* Identifiant : %s\n",$2);
    305316#endif
    306                
    307317  /* et on renvoie l'identifiant de balise afin de pouvoir le comparer */
    308318  /* avec la balise jumelle fermante ! */
    309319  $$ = $2 ;
     320  /*if($2!=NULL)
     321    free($2);*/
    310322}
    311323 ;
     
    338350  printf ("attribute : %s\n",$1) ;
    339351#endif
    340   for(int i=0;i < lattribute.size(); i++)
     352  /*for(int i=0;i < lattribute.size(); i++)
    341353    {
    342354      if (strcmp($1,lattribute.at(i)) == 0)
    343355        {
    344356          fprintf (stderr,"attributs identiques : %d -- %s , %s",i,lattribute.at(i),$1) ;
    345           //srerror("attribut redondant !:");
    346357        }
    347358    }
    348   lattribute.push_back($1);
     359    lattribute.push_back($1);*/
     360  free($1);
    349361}
    350362 ;
     
    359371//======================================================
    360372EmptyElemTag
    361  : INFCAR ID Attributeetoile SLASH SUPCAR       {lattribute.clear();/* voir Stag */}
     373 : INFCAR ID Attributeetoile SLASH SUPCAR       {/*lattribute.clear();/* voir Stag */}
    362374 ;
    363375//======================================================
     
    387399    current_data=previous_data;
    388400    if(current_element->defaults==NULL){
    389       current_element->defaults=(iotype*)malloc(MAP_SIZE);
    390     }
    391     current_element->defaults->content=current_content;
     401      current_element->defaults=(iotype*)malloc(IOTYPE_SIZE);
     402      current_element->defaults->content=NULL;
     403    }
     404    addMapToMap(&current_element->defaults->content,current_content);
     405    freeMap(&current_content);
     406    free(current_content);
    392407    current_element->defaults->next=NULL;
    393408    wait_defaults=false;
     
    398413    current_data=previous_data;
    399414    if(current_element->supported==NULL){
    400       current_element->supported=(iotype*)malloc(MAP_SIZE);
    401       current_element->supported->content=current_content;
     415      //addMapToIoType(&current_element->supported,current_content);
     416      current_element->supported=(iotype*)malloc(IOTYPE_SIZE);
     417      current_element->supported->content=NULL;
     418      addMapToMap(&current_element->supported->content,current_content);
     419      freeMap(&current_content);
     420      free(current_content);
    402421      current_element->supported->next=NULL;
    403       /**
    404        * Need to free this ressource (HERE ?)
     422      current_content=NULL;
     423    }
     424    else{
     425#ifdef DEBUG
     426      // Currently we support only one supported format
     427      fprintf(stderr,"SECOND SUPPORTED FORMAT !!!!\n");
     428#endif
     429      //addMapToIoType(&current_element->supported,current_content);
     430      /*iotype* iotmp=*(&current_element->supported);
     431      while(iotmp!=NULL){
     432        dumpMap(iotmp->content);
     433        iotmp=iotmp->next;
     434      }
     435      iotmp=(iotype*)malloc(IOTYPE_SIZE);
     436      iotmp->content=NULL;
     437      addMapToMap(&iotmp->content,current_content);
     438      iotmp->next=NULL;
     439      dumpElements(current_element);
     440      fprintf(stderr,"SECOND SUPPORTED FORMAT MAP START !!!!\n");
     441      dumpMap(current_content);
     442      fprintf(stderr,"SECOND SUPPORTED FORMAT MAP END !!!!\n");*/
     443      freeMap(&current_content);
    405444      free(current_content);
    406       */
    407     }
    408     else{
    409       /*current_element->supported->next=(iotype*)malloc(sizeof(iotype*));
    410       current_element->supported->next->content=NULL;
    411       current_element->supported->next->next=NULL;
    412       iotype* tmp1=current_element->supported;
    413       while(tmp1!=NULL){
    414         addMapToMap(&current_element->supported->next->content,current_content);
    415         freeMap(&current_content);
    416 #ifdef DEBUG_SERVICE_CONF
    417         fprintf(stderr,"LINE 409");
    418 #endif
    419         free(current_content);
    420         current_content=NULL;
    421         tmp1=tmp1->next;
    422         }*/
     445      current_content=NULL;
     446      /*freeMap(&iotmp->content);
     447      free(&iotmp->content);
     448      free(iotype);*/
     449#ifdef DEBUG
     450      // Currently we support only one supported format
     451      fprintf(stderr,"SECOND SUPPORTED FORMAT !!!!\n");
     452#endif
    423453    }
    424454    current_content=NULL;
     
    472502//======================================================
    473503
    474 pair: PAIR {  if(debug) fprintf(stderr,"PAIR FOUND !!\n"); }
     504pair: PAIR {  if(debug) fprintf(stderr,"PAIR FOUND !!\n");if(curr_key!=NULL){free(curr_key);curr_key=NULL;} }
    475505| EPAIR {
    476506#ifdef DEBUG_SERVICE_CONF
     
    495525    dumpMap(current_content);
    496526    fprintf(stderr,"addToMap(current_content,%s,%s) !! \n",curr_key,$1);
    497    
    498 #endif
    499     //map* tmp1=createMap(curr_key,$1);
     527#endif
    500528    addToMap(current_content,curr_key,$1);
    501     //freeMap(&tmp1);
    502     //free(tmp1);
    503529#ifdef DEBUG_SERVICE_CONF
    504530    fprintf(stderr,"addToMap(current_content,%s,%s) end !! \n",curr_key,$1);
    505531#endif   
    506532  }
    507   //free(curr_key);
    508   curr_key=NULL;
    509533#ifdef DEBUG_SERVICE_CONF
    510534  fprintf(stderr,"EPAIR FOUND !! \n");
     
    513537  fflush(stderr);
    514538#endif
    515   }
    516 | SPAIR  { curr_key=$1; if(debug) fprintf(stderr,"SPAIR FOUND !!\n"); }
     539  if(curr_key!=NULL){
     540    free(curr_key);
     541    curr_key=NULL;
     542  }
     543  }
     544| SPAIR  { curr_key=strdup($1);/*free($1);*/if(debug) fprintf(stderr,"SPAIR FOUND !!\n"); }
    517545 ;
    518546
     
    522550  if(data==-1){
    523551    data=1;
    524     my_service->name=$1;
     552    char *cen=strdup($1);
     553    my_service->name=(char*)malloc((strlen(cen)-1)*sizeof(char*));
     554    cen[strlen(cen)-1]=0;
     555    cen+=1;
     556    sprintf(my_service->name,"%s",cen);
     557    cen-=1;
     558    free(cen);
    525559    my_service->content=NULL;
    526560    my_service->metadata=NULL;
     
    530564    if(current_data==1){
    531565      if(my_service->content!=NULL && current_element->name!=NULL){
    532         //fprintf(stderr,"ELEMENT (%s)",current_element->name);
    533566        if(my_service->inputs==NULL){
    534 #ifdef DEBUG_SERVICE_CONF
    535           fprintf(stderr,"count (%i) (%s)\n",tmp_count%2,$1);
    536           fflush(stderr);
    537 #endif
    538           //if(tmp_count==1){
    539 #ifdef DEBUG_SERVICE_CONF
    540           fprintf(stderr,"(DATAINPUTS - 464)DUP current_element\n");
    541           dumpElements(current_element);
    542 #endif
    543567          my_service->inputs=dupElements(current_element);
    544 #ifdef DEBUG_SERVICE_CONF
    545           fprintf(stderr,"(DATAINPUTS - 466)FREE current_element\n");
    546 #endif
    547           freeElements(&current_element);
    548           current_element=NULL;
     568          my_service->inputs->next=NULL;
    549569          tmp_count++;
    550570        }
    551571        else{
    552           addToElements(my_service->inputs,current_element);
    553 #ifdef DEBUG_SERVICE_CONF
    554           fprintf(stderr,"(DATAINPUTS - 6)FREE current_element (after adding to allread existing inputs)");
    555 #endif
    556           freeElements(&current_element);
     572          addToElements(&my_service->inputs,current_element);
    557573        }
    558574#ifdef DEBUG_SERVICE_CONF
     575        fprintf(stderr,"(%s %d)FREE current_element (after adding to allread existing inputs)",__FILE__,__LINE__);
     576        dumpElements(current_element);
     577        fprintf(stderr,"(%s %d)FREE current_element (after adding to allread existing inputs)",__FILE__,__LINE__);
    559578        dumpElements(my_service->inputs);
    560579#endif
     580        freeElements(&current_element);
    561581        free(current_element);
    562582        current_element=NULL;
     
    582602        fprintf(stderr,"(DATAINPUTS - 501) SET NAME OF current_element\n");
    583603#endif
    584         current_element->name=strdup($1);
     604        char *cen=strdup($1);
     605        current_element->name=(char*)malloc((strlen(cen)-1)*sizeof(char*));
     606        cen[strlen(cen)-1]=0;
     607        cen+=1;
     608        sprintf(current_element->name,"%s",cen);
     609        cen-=1;
     610        free(cen);
    585611#ifdef DEBUG_SERVICE_CONF
    586612        fprintf(stderr,"NAME IN %s (current - %s)\n",$1,current_element->name);
     
    604630            if(my_service->inputs==NULL){
    605631              my_service->inputs=dupElements(current_element);
     632              my_service->inputs->next=NULL;
    606633            }
    607634            else{
     
    609636              fprintf(stderr,"LAST NAME IN %s (current - %s)\n",$1,current_element->name);
    610637#endif
    611               addToElements(my_service->inputs,current_element);
     638              addToElements(&my_service->inputs,current_element);
    612639            }
    613640#ifdef DEBUG_SERVICE_CONF
    614641            dumpElements(current_element);
    615             fprintf(stderr,"(DATAOUTPUTS - 531) FREE current_element\n");
     642            fprintf(stderr,"(DATAOUTPUTS) FREE current_element %s %i\n",__FILE__,__LINE__);
    616643#endif
    617644            freeElements(&current_element);
    618             free(&current_element);
    619 #ifdef DEBUG_SERVICE_CONF
    620             fprintf(stderr,"free OUTPUTS\n");
    621 #endif
     645            free(current_element);
    622646            current_element=NULL;
    623647#ifdef DEBUG_SERVICE_CONF
    624             fprintf(stderr,"(DATAOUTPUTS - 536) ALLOCATE current_element\n");
     648            fprintf(stderr,"(DATAOUTPUTS) ALLOCATE current_element %s %i\n",__FILE__,__LINE__);
    625649#endif
    626650            current_element=(elements*)malloc(ELEMENTS_SIZE);
     
    638662            fprintf(stderr,"(DATAOUTPUTS - 545) SET NAME OF current_element\n");
    639663#endif
    640             current_element->name=strdup($1);
     664            char *cen=strdup($1);
     665            current_element->name=(char*)malloc((strlen(cen)-1)*sizeof(char*));
     666            cen[strlen(cen)-1]=0;
     667            cen+=1;
     668            sprintf(current_element->name,"%s",cen);
     669            cen-=1;
     670            free(cen);
    641671            current_element->content=NULL;
    642672            current_element->metadata=NULL;
     
    647677          }
    648678          wait_inputs=false;
     679          dumpMap(current_content);
    649680          current_content=NULL;
    650681        }
     
    655686            fprintf(stderr,"(DATAOUTPUTS - 545) SET NAME OF current_element\n");
    656687#endif
    657             current_element->name=strdup($1);
     688            char *cen=strdup($1);
     689            current_element->name=(char*)malloc((strlen(cen)-1)*sizeof(char*));
     690            cen[strlen(cen)-1]=0;
     691#ifdef DEBUG
     692            fprintf(stderr,"tmp %s\n",cen);
     693#endif
     694            cen+=1;
     695            sprintf(current_element->name,"%s",cen);
     696            cen-=1;
     697            free(cen);
    658698            current_element->content=NULL;
    659699            current_element->metadata=NULL;
     
    726766  if (srin==NULL){
    727767    fprintf(stderr,"error : le fichier specifie n'existe pas ou n'est pas accessible en lecture\n") ;
    728     return 22;
    729   }
    730 
    731   //printf(" ");
     768    return -1;
     769  }
     770
    732771  int resultatYYParse = srparse() ;
    733772 
     
    738777#endif
    739778      my_service->outputs=dupElements(current_element);
     779      my_service->outputs->next=NULL;
     780      freeElements(&current_element);
     781      free(current_element);
    740782      current_element=NULL;
    741783    }
     
    744786      fprintf(stderr,"(DATAOUTPUTS - 628) COPY current_element\n");
    745787#endif
    746       addToElements(my_service->outputs,current_element);
     788      addToElements(&my_service->outputs,current_element);
    747789    }
    748790#ifdef DEBUG_SERVICE_CONF
     
    750792#endif
    751793    freeElements(&current_element);
     794    free(current_element);
     795    current_element=NULL;
    752796  }
    753797  if(current_element!=NULL){
    754798    freeElements(&current_element);
    755799    fprintf(stderr,"LINE 709");
    756     //free(current_element);
     800    free(current_element);
    757801    current_element=NULL;
    758802  }
     
    760804    freeMap(&current_content);
    761805    fprintf(stderr,"LINE 715");
    762     //free(current_content);
     806    free(current_content);
    763807    current_content=NULL;
    764808  }
     
    769813  *service=my_service;
    770814
     815  srlex_destroy();
    771816  return resultatYYParse;
    772817}
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png