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

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

Adding contains and getIoTypeFromElement functions in service.h. Remove memory leaks from the Service Configuration Parser, add the support for multiple supported formats as before. Small modification of the ZOO-Kernel Java Support, adding the capability to access the modified main_conf HashMap? from the Kernel to let lenv message map pass when an error occurs and it is handled in the Service code. Adding same capability for the ZOO-Kernel Python Support. Use strcasecmp in service.h rather than strlen+strncasecmp. Ensure that only OWS compliant informations are available for Contact.Phone and Contact.Adress. Remove memory leak in createExceptionReportNode. Correction of the addDefaultValues function to add the default format using the informations from DataInputs? if present, this should correct the behavior of the ZOO-Kernel when choosing the extension value which should now point to the corresponding zcfg value if present. Don't set the NULL value for inputs not provided in the DataInputs?, still set NULL as default value for outputs. Avoid segfault in freeElements when some zcfg values was not set correctly. Link against the client libjvm.so file rather than the server one.

File size: 21.7 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}
136
137// pour neutre
138// on a rien a faire, meme pas renvoyer l identificateur de balise
139// vu qu'il n y a pas de comparaison d'identificateurs avec un balise jumelle .
140 | EmptyElemTag          {}
141 ;
142
143//======================================================
144// STag
145//======================================================
146// regle 40
147// BALISE OUVRANTE
148// on est obligé de faire appel a infcar et supcar
149// pour acceder aux start conditions DANSBALISE et INITIAL
150//======================================================
151STag
152: INFCAR ID Attributeetoile SUPCAR
153{
154  if(my_service->content==NULL){
155#ifdef DEBUG_SERVICE_CONF
156    fprintf(stderr,"NO CONTENT\n");
157#endif
158    addMapToMap(&my_service->content,current_content);
159    freeMap(&current_content);
160    free(current_content);
161    current_content=NULL;
162    my_service->metadata=NULL;
163    wait_maincontent=false;
164  }
165  if(strncasecmp($2,"DataInputs",10)==0){
166    if(wait_mainmetadata==true){
167      addMapToMap(&my_service->metadata,current_content);
168      freeMap(&current_content);
169      free(current_content);
170      current_content=NULL;
171    }
172    if(current_element==NULL){
173#ifdef DEBUG_SERVICE_CONF
174      fprintf(stderr,"(DATAINPUTS - 184) FREE current_element\n");
175#endif
176      freeElements(&current_element);
177      free(current_element);
178      current_element=NULL;
179#ifdef DEBUG_SERVICE_CONF
180      fprintf(stderr,"(DATAINPUTS - 186) ALLOCATE current_element\n");
181#endif
182      current_element=NULL;
183      current_element=(elements*)malloc(ELEMENTS_SIZE);
184      current_element->name=NULL;
185      current_element->content=NULL;
186      current_element->metadata=NULL;
187      current_element->format=NULL;
188      current_element->defaults=NULL;
189      current_element->supported=NULL;
190      current_element->next=NULL;
191    }
192    wait_inputs=true;
193    current_data=1;
194    previous_data=1;
195  }
196  else
197    if(strncasecmp($2,"DataOutputs",11)==0){
198      if(wait_inputs==true){
199#ifdef DEBUG_SERVICE_CONF
200        fprintf(stderr,"(DATAOUTPUTS) DUP INPUTS current_element\n");
201        fprintf(stderr,"CURRENT_ELEMENT\n");
202        dumpElements(current_element);
203        fprintf(stderr,"SERVICE INPUTS\n");
204        dumpElements(my_service->inputs);
205        dumpService(my_service);
206#endif
207        if(my_service->inputs==NULL){
208          my_service->inputs=dupElements(current_element);
209          my_service->inputs->next=NULL;
210        }
211        else if(current_element!=NULL && current_element->name!=NULL){
212          addToElements(&my_service->inputs,current_element);
213        }
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=strdup($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=strdup($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}
308 ;
309
310//======================================================
311// Attributeetoile
312//======================================================
313// regle 41
314// une liste qui peut etre vide d'attributs
315// utiliser la récursivité a gauche
316//======================================================
317Attributeetoile
318 : Attributeetoile attribute  {}
319 |                                {/* Epsilon */}
320 ;
321
322//======================================================
323// attribute
324//======================================================
325// regle 41
326// un attribut est compose d'un identifiant
327// d'un "="
328// et d'une définition de chaine de caractere
329// ( "xxx" ou 'xxx' )
330//======================================================
331attribute
332 : ID Eq ATTVALUE               
333{
334#ifdef DEBUG_SERVICE_CONF
335  printf ("attribute : %s\n",$1) ;
336#endif
337}
338 ;
339
340//======================================================
341// EmptyElemTag
342//======================================================
343// regle 44
344// ICI ON DEFINIT NEUTRE
345// on ne renvoie pas de char*
346// parce qu'il n'y a pas de comparaisons a faire
347// avec un identifiant d'une balise jumelle
348//======================================================
349EmptyElemTag
350 : INFCAR ID Attributeetoile SLASH SUPCAR       {/*lattribute.clear();/* voir Stag */}
351 ;
352
353//======================================================
354// ETag
355//======================================================
356// regle 42
357// BALISE FERMANTE
358// les separateurs après ID sont filtrés
359//======================================================
360ETag
361 : INFCAR SLASH ID SUPCAR
362{
363  if(strcmp($3,"DataInputs")==0){
364    current_data=1;
365  }
366  if(strcmp($3,"DataOutputs")==0){
367    current_data=2;
368  }
369  if(strcmp($3,"MetaData")==0){
370    current_data=previous_data;
371  }
372  if(strcmp($3,"ComplexData")==0 || strcmp($3,"LiteralData")==0
373     || strcmp($3,"ComplexOutput")==0 || strcmp($3,"LiteralOutput")==0){
374    current_content=NULL;
375  }
376  if(strcmp($3,"Default")==0){
377    current_data=previous_data;
378    if(current_element->defaults==NULL){
379      current_element->defaults=(iotype*)malloc(IOTYPE_SIZE);
380      current_element->defaults->content=NULL;
381    }
382    addMapToMap(&current_element->defaults->content,current_content);
383    freeMap(&current_content);
384    free(current_content);
385    current_element->defaults->next=NULL;
386    wait_defaults=false;
387    current_content=NULL;
388    current_element->supported=NULL;
389    current_element->next=NULL;
390  }
391  if(strcmp($3,"Supported")==0){
392    current_data=previous_data;
393    if(current_element->supported==NULL){
394      if(current_content!=NULL){
395        current_element->supported=(iotype*)malloc(IOTYPE_SIZE);
396        current_element->supported->content=NULL;
397        addMapToMap(&current_element->supported->content,current_content);
398        freeMap(&current_content);
399        free(current_content);
400        current_element->supported->next=NULL;
401        current_content=NULL;
402      }else{
403        current_element->supported=NULL;
404        current_element->next=NULL;
405      }
406    }
407    else{
408#ifdef DEBUG_SERVICE_CONF
409      fprintf(stderr,"SECOND SUPPORTED FORMAT !!!!\n");
410#endif
411      addMapToIoType(&current_element->supported,current_content);
412      freeMap(&current_content);
413      free(current_content);
414      current_content=NULL;
415#ifdef DEBUG_SERVICE_CONF
416      dumpElements(current_element);
417      fprintf(stderr,"SECOND SUPPORTED FORMAT !!!!\n");
418#endif
419    }
420    current_content=NULL;
421  }
422}
423 ;
424
425//======================================================
426// contentetoile
427//======================================================
428// regle 43
429// ENTRE 2 BALISES
430// entre 2 balises, on peut avoir :
431// --- OUVRANTE CONTENU FERMANTE (recursivement !)
432// --- DU TEXTE quelconque
433// --- COMMENTS
434// --- DES PROCESSES INSTRUCTIONS
435// --- /!\ il peut y avoir une processing instruction invalide ! <?xml
436// --- EPSILON
437// ### et/ou tout ca a la suite en nombre indeterminé
438// ### donc c'est un operateur etoile (*)
439//======================================================
440contentetoile
441: contentetoile element           {}
442 | contentetoile PIERROR                  {srerror("processing instruction <?xml ?> impossible\n");}
443 | contentetoile PI                       {}
444///// on filtre les commentaires | contentetoile comment              {}
445 | contentetoile NEWLINE {/*printf("NEWLINE FOUND !!");*/}
446 | contentetoile pair {}
447 | contentetoile processid {}
448 | contentetoile texteinterbalise         {}
449 | contentetoile CDATA {} 
450 | {/* Epsilon */}
451 ;
452
453//======================================================
454// texteinterbalise
455//======================================================
456// regle 14
457// DU TEXTE quelconque
458// c'est du CHARDATA
459// il y a eut un probleme avec ID,
460// on a mis des starts conditions,
461// maintenant on croise les ID dans les dbalises
462// et des CHARDATA hors des balises
463//======================================================
464texteinterbalise
465 : CHARDATA             {}
466 ;
467//======================================================
468
469pair: PAIR {  if(debug) fprintf(stderr,"PAIR FOUND !!\n");if(curr_key!=NULL){free(curr_key);curr_key=NULL;} }
470| EPAIR {
471#ifdef DEBUG_SERVICE_CONF
472    fprintf(stderr,"EPAIR FOUND !! \n");
473    fprintf(stderr,"[%s=>%s]\n",curr_key,$1);
474    fprintf(stderr,"[ZOO: service_conf.y line 482 free(%s)]\n",curr_key);
475    dumpMap(current_content);
476    fflush(stderr);
477#endif
478  if(current_content==NULL){
479#ifdef DEBUG_SERVICE_CONF
480    fprintf(stderr,"[ZOO: service_conf.y line 482 free(%s)]\n",curr_key);
481#endif
482    current_content=createMap(curr_key,$1);
483#ifdef DEBUG_SERVICE_CONF
484    fprintf(stderr,"[ZOO: service_conf.y line 482 free(%s)]\n",curr_key);
485#endif
486    //current_content->next=NULL;
487  }
488  else{
489#ifdef DEBUG_SERVICE_CONF
490    dumpMap(current_content);
491    fprintf(stderr,"addToMap(current_content,%s,%s) !! \n",curr_key,$1);
492#endif
493    addToMap(current_content,curr_key,$1);
494#ifdef DEBUG_SERVICE_CONF
495    fprintf(stderr,"addToMap(current_content,%s,%s) end !! \n",curr_key,$1);
496#endif   
497  }
498#ifdef DEBUG_SERVICE_CONF
499  fprintf(stderr,"EPAIR FOUND !! \n");
500  fprintf(stderr,"[%s=>%s]\n",curr_key,$1);
501  fprintf(stderr,"[ZOO: service_conf.y line 505 free(%s)]\n",curr_key);
502  fflush(stderr);
503#endif
504  if(curr_key!=NULL){
505    free(curr_key);
506    curr_key=NULL;
507  }
508  }
509| SPAIR  { curr_key=strdup($1);/*free($1);*/if(debug) fprintf(stderr,"SPAIR FOUND !!\n"); }
510 ;
511
512
513processid
514: ANID  {
515  if(data==-1){
516    data=1;
517    char *cen=strdup($1);
518    my_service->name=(char*)malloc((strlen(cen)-1)*sizeof(char*));
519    cen[strlen(cen)-1]=0;
520    cen+=1;
521    sprintf(my_service->name,"%s",cen);
522    cen-=1;
523    free(cen);
524    my_service->content=NULL;
525    my_service->metadata=NULL;
526    my_service->inputs=NULL;
527    my_service->outputs=NULL;
528  } else {
529    if(current_data==1){
530      if(my_service->content!=NULL && current_element->name!=NULL){
531        if(my_service->inputs==NULL){
532          my_service->inputs=dupElements(current_element);
533          my_service->inputs->next=NULL;
534          tmp_count++;
535        }
536        else{
537          addToElements(&my_service->inputs,current_element);
538        }
539#ifdef DEBUG_SERVICE_CONF
540        fprintf(stderr,"(%s %d)FREE current_element (after adding to allread existing inputs)",__FILE__,__LINE__);
541        dumpElements(current_element);
542        fprintf(stderr,"(%s %d)FREE current_element (after adding to allread existing inputs)",__FILE__,__LINE__);
543        dumpElements(my_service->inputs);
544#endif
545        freeElements(&current_element);
546        free(current_element);
547        current_element=NULL;
548#ifdef DEBUG_SERVICE_CONF
549        fprintf(stderr,"(DATAINPUTS - 489) ALLOCATE current_element\n");
550#endif
551        current_element=(elements*)malloc(ELEMENTS_SIZE);
552        current_element->name=NULL;
553        current_element->content=NULL;
554        current_element->metadata=NULL;
555        current_element->format=NULL;
556        current_element->defaults=NULL;
557        current_element->supported=NULL;
558        current_element->next=NULL;
559      }
560      if(current_element->name==NULL){
561#ifdef DEBUG_SERVICE_CONF
562        fprintf(stderr,"NAME IN %s (current - %s)\n",
563                $1,current_element->name);
564#endif
565        wait_inputs=true;
566#ifdef DEBUG_SERVICE_CONF
567        fprintf(stderr,"(DATAINPUTS - 501) SET NAME OF current_element\n");
568#endif
569        char *cen=strdup($1);
570        current_element->name=(char*)malloc((strlen(cen)-1)*sizeof(char*));
571        cen[strlen(cen)-1]=0;
572        cen+=1;
573        sprintf(current_element->name,"%s",cen);
574        cen-=1;
575        free(cen);
576#ifdef DEBUG_SERVICE_CONF
577        fprintf(stderr,"NAME IN %s (current - %s)\n",$1,current_element->name);
578#endif
579        current_element->content=NULL;
580        current_element->metadata=NULL;
581        current_element->format=NULL;
582        current_element->defaults=NULL;
583        current_element->supported=NULL;
584        current_element->next=NULL;
585#ifdef DEBUG_SERVICE_CONF
586        fprintf(stderr,"NAME IN %s (current - %s)\n",$1,current_element->name);
587#endif
588      }
589    }
590    else
591      if(current_data==2){
592        if(wait_inputs==true){
593          if(current_element!=NULL && current_element->name!=NULL){
594            if(my_service->inputs==NULL){
595              my_service->inputs=dupElements(current_element);
596              my_service->inputs->next=NULL;
597            }
598            else{
599#ifdef DEBUG_SERVICE_CONF
600              fprintf(stderr,"LAST NAME IN %s (current - %s)\n",$1,current_element->name);
601#endif
602              addToElements(&my_service->inputs,current_element);
603            }
604#ifdef DEBUG_SERVICE_CONF
605            dumpElements(current_element);
606            fprintf(stderr,"(DATAOUTPUTS) FREE current_element %s %i\n",__FILE__,__LINE__);
607#endif
608            freeElements(&current_element);
609            free(current_element);
610            current_element=NULL;
611#ifdef DEBUG_SERVICE_CONF
612            fprintf(stderr,"(DATAOUTPUTS) ALLOCATE current_element %s %i\n",__FILE__,__LINE__);
613#endif
614            current_element=(elements*)malloc(ELEMENTS_SIZE);
615            current_element->name=NULL;
616            current_element->content=NULL;
617            current_element->metadata=NULL;
618            current_element->format=NULL;
619            current_element->defaults=NULL;
620            current_element->supported=NULL;
621            current_element->next=NULL;
622          }
623          if(current_element->name==NULL){
624#ifdef DEBUG_SERVICE_CONF
625            fprintf(stderr,"NAME OUT %s\n",$1);
626            fprintf(stderr,"(DATAOUTPUTS - 545) SET NAME OF current_element\n");
627#endif
628            char *cen=strdup($1);
629            current_element->name=(char*)malloc((strlen(cen)-1)*sizeof(char*));
630            cen[strlen(cen)-1]=0;
631            cen+=1;
632            sprintf(current_element->name,"%s",cen);
633            cen-=1;
634            free(cen);
635            current_element->content=NULL;
636            current_element->metadata=NULL;
637            current_element->format=NULL;
638            current_element->defaults=NULL;
639            current_element->supported=NULL;
640            current_element->next=NULL;
641          }
642          wait_inputs=false;
643          current_content=NULL;
644        }
645        else
646          if(current_element->name==NULL){
647#ifdef DEBUG_SERVICE_CONF
648            fprintf(stderr,"NAME OUT %s\n",$1);
649            fprintf(stderr,"(DATAOUTPUTS - 545) SET NAME OF current_element\n");
650#endif
651            char *cen=strdup($1);
652            current_element->name=(char*)malloc((strlen(cen)-1)*sizeof(char*));
653            cen[strlen(cen)-1]=0;
654#ifdef DEBUG
655            fprintf(stderr,"tmp %s\n",cen);
656#endif
657            cen+=1;
658            sprintf(current_element->name,"%s",cen);
659            cen-=1;
660            free(cen);
661            current_element->content=NULL;
662            current_element->metadata=NULL;
663            current_element->format=NULL;
664            current_element->defaults=NULL;
665            current_element->supported=NULL;
666            current_element->next=NULL;
667          }
668        wait_outputs=true;
669      }
670  }
671 }
672 ;
673
674%%
675
676// srerror
677//======================================================
678/* fonction qui affiche l erreur si il y en a une */
679//======================================================
680void srerror(char *s)
681{
682  if(debug)
683    fprintf(stderr,"\nligne %d : %s\n",srlineno,s);
684}
685
686/**
687 * getServiceFromFile :
688 * set service given as second parameter with informations extracted from the
689 * definition file.
690 */
691int getServiceFromFile(char* file,service** service){
692
693  freeMap(&previous_content);
694  previous_content=NULL;
695  freeMap(&current_content);
696  current_content=NULL;
697  freeMap(&scontent);
698#ifdef DEBUG_SERVICE_CONF
699  fprintf(stderr,"(STARTING)FREE current_element\n");
700#endif
701  freeElements(&current_element);
702  current_element=NULL;
703#ifdef DEBUG_SERVICE_CONF
704  fprintf(stderr,"(STARTING)FREE my_service\n");
705#endif
706  //freeService(&my_service);
707  //free(my_service);
708#ifdef DEBUG_SERVICE_CONF
709  fprintf(stderr,"(STARTING)FREE my_service done\n");
710#endif
711  my_service=NULL;
712  scontent=NULL;
713
714  wait_maincontent=true;
715  wait_mainmetadata=false;
716  wait_metadata=false;
717  wait_inputs=false;
718  wait_defaults=false;
719  wait_supporteds=false;
720  wait_outputs=false;
721  wait_data=false;
722  data=-1;
723  previous_data=1;
724  current_data=0;
725 
726  my_service=*service;
727
728  srin = fopen(file,"r");
729  if (srin==NULL){
730    fprintf(stderr,"error : le fichier specifie n'existe pas ou n'est pas accessible en lecture\n") ;
731    return -1;
732  }
733
734  int resultatYYParse = srparse() ;
735 
736  if(wait_outputs==true && current_element!=NULL && current_element->name!=NULL){
737    if(my_service->outputs==NULL){     
738#ifdef DEBUG_SERVICE_CONF
739      fprintf(stderr,"(DATAOUTPUTS - 623) DUP current_element\n");
740#endif
741      my_service->outputs=dupElements(current_element);
742      my_service->outputs->next=NULL;
743    }
744    else{
745#ifdef DEBUG_SERVICE_CONF
746      fprintf(stderr,"(DATAOUTPUTS - 628) COPY current_element\n");
747#endif
748      addToElements(&my_service->outputs,current_element);
749    }
750#ifdef DEBUG_SERVICE_CONF
751    fprintf(stderr,"(DATAOUTPUTS - 631) FREE current_element\n");
752#endif
753    freeElements(&current_element);
754    free(current_element);
755    current_element=NULL;
756#ifdef DEBUG_SERVICE_CONF
757    fprintf(stderr,"(DATAOUTPUTS - 631) FREE current_element\n");
758#endif
759  }
760  if(current_element!=NULL){
761    freeElements(&current_element);
762    free(current_element);
763    current_element=NULL;
764  }
765  if(current_content!=NULL){
766    freeMap(&current_content);
767    free(current_content);
768    current_content=NULL;
769  }
770  fclose(srin);
771#ifdef DEBUG_SERVICE_CONF
772  dumpService(my_service);
773#endif
774  *service=my_service;
775
776  srlex_destroy();
777  return resultatYYParse;
778}
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