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

Last change on this file since 114 was 114, checked in by djay, 13 years ago

Code cleanup to avoid most of the warning messages at compilation time.

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