Changeset 104
- Timestamp:
- Feb 1, 2011, 5:11:53 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-kernel/service_conf.y
r93 r104 169 169 free(current_content); 170 170 current_content=NULL; 171 wait_mainmetadata=false; 171 172 } 172 173 if(current_element==NULL){ 173 174 #ifdef DEBUG_SERVICE_CONF 174 fprintf(stderr,"(DATAINPUTS - 184) FREE current_element\n");175 fprintf(stderr,"(DATAINPUTS - %d) FREE current_element\n",__LINE__); 175 176 #endif 176 177 freeElements(¤t_element); 177 178 free(current_element); 178 179 #ifdef DEBUG_SERVICE_CONF 179 fprintf(stderr,"(DATAINPUTS - 186) ALLOCATE current_element\n");180 fprintf(stderr,"(DATAINPUTS - %d) ALLOCATE current_element\n",__LINE__); 180 181 #endif 181 182 current_element=NULL; … … 197 198 if(wait_inputs==true){ 198 199 #ifdef DEBUG_SERVICE_CONF 199 fprintf(stderr,"(DATAOUTPUTS ) DUP INPUTS current_element\n");200 fprintf(stderr,"(DATAOUTPUTS %d) DUP INPUTS current_element\n",__LINE__); 200 201 fprintf(stderr,"CURRENT_ELEMENT\n"); 201 202 dumpElements(current_element); … … 225 226 if(current_element==NULL){ 226 227 #ifdef DEBUG_SERVICE_CONF 227 fprintf(stderr,"(DATAOUTPUTS - 206) ALLOCATE current_element (%s)\n",$2);228 fprintf(stderr,"(DATAOUTPUTS - %d) ALLOCATE current_element (%s)\n",__LINE__,$2); 228 229 #endif 229 230 current_element=(elements*)malloc(ELEMENTS_SIZE); … … 247 248 #ifdef DEBUG_SERVICE_CONF 248 249 fprintf(stderr,"add current_content to current_element->content\n"); 249 fprintf(stderr,"LINE 247");250 fprintf(stderr,"LINE %d",__LINE__); 250 251 #endif 251 252 addMapToMap(¤t_element->content,current_content); 252 253 freeMap(¤t_content); 253 254 free(current_content); 254 wait_metadata=true; 255 if(previous_data==1 || previous_data==2) 256 wait_metadata=true; 257 else 258 wait_mainmetadata=true; 255 259 } 256 260 else{ 257 wait_mainmetadata=true; 261 if(previous_data==1 || previous_data==2) 262 wait_metadata=true; 263 else 264 wait_mainmetadata=true; 258 265 } 259 266 current_content=NULL; … … 268 275 addMapToMap(¤t_element->metadata,current_content); 269 276 current_element->next=NULL; 270 current_element->format=strdup($2); 277 if($2!=NULL) 278 current_element->format=strdup($2); 279 271 280 current_element->defaults=NULL; 272 281 current_element->supported=NULL; … … 281 290 current_element->metadata=NULL; 282 291 current_element->next=NULL; 292 if($2!=NULL) 283 293 current_element->format=strdup($2); 284 294 current_element->defaults=NULL; … … 347 357 //====================================================== 348 358 EmptyElemTag 349 : INFCAR ID Attributeetoile SLASH SUPCAR { /*lattribute.clear();/* voir Stag */}359 : INFCAR ID Attributeetoile SLASH SUPCAR {} 350 360 ; 351 361 … … 368 378 if(strcmp($3,"MetaData")==0){ 369 379 current_data=previous_data; 370 wait_metadata=true;371 380 } 372 381 if(strcmp($3,"ComplexData")==0 || strcmp($3,"LiteralData")==0 … … 467 476 //====================================================== 468 477 469 pair: PAIR { 478 pair: PAIR { if(debug) fprintf(stderr,"PAIR FOUND !!\n");if(curr_key!=NULL){free(curr_key);curr_key=NULL;} } 470 479 | EPAIR { 471 480 #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 %d free(%s)]\n",__LINE__,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 %d free(%s)]\n",__LINE__,curr_key); 481 #endif 482 current_content=createMap(curr_key,$1); 483 #ifdef DEBUG_SERVICE_CONF 484 fprintf(stderr,"[ZOO: service_conf.y line %d free(%s)]\n",__LINE__,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); 481 fprintf(stderr,"EPAIR FOUND !! \n"); 482 fprintf(stderr,"[%s=>%s]\n",curr_key,$1); 483 fprintf(stderr,"[ZOO: service_conf.y line %d free(%s)]\n",__LINE__,curr_key); 484 dumpMap(current_content); 485 fflush(stderr); 486 #endif 487 if($1!=NULL){ 488 if(current_content==NULL){ 489 #ifdef DEBUG_SERVICE_CONF 490 fprintf(stderr,"[ZOO: service_conf.y line %d free(%s)]\n",__LINE__,curr_key); 491 #endif 492 current_content=createMap(curr_key,$1); 493 #ifdef DEBUG_SERVICE_CONF 494 fprintf(stderr,"[ZOO: service_conf.y line %d free(%s)]\n",__LINE__,curr_key); 495 #endif 496 //current_content->next=NULL; 497 } 498 else{ 499 #ifdef DEBUG_SERVICE_CONF 500 dumpMap(current_content); 501 fprintf(stderr,"addToMap(current_content,%s,%s) !! \n",curr_key,$1); 502 #endif 503 addToMap(current_content,curr_key,$1); 504 #ifdef DEBUG_SERVICE_CONF 505 fprintf(stderr,"addToMap(current_content,%s,%s) end !! \n",curr_key,$1); 496 506 #endif 507 } 497 508 } 498 509 #ifdef DEBUG_SERVICE_CONF … … 507 518 } 508 519 } 509 | SPAIR { curr_key=strdup($1);if(debug) fprintf(stderr,"SPAIR FOUND !!\n"); }520 | 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"); } 510 521 ; 511 522 … … 515 526 if(data==-1){ 516 527 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 if($1!=NULL){ 529 char *cen=strdup($1); 530 my_service->name=(char*)malloc((strlen(cen)-1)*sizeof(char*)); 531 cen[strlen(cen)-1]=0; 532 cen+=1; 533 sprintf(my_service->name,"%s",cen); 534 cen-=1; 535 free(cen); 536 my_service->content=NULL; 537 my_service->metadata=NULL; 538 my_service->inputs=NULL; 539 my_service->outputs=NULL; 540 } 528 541 } else { 529 542 if(current_data==1){ … … 567 580 fprintf(stderr,"(DATAINPUTS - 501) SET NAME OF current_element\n"); 568 581 #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 582 if($1!=NULL){ 583 char *cen=strdup($1); 584 current_element->name=(char*)malloc((strlen(cen)-1)*sizeof(char*)); 585 cen[strlen(cen)-1]=0; 586 cen+=1; 587 sprintf(current_element->name,"%s",cen); 588 cen-=1; 589 free(cen); 590 #ifdef DEBUG_SERVICE_CONF 591 fprintf(stderr,"NAME IN %s (current - %s)\n",$1,current_element->name); 592 #endif 593 current_element->content=NULL; 594 current_element->metadata=NULL; 595 current_element->format=NULL; 596 current_element->defaults=NULL; 597 current_element->supported=NULL; 598 current_element->next=NULL; 599 #ifdef DEBUG_SERVICE_CONF 600 fprintf(stderr,"NAME IN %s (current - %s)\n",$1,current_element->name); 601 #endif 602 } 588 603 } 589 604 } … … 611 626 current_element=NULL; 612 627 #ifdef DEBUG_SERVICE_CONF 613 fprintf(stderr,"(DATAOUTPUTS ) ALLOCATE current_element %s %i\n",__FILE__,__LINE__);628 fprintf(stderr,"(DATAOUTPUTS -%d) ALLOCATE current_element %s \n",__LINE__,__FILE__); 614 629 #endif 615 630 current_element=(elements*)malloc(ELEMENTS_SIZE); … … 625 640 #ifdef DEBUG_SERVICE_CONF 626 641 fprintf(stderr,"NAME OUT %s\n",$1); 627 fprintf(stderr,"(DATAOUTPUTS - 545) SET NAME OF current_element\n"); 628 #endif 629 char *cen=strdup($1); 630 current_element->name=(char*)malloc((strlen(cen)-1)*sizeof(char)); 631 cen[strlen(cen)-1]=0; 632 cen+=1; 633 sprintf(current_element->name,"%s",cen); 634 cen-=1; 635 free(cen); 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 fprintf(stderr,"(DATAOUTPUTS - %d) SET NAME OF current_element\n",__LINE__); 643 #endif 644 if($1!=NULL){ 645 char *cen=strdup($1); 646 current_element->name=(char*)malloc((strlen(cen)-1)*sizeof(char)); 647 cen[strlen(cen)-1]=0; 648 cen+=1; 649 sprintf(current_element->name,"%s",cen); 650 cen-=1; 651 free(cen); 652 current_element->content=NULL; 653 current_element->metadata=NULL; 654 current_element->format=NULL; 655 current_element->defaults=NULL; 656 current_element->supported=NULL; 657 current_element->next=NULL; 658 } 642 659 } 643 660 … … 663 680 fprintf(stderr,"(DATAOUTPUTS - 545) SET NAME OF current_element\n"); 664 681 #endif 665 char *cen=strdup($1); 666 current_element->name=(char*)malloc((strlen(cen)-1)*sizeof(char*)); 667 cen[strlen(cen)-1]=0; 682 if($1!=NULL){ 683 char *cen=strdup($1); 684 current_element->name=(char*)malloc((strlen(cen)-1)*sizeof(char*)); 685 cen[strlen(cen)-1]=0; 668 686 #ifdef DEBUG 669 fprintf(stderr,"tmp %s\n",cen); 670 #endif 671 cen+=1; 672 sprintf(current_element->name,"%s",cen); 673 cen-=1; 674 free(cen); 675 current_element->content=NULL; 676 current_element->metadata=NULL; 677 current_element->format=NULL; 678 current_element->defaults=NULL; 679 current_element->supported=NULL; 680 current_element->next=NULL; 687 fprintf(stderr,"tmp %s\n",cen); 688 #endif 689 cen+=1; 690 sprintf(current_element->name,"%s",cen); 691 cen-=1; 692 free(cen); 693 current_element->content=NULL; 694 current_element->metadata=NULL; 695 current_element->format=NULL; 696 current_element->defaults=NULL; 697 current_element->supported=NULL; 698 current_element->next=NULL; 699 } 681 700 } 682 701 wait_inputs=false; … … 746 765 if(my_service->outputs==NULL){ 747 766 #ifdef DEBUG_SERVICE_CONF 748 fprintf(stderr,"(DATAOUTPUTS - 623) DUP current_element\n");767 fprintf(stderr,"(DATAOUTPUTS - %d) DUP current_element\n",__LINE__); 749 768 #endif 750 769 my_service->outputs=dupElements(current_element); … … 753 772 else{ 754 773 #ifdef DEBUG_SERVICE_CONF 755 fprintf(stderr,"(DATAOUTPUTS - 628) COPY current_element\n");774 fprintf(stderr,"(DATAOUTPUTS - %d) COPY current_element\n",__LINE__); 756 775 #endif 757 776 addToElements(&my_service->outputs,current_element); 758 777 } 759 778 #ifdef DEBUG_SERVICE_CONF 760 fprintf(stderr,"(DATAOUTPUTS - 631) FREE current_element\n");779 fprintf(stderr,"(DATAOUTPUTS - %d) FREE current_element\n",__LINE__); 761 780 #endif 762 781 freeElements(¤t_element); … … 764 783 current_element=NULL; 765 784 #ifdef DEBUG_SERVICE_CONF 766 fprintf(stderr,"(DATAOUTPUTS - 631) FREE current_element\n");785 fprintf(stderr,"(DATAOUTPUTS - %d) FREE current_element\n",__LINE__); 767 786 #endif 768 787 }
Note: See TracChangeset
for help on using the changeset viewer.