source: trunk/zoo-kernel/service_conf.y @ 20

Last change on this file since 20 was 20, checked in by djay, 14 years ago

Small cleanup.

File size: 22.5 KB
Line 
1%{
2//======================================================
3/**
4 * Thx to Jean-Marie CODOL and Naitan GROLLEMUND
5 * copyright 2009 GeoLabs SARL
6 * Author : Gérald FENOY
7 *
8 */
9//======================================================
10
11#include <string>
12#include <stdio.h>
13#include <ctype.h>
14#include <service.h>
15  //#include <vector>
16
17static int tmp_count=1;
18static int defaultsc=0;
19static bool wait_maincontent=true;
20static bool wait_mainmetadata=false;
21static bool wait_metadata=false;
22static bool wait_inputs=false;
23static bool wait_defaults=false;
24static bool wait_supporteds=false;
25static bool wait_outputs=false;
26static bool wait_data=false;
27static int services_c=0;
28static service* my_service=NULL;
29static map* previous_content=NULL;
30static map* current_content=NULL;
31static elements* current_element=NULL;
32static map* scontent=NULL;
33static char* curr_key;
34static int debug=0;
35static int data=-1;
36static int previous_data=0;
37static int current_data=0;
38static char* myFinalObjectAsJSON="{";
39// namespace
40using namespace std;
41//======================================================
42
43// srerror
44void srerror(char *s);
45//======================================================
46
47// usage ()
48void usage(void) ;
49//======================================================
50
51// srdebug
52extern int srdebug;
53//======================================================
54
55extern char srtext[];
56
57// srlineno
58extern int srlineno;
59//======================================================
60
61// srin
62extern FILE* srin;
63//======================================================
64
65// srlex
66extern int srlex(void);
67extern int srlex_destroy(void);
68
69//vector<char*> lattribute;
70
71%}
72
73
74
75%union
76{char * s;char* chaine;char* key;char* val;}
77
78// jetons //
79%token <s> ID
80%token <s> CHAINE
81/* STARTXMLDECL et ENDXMLDECL qui sont <?xml et ?>*/
82%token STARTXMLDECL ENDXMLDECL
83//======================================================
84/* version="xxx" et encoding="xxx" */
85%token VERSIONDECL ENCODINGDECL SDDECL
86//======================================================
87/* < et > */
88%token INFCAR SUPCAR
89//======================================================
90/* / = a1  texte "texte" */
91%token SLASH Eq CHARDATA ATTVALUE PAIR SPAIR EPAIR ANID
92%type <chaine> PAIR
93%type <chaine> EPAIR
94%type <chaine> SPAIR
95//======================================================
96/* <!-- xxx -> <? xxx yyy ?> */
97%token PI PIERROR /** COMMENT **/
98//======================================================
99/* <!-- xxx -> <? xxx yyy ?> */
100%token ERREURGENERALE CDATA WHITESPACE NEWLINE
101%type <s> STag
102%type <s> ETag
103%type <s> ANID
104//======================================================
105// %start
106//======================================================
107
108%%
109// document <//===
110//======================================================
111// regle 1
112// on est a la racine du fichier xml
113//======================================================
114document
115 : miscetoile element miscetoile {}
116 | contentetoile processid contentetoile document {}
117 ;
118
119miscetoile
120 : miscetoile PIERROR {  srerror("processing instruction begining with <?xml ?> impossible\n");}
121 | miscetoile PI {}
122 | {}
123 ;
124// element
125//======================================================
126// regle 39
127// OUVRANTE CONTENU FERMANTE obligatoirement
128// ou neutre
129// on ne peut pas avoir Epsilon
130// un fichier xml ne peut pas etre vide ou seulement avec un prolog
131//======================================================
132element
133 : STag contentetoile ETag     
134{
135  free($3);
136}
137
138// pour neutre
139// on a rien a faire, meme pas renvoyer l identificateur de balise
140// vu qu'il n y a pas de comparaison d'identificateurs avec un balise jumelle .
141 | EmptyElemTag          {}
142 ;
143
144//======================================================
145// STag
146//======================================================
147// regle 40
148// BALISE OUVRANTE
149// on est obligé de faire appel a infcar et supcar
150// pour acceder aux start conditions DANSBALISE et INITIAL
151//======================================================
152STag
153: INFCAR ID Attributeetoile SUPCAR
154{
155  if(my_service->content==NULL){
156#ifdef DEBUG_SERVICE_CONF
157    fprintf(stderr,"NO CONTENT\n");
158#endif
159    addMapToMap(&my_service->content,current_content);
160    freeMap(&current_content);
161    free(current_content);
162    current_content=NULL;
163    my_service->metadata=NULL;
164    wait_maincontent=false;
165  }
166  if(strncasecmp($2,"DataInputs",10)==0){
167    if(wait_mainmetadata==true){
168      addMapToMap(&my_service->metadata,current_content);
169      freeMap(&current_content);
170      free(current_content);
171      current_content=NULL;
172    }
173    if(current_element==NULL){
174#ifdef DEBUG_SERVICE_CONF
175      fprintf(stderr,"(DATAINPUTS - 184) FREE current_element\n");
176#endif
177      freeElements(&current_element);
178      free(current_element);
179      current_element=NULL;
180#ifdef DEBUG_SERVICE_CONF
181      fprintf(stderr,"(DATAINPUTS - 186) ALLOCATE current_element\n");
182#endif
183      current_element=NULL;
184      current_element=(elements*)malloc(ELEMENTS_SIZE);
185      current_element->name=NULL;
186      current_element->content=NULL;
187      current_element->metadata=NULL;
188      current_element->format=NULL;
189      current_element->defaults=NULL;
190      current_element->supported=NULL;
191      current_element->next=NULL;
192    }
193    wait_inputs=true;
194    current_data=1;
195    previous_data=1;
196  }
197  else
198    if(strncasecmp($2,"DataOutputs",11)==0){
199      if(wait_inputs==true){
200#ifdef DEBUG_SERVICE_CONF
201        fprintf(stderr,"(DATAOUTPUTS) DUP INPUTS current_element\n");
202        fprintf(stderr,"CURRENT_ELEMENT\n");
203        dumpElements(current_element);
204        fprintf(stderr,"SERVICE INPUTS\n");
205        dumpElements(my_service->inputs);
206        dumpService(my_service);
207#endif
208        if(my_service->inputs==NULL){
209          my_service->inputs=dupElements(current_element);
210          my_service->inputs->next=NULL;
211        }
212        else
213          addToElements(&my_service->inputs,current_element);
214#ifdef DEBUG_SERVICE_CONF
215        fprintf(stderr,"CURRENT_ELEMENT\n");
216        dumpElements(current_element);
217        fprintf(stderr,"SERVICE INPUTS\n");
218        dumpElements(my_service->inputs);
219        fprintf(stderr,"(DATAOUTPUTS) FREE current_element\n");
220#endif
221        freeElements(&current_element);
222        free(current_element);
223        current_element=NULL;
224        wait_inputs=false;
225      }
226      if(current_element==NULL){
227#ifdef DEBUG_SERVICE_CONF
228        fprintf(stderr,"(DATAOUTPUTS - 206) ALLOCATE current_element (%s)\n",$2);
229#endif
230        current_element=(elements*)malloc(ELEMENTS_SIZE);
231        current_element->name=NULL;
232        current_element->content=NULL;
233        current_element->metadata=NULL;
234        current_element->format=NULL;
235        current_element->defaults=NULL;
236        current_element->supported=NULL;
237        current_element->next=NULL;
238      }
239      wait_outputs=true;
240      current_data=2;
241      previous_data=1;
242    }
243    else
244      if(strncasecmp($2,"MetaData",8)==0){
245        current_data=3;
246        if(current_element!=NULL){
247          wait_metadata=true;
248#ifdef DEBUG_SERVICE_CONF
249          fprintf(stderr,"add current_content to current_element->content\n");
250          fprintf(stderr,"LINE 247");
251#endif
252          addMapToMap(&current_element->content,current_content);
253          freeMap(&current_content);
254          free(current_content);
255        }
256        else{
257          wait_mainmetadata=true;
258        }
259        current_content=NULL;
260      }
261      else
262        if(strncasecmp($2,"ComplexData",11)==0 || strncasecmp($2,"LiteralData",10)==0
263           || strncasecmp($2,"ComplexOutput",13)==0 || strncasecmp($2,"LiteralOutput",12)==0){
264          current_data=4;
265          if(wait_metadata==true){
266            if(current_content!=NULL){
267              addMapToMap(&current_element->metadata,current_content);
268              current_element->next=NULL;
269              current_element->format=$2;
270              current_element->defaults=NULL;
271              current_element->supported=NULL;
272              freeMap(&current_content);
273              free(current_content);
274            }
275          }else{
276            // No MainMetaData
277            addMapToMap(&current_element->content,current_content);
278            freeMap(&current_content);
279            free(current_content);
280            current_element->metadata=NULL;
281            current_element->next=NULL;
282            current_element->format=$2;
283            current_element->defaults=NULL;
284            current_element->supported=NULL;
285          }
286          current_content=NULL;
287          wait_metadata=false;
288        }
289        else
290          if(strncasecmp($2,"Default",7)==0){
291            wait_defaults=true;
292            current_data=5;
293          }
294          else
295            if(strncasecmp($2,"Supported",9)==0){
296              wait_supporteds=true;
297              if(wait_defaults==true){
298                defaultsc++;
299                freeMap(&current_content);
300                current_content=NULL;
301              }
302              current_data=5;
303            }
304#ifdef DEBUG_SERVICE_CONF
305  printf("* Identifiant : %s\n",$2);
306#endif
307  /* et on renvoie l'identifiant de balise afin de pouvoir le comparer */
308  /* avec la balise jumelle fermante ! */
309  $$ = $2 ;
310}
311 ;
312
313//======================================================
314// Attributeetoile
315//======================================================
316// regle 41
317// une liste qui peut etre vide d'attributs
318// utiliser la récursivité a gauche
319//======================================================
320Attributeetoile
321 : Attributeetoile attribute  {}
322 |                                {/* Epsilon */}
323 ;
324
325//======================================================
326// attribute
327//======================================================
328// regle 41
329// un attribut est compose d'un identifiant
330// d'un "="
331// et d'une définition de chaine de caractere
332// ( "xxx" ou 'xxx' )
333//======================================================
334attribute
335 : ID Eq ATTVALUE               
336{
337#ifdef DEBUG_SERVICE_CONF
338  printf ("attribute : %s\n",$1) ;
339#endif
340  free($1);
341}
342 ;
343
344//======================================================
345// EmptyElemTag
346//======================================================
347// regle 44
348// ICI ON DEFINIT NEUTRE
349// on ne renvoie pas de char*
350// parce qu'il n'y a pas de comparaisons a faire
351// avec un identifiant d'une balise jumelle
352//======================================================
353EmptyElemTag
354 : INFCAR ID Attributeetoile SLASH SUPCAR       {/*lattribute.clear();/* voir Stag */}
355 ;
356
357//======================================================
358// ETag
359//======================================================
360// regle 42
361// BALISE FERMANTE
362// les separateurs après ID sont filtrés
363//======================================================
364ETag
365 : INFCAR SLASH ID SUPCAR
366{
367  if(strcmp($3,"DataInputs")==0){
368    current_data=1;
369  }
370  if(strcmp($3,"DataOutputs")==0){
371    current_data=2;
372  }
373  if(strcmp($3,"MetaData")==0){
374    current_data=previous_data;
375  }
376  if(strcmp($3,"ComplexData")==0 || strcmp($3,"LiteralData")==0
377     || strcmp($3,"ComplexOutput")==0 || strcmp($3,"LiteralOutput")==0){
378    current_content=NULL;
379  }
380  if(strcmp($3,"Default")==0){
381    current_data=previous_data;
382    if(current_element->defaults==NULL){
383      current_element->defaults=(iotype*)malloc(IOTYPE_SIZE);
384      current_element->defaults->content=NULL;
385    }
386    addMapToMap(&current_element->defaults->content,current_content);
387    freeMap(&current_content);
388    free(current_content);
389    current_element->defaults->next=NULL;
390    wait_defaults=false;
391    current_content=NULL;
392    current_element->supported=NULL;
393  }
394  if(strcmp($3,"Supported")==0){
395    current_data=previous_data;
396    if(current_element->supported==NULL){
397      //addMapToIoType(&current_element->supported,current_content);
398      current_element->supported=(iotype*)malloc(IOTYPE_SIZE);
399      current_element->supported->content=NULL;
400      addMapToMap(&current_element->supported->content,current_content);
401      freeMap(&current_content);
402      free(current_content);
403      current_element->supported->next=NULL;
404      current_content=NULL;
405    }
406    else{
407#ifdef DEBUG
408      // Currently we support only one supported format
409      fprintf(stderr,"SECOND SUPPORTED FORMAT !!!!\n");
410#endif
411      //addMapToIoType(&current_element->supported,current_content);
412      /*iotype* iotmp=*(&current_element->supported);
413      while(iotmp!=NULL){
414        dumpMap(iotmp->content);
415        iotmp=iotmp->next;
416      }
417      iotmp=(iotype*)malloc(IOTYPE_SIZE);
418      iotmp->content=NULL;
419      addMapToMap(&iotmp->content,current_content);
420      iotmp->next=NULL;
421      dumpElements(current_element);
422      fprintf(stderr,"SECOND SUPPORTED FORMAT MAP START !!!!\n");
423      dumpMap(current_content);
424      fprintf(stderr,"SECOND SUPPORTED FORMAT MAP END !!!!\n");*/
425      freeMap(&current_content);
426      free(current_content);
427      current_content=NULL;
428      /*freeMap(&iotmp->content);
429      free(&iotmp->content);
430      free(iotype);*/
431#ifdef DEBUG
432      // Currently we support only one supported format
433      fprintf(stderr,"SECOND SUPPORTED FORMAT !!!!\n");
434#endif
435    }
436    current_content=NULL;
437  }
438  /* on renvoie l'identifiant de la balise pour pouvoir comparer les 2 */
439  /* /!\ une balise fermante n'a pas d'attributs (c.f. : W3C) */
440  $$ = $3;
441}
442 ;
443
444//======================================================
445// contentetoile
446//======================================================
447// regle 43
448// ENTRE 2 BALISES
449// entre 2 balises, on peut avoir :
450// --- OUVRANTE CONTENU FERMANTE (recursivement !)
451// --- DU TEXTE quelconque
452// --- COMMENTS
453// --- DES PROCESSES INSTRUCTIONS
454// --- /!\ il peut y avoir une processing instruction invalide ! <?xml
455// --- EPSILON
456// ### et/ou tout ca a la suite en nombre indeterminé
457// ### donc c'est un operateur etoile (*)
458//======================================================
459contentetoile
460: contentetoile element           {}
461 | contentetoile PIERROR                  {srerror("processing instruction <?xml ?> impossible\n");}
462 | contentetoile PI                       {}
463///// on filtre les commentaires | contentetoile comment              {}
464 | contentetoile NEWLINE {/*printf("NEWLINE FOUND !!");*/}
465 | contentetoile pair {}
466 | contentetoile processid {}
467 | contentetoile texteinterbalise         {}
468 | contentetoile CDATA {} 
469 | {/* Epsilon */}
470 ;
471
472//======================================================
473// texteinterbalise
474//======================================================
475// regle 14
476// DU TEXTE quelconque
477// c'est du CHARDATA
478// il y a eut un probleme avec ID,
479// on a mis des starts conditions,
480// maintenant on croise les ID dans les dbalises
481// et des CHARDATA hors des balises
482//======================================================
483texteinterbalise
484 : CHARDATA             {}
485 ;
486//======================================================
487
488pair: PAIR {  if(debug) fprintf(stderr,"PAIR FOUND !!\n");if(curr_key!=NULL){free(curr_key);curr_key=NULL;} }
489| EPAIR {
490#ifdef DEBUG_SERVICE_CONF
491    fprintf(stderr,"EPAIR FOUND !! \n");
492    fprintf(stderr,"[%s=>%s]\n",curr_key,$1);
493    fprintf(stderr,"[ZOO: service_conf.y line 482 free(%s)]\n",curr_key);
494    dumpMap(current_content);
495    fflush(stderr);
496#endif
497  if(current_content==NULL){
498#ifdef DEBUG_SERVICE_CONF
499    fprintf(stderr,"[ZOO: service_conf.y line 482 free(%s)]\n",curr_key);
500#endif
501    current_content=createMap(curr_key,$1);
502#ifdef DEBUG_SERVICE_CONF
503    fprintf(stderr,"[ZOO: service_conf.y line 482 free(%s)]\n",curr_key);
504#endif
505    //current_content->next=NULL;
506  }
507  else{
508#ifdef DEBUG_SERVICE_CONF
509    dumpMap(current_content);
510    fprintf(stderr,"addToMap(current_content,%s,%s) !! \n",curr_key,$1);
511#endif
512    addToMap(current_content,curr_key,$1);
513#ifdef DEBUG_SERVICE_CONF
514    fprintf(stderr,"addToMap(current_content,%s,%s) end !! \n",curr_key,$1);
515#endif   
516  }
517#ifdef DEBUG_SERVICE_CONF
518  fprintf(stderr,"EPAIR FOUND !! \n");
519  fprintf(stderr,"[%s=>%s]\n",curr_key,$1);
520  fprintf(stderr,"[ZOO: service_conf.y line 505 free(%s)]\n",curr_key);
521  fflush(stderr);
522#endif
523  if(curr_key!=NULL){
524    free(curr_key);
525    curr_key=NULL;
526  }
527  }
528| SPAIR  { curr_key=strdup($1);/*free($1);*/if(debug) fprintf(stderr,"SPAIR FOUND !!\n"); }
529 ;
530
531
532processid
533: ANID  {
534  if(data==-1){
535    data=1;
536    char *cen=strdup($1);
537    my_service->name=(char*)malloc((strlen(cen)-1)*sizeof(char*));
538    cen[strlen(cen)-1]=0;
539    cen+=1;
540    sprintf(my_service->name,"%s",cen);
541    cen-=1;
542    free(cen);
543    my_service->content=NULL;
544    my_service->metadata=NULL;
545    my_service->inputs=NULL;
546    my_service->outputs=NULL;
547  } else {
548    if(current_data==1){
549      if(my_service->content!=NULL && current_element->name!=NULL){
550        if(my_service->inputs==NULL){
551          my_service->inputs=dupElements(current_element);
552          my_service->inputs->next=NULL;
553          tmp_count++;
554        }
555        else{
556          addToElements(&my_service->inputs,current_element);
557        }
558#ifdef DEBUG_SERVICE_CONF
559        fprintf(stderr,"(%s %d)FREE current_element (after adding to allread existing inputs)",__FILE__,__LINE__);
560        dumpElements(current_element);
561        fprintf(stderr,"(%s %d)FREE current_element (after adding to allread existing inputs)",__FILE__,__LINE__);
562        dumpElements(my_service->inputs);
563#endif
564        freeElements(&current_element);
565        free(current_element);
566        current_element=NULL;
567#ifdef DEBUG_SERVICE_CONF
568        fprintf(stderr,"(DATAINPUTS - 489) ALLOCATE current_element\n");
569#endif
570        current_element=(elements*)malloc(ELEMENTS_SIZE);
571        current_element->name=NULL;
572        current_element->content=NULL;
573        current_element->metadata=NULL;
574        current_element->format=NULL;
575        current_element->defaults=NULL;
576        current_element->supported=NULL;
577        current_element->next=NULL;
578      }
579      if(current_element->name==NULL){
580#ifdef DEBUG_SERVICE_CONF
581        fprintf(stderr,"NAME IN %s (current - %s)\n",
582                $1,current_element->name);
583#endif
584        wait_inputs=true;
585#ifdef DEBUG_SERVICE_CONF
586        fprintf(stderr,"(DATAINPUTS - 501) SET NAME OF current_element\n");
587#endif
588        char *cen=strdup($1);
589        current_element->name=(char*)malloc((strlen(cen)-1)*sizeof(char*));
590        cen[strlen(cen)-1]=0;
591        cen+=1;
592        sprintf(current_element->name,"%s",cen);
593        cen-=1;
594        free(cen);
595#ifdef DEBUG_SERVICE_CONF
596        fprintf(stderr,"NAME IN %s (current - %s)\n",$1,current_element->name);
597#endif
598        current_element->content=NULL;
599        current_element->metadata=NULL;
600        current_element->format=NULL;
601        current_element->defaults=NULL;
602        current_element->supported=NULL;
603        current_element->next=NULL;
604#ifdef DEBUG_SERVICE_CONF
605        fprintf(stderr,"NAME IN %s (current - %s)\n",$1,current_element->name);
606#endif
607      }
608    }
609    else
610      if(current_data==2){
611        if(wait_inputs==true){
612          fprintf(stderr,"dup INPUTS\n");
613          if(current_element->name!=NULL){
614            if(my_service->inputs==NULL){
615              my_service->inputs=dupElements(current_element);
616              my_service->inputs->next=NULL;
617            }
618            else{
619#ifdef DEBUG_SERVICE_CONF
620              fprintf(stderr,"LAST NAME IN %s (current - %s)\n",$1,current_element->name);
621#endif
622              addToElements(&my_service->inputs,current_element);
623            }
624#ifdef DEBUG_SERVICE_CONF
625            dumpElements(current_element);
626            fprintf(stderr,"(DATAOUTPUTS) FREE current_element %s %i\n",__FILE__,__LINE__);
627#endif
628            freeElements(&current_element);
629            free(current_element);
630            current_element=NULL;
631#ifdef DEBUG_SERVICE_CONF
632            fprintf(stderr,"(DATAOUTPUTS) ALLOCATE current_element %s %i\n",__FILE__,__LINE__);
633#endif
634            current_element=(elements*)malloc(ELEMENTS_SIZE);
635            current_element->name=NULL;
636            current_element->content=NULL;
637            current_element->metadata=NULL;
638            current_element->format=NULL;
639            current_element->defaults=NULL;
640            current_element->supported=NULL;
641            current_element->next=NULL;
642          }
643          if(current_element->name==NULL){
644#ifdef DEBUG_SERVICE_CONF
645            fprintf(stderr,"NAME OUT %s\n",$1);
646            fprintf(stderr,"(DATAOUTPUTS - 545) SET NAME OF current_element\n");
647#endif
648            char *cen=strdup($1);
649            current_element->name=(char*)malloc((strlen(cen)-1)*sizeof(char*));
650            cen[strlen(cen)-1]=0;
651            cen+=1;
652            sprintf(current_element->name,"%s",cen);
653            cen-=1;
654            free(cen);
655            current_element->content=NULL;
656            current_element->metadata=NULL;
657            current_element->format=NULL;
658            current_element->defaults=NULL;
659            current_element->supported=NULL;
660            current_element->next=NULL;
661          }
662          wait_inputs=false;
663          dumpMap(current_content);
664          current_content=NULL;
665        }
666        else
667          if(current_element->name==NULL){
668#ifdef DEBUG_SERVICE_CONF
669            fprintf(stderr,"NAME OUT %s\n",$1);
670            fprintf(stderr,"(DATAOUTPUTS - 545) SET NAME OF current_element\n");
671#endif
672            char *cen=strdup($1);
673            current_element->name=(char*)malloc((strlen(cen)-1)*sizeof(char*));
674            cen[strlen(cen)-1]=0;
675#ifdef DEBUG
676            fprintf(stderr,"tmp %s\n",cen);
677#endif
678            cen+=1;
679            sprintf(current_element->name,"%s",cen);
680            cen-=1;
681            free(cen);
682            current_element->content=NULL;
683            current_element->metadata=NULL;
684            current_element->format=NULL;
685            current_element->defaults=NULL;
686            current_element->supported=NULL;
687            current_element->next=NULL;
688          }
689        wait_outputs=true;
690      }
691  }
692 }
693 ;
694
695%%
696
697// srerror
698//======================================================
699/* fonction qui affiche l erreur si il y en a une */
700//======================================================
701void srerror(char *s)
702{
703  if(debug)
704    fprintf(stderr,"\nligne %d : %s\n",srlineno,s);
705}
706
707/**
708 * getServiceFromFile :
709 * set service given as second parameter with informations extracted from the
710 * definition file.
711 */
712int getServiceFromFile(char* file,service** service){
713
714  freeMap(&previous_content);
715  previous_content=NULL;
716  freeMap(&current_content);
717  current_content=NULL;
718  freeMap(&scontent);
719#ifdef DEBUG_SERVICE_CONF
720  fprintf(stderr,"(STARTING)FREE current_element\n");
721#endif
722  freeElements(&current_element);
723  current_element=NULL;
724#ifdef DEBUG_SERVICE_CONF
725  fprintf(stderr,"(STARTING)FREE my_service\n");
726#endif
727  //freeService(&my_service);
728  //free(my_service);
729#ifdef DEBUG_SERVICE_CONF
730  fprintf(stderr,"(STARTING)FREE my_service done\n");
731#endif
732  my_service=NULL;
733  scontent=NULL;
734
735  wait_maincontent=true;
736  wait_mainmetadata=false;
737  wait_metadata=false;
738  wait_inputs=false;
739  wait_defaults=false;
740  wait_supporteds=false;
741  wait_outputs=false;
742  wait_data=false;
743  data=-1;
744  previous_data=1;
745  current_data=0;
746 
747  my_service=*service;
748
749  srin = fopen(file,"r");
750  if (srin==NULL){
751    fprintf(stderr,"error : le fichier specifie n'existe pas ou n'est pas accessible en lecture\n") ;
752    return -1;
753  }
754
755  int resultatYYParse = srparse() ;
756 
757  if(wait_outputs==true && current_element->name!=NULL){
758    if(my_service->outputs==NULL){     
759#ifdef DEBUG_SERVICE_CONF
760      fprintf(stderr,"(DATAOUTPUTS - 623) DUP current_element\n");
761#endif
762      my_service->outputs=dupElements(current_element);
763      my_service->outputs->next=NULL;
764      freeElements(&current_element);
765      free(current_element);
766      current_element=NULL;
767    }
768    else{
769#ifdef DEBUG_SERVICE_CONF
770      fprintf(stderr,"(DATAOUTPUTS - 628) COPY current_element\n");
771#endif
772      addToElements(&my_service->outputs,current_element);
773    }
774#ifdef DEBUG_SERVICE_CONF
775    fprintf(stderr,"(DATAOUTPUTS - 631) FREE current_element\n");
776#endif
777    freeElements(&current_element);
778    free(current_element);
779    current_element=NULL;
780  }
781  if(current_element!=NULL){
782    freeElements(&current_element);
783    fprintf(stderr,"LINE 709");
784    free(current_element);
785    current_element=NULL;
786  }
787  if(current_content!=NULL){
788    freeMap(&current_content);
789    fprintf(stderr,"LINE 715");
790    free(current_content);
791    current_content=NULL;
792  }
793  fclose(srin);
794#ifdef DEBUG_SERVICE_CONF
795  dumpService(my_service);
796#endif
797  *service=my_service;
798
799  srlex_destroy();
800  return resultatYYParse;
801}
Note: See TracBrowser for help on using the repository browser.

Search

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