Changeset 465 for trunk/zoo-project/zoo-kernel/service.h
- Timestamp:
- Apr 23, 2014, 3:05:01 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service.h
r458 r465 82 82 #define SHMSZ 27 83 83 84 #include "version.h" 84 85 85 86 #ifdef DEBUG_STACK … … 133 134 static void _dumpMap(map* t){ 134 135 if(t!=NULL){ 135 fprintf(stderr," [%s] => [%s]\n",t->name,t->value);136 fprintf(stderr,"%s: %s\n",t->name,t->value); 136 137 fflush(stderr); 137 138 }else{ … … 437 438 map* tmp=mi; 438 439 map* _cursor=*mo; 439 if(tmp==NULL){440 if(_cursor!=NULL){441 while(_cursor!=NULL)442 _cursor=_cursor->next;443 _cursor=NULL;444 }else445 *mo=NULL;446 }447 440 while(tmp!=NULL){ 448 441 if(_cursor==NULL){ 449 if(*mo==NULL) 450 *mo=createMap(tmp->name,tmp->value); 451 else 452 addToMap(*mo,tmp->name,tmp->value); 442 *mo=createMap(tmp->name,tmp->value); 443 (*mo)->next=NULL; 453 444 } 454 445 else{ … … 457 448 dumpMap(_cursor); 458 449 #endif 459 while(_cursor !=NULL)450 while(_cursor->next!=NULL) 460 451 _cursor=_cursor->next; 461 _cursor=createMap(tmp->name,tmp->value); 462 _cursor->next=NULL; 463 } 452 map* tmp1=getMap(_cursor,tmp->name); 453 if(tmp1==NULL) 454 _cursor->next=createMap(tmp->name,tmp->value); 455 else{ 456 free(tmp1->value); 457 tmp1->value=zStrdup(tmp->value); 458 } 459 } 460 _cursor=*mo; 464 461 tmp=tmp->next; 465 462 #ifdef DEBUG … … 568 565 if(_cursor==NULL){ 569 566 *mo=dupMaps(&mi); 570 (*mo)->next=NULL;571 567 } 572 568 else{ 569 maps* tmp1=getMaps(*mo,tmp->name); 573 570 while(_cursor->next!=NULL) 574 571 _cursor=_cursor->next; 575 _cursor->next=dupMaps(&tmp); 572 if(tmp1==NULL) 573 _cursor->next=dupMaps(&tmp); 574 else 575 addMapToMap(&tmp1->content,tmp->content); 576 _cursor=*mo; 576 577 } 577 578 tmp=tmp->next; … … 603 604 else 604 605 sprintf(tmp,"%s",key); 605 map* tmpSize=getMapArray(m, "size",index);606 map* tmpSize=getMapArray(m,(char*)"size",index); 606 607 if(tmpSize!=NULL && strncasecmp(key,"value",5)==0){ 607 608 #ifdef DEBUG 608 609 fprintf(stderr,"%s\n",tmpSize->value); 609 610 #endif 610 map* ptr=getMapOrFill(m,tmp, "");611 map* ptr=getMapOrFill(m,tmp,(char *)""); 611 612 free(ptr->value); 612 613 ptr->value=(char*)malloc((atoi(tmpSize->value)+1)*sizeof(char)); … … 618 619 619 620 static map* getMapType(map* mt){ 620 map* tmap=getMap(mt, "mimeType");621 map* tmap=getMap(mt,(char *)"mimeType"); 621 622 if(tmap==NULL){ 622 623 tmap=getMap(mt,"dataType"); … … 646 647 647 648 char *tmpV[8]={ 648 "size",649 "value",650 "uom",651 "Reference",652 "xlink:href",649 (char*)"size", 650 (char*)"value", 651 (char*)"uom", 652 (char*)"Reference", 653 (char*)"xlink:href", 653 654 typ, 654 "schema",655 "encoding"655 (char*)"schema", 656 (char*)"encoding" 656 657 }; 657 658 sprintf(tmpLen,"%d",len+1); … … 730 731 } 731 732 733 static void dumpElementsAsYAML(elements* e){ 734 elements* tmp=e; 735 while(tmp!=NULL){ 736 for(int i=0;i<2;i++) 737 fprintf(stderr," "); 738 fprintf(stderr,"%s:\n",tmp->name); 739 map* mcurs=tmp->content; 740 while(mcurs!=NULL){ 741 for(int i=0;i<4;i++) 742 fprintf(stderr," "); 743 _dumpMap(mcurs); 744 mcurs=mcurs->next; 745 } 746 mcurs=tmp->metadata; 747 if(mcurs!=NULL){ 748 for(int i=0;i<4;i++) 749 fprintf(stderr," "); 750 fprintf(stderr,"MetaData:\n"); 751 while(mcurs!=NULL){ 752 for(int i=0;i<6;i++) 753 fprintf(stderr," "); 754 _dumpMap(mcurs); 755 mcurs=mcurs->next; 756 } 757 } 758 for(int i=0;i<4;i++) 759 fprintf(stderr," "); 760 fprintf(stderr,"%s:\n",tmp->format); 761 iotype* tmpio=tmp->defaults; 762 int ioc=0; 763 while(tmpio!=NULL){ 764 for(int i=0;i<6;i++) 765 fprintf(stderr," "); 766 fprintf(stderr,"default:\n"); 767 mcurs=tmpio->content; 768 while(mcurs!=NULL){ 769 for(int i=0;i<8;i++) 770 fprintf(stderr," "); 771 if(strcasecmp(mcurs->name,"range")==0){ 772 fprintf(stderr,"range: \"%s\"\n",mcurs->value); 773 }else 774 _dumpMap(mcurs); 775 mcurs=mcurs->next; 776 } 777 tmpio=tmpio->next; 778 ioc++; 779 } 780 tmpio=tmp->supported; 781 ioc=0; 782 while(tmpio!=NULL){ 783 for(int i=0;i<6;i++) 784 fprintf(stderr," "); 785 fprintf(stderr,"supported:\n"); 786 mcurs=tmpio->content; 787 while(mcurs!=NULL){ 788 for(int i=0;i<8;i++) 789 fprintf(stderr," "); 790 if(strcasecmp(mcurs->name,"range")==0){ 791 fprintf(stderr,"range: \"%s\"\n",mcurs->value); 792 }else 793 _dumpMap(mcurs); 794 mcurs=mcurs->next; 795 } 796 tmpio=tmpio->next; 797 ioc++; 798 } 799 tmp=tmp->next; 800 } 801 } 802 803 732 804 static elements* dupElements(elements* e){ 733 805 elements* cursor=e; … … 805 877 } 806 878 fprintf(stderr,"++++++++++++++++++\n"); 879 } 880 881 static void dumpServiceAsYAML(service* s){ 882 int level=0; 883 fprintf(stderr,"# %s\n\n",s->name); 884 if(s->content!=NULL){ 885 map* mcurs=s->content; 886 dumpMap(mcurs); 887 mcurs=s->metadata; 888 if(mcurs!=NULL){ 889 fprintf(stderr,"MetaData:\n"); 890 while(mcurs!=NULL){ 891 for(int i=0;i<2;i++) 892 fprintf(stderr," "); 893 _dumpMap(mcurs); 894 mcurs=mcurs->next; 895 } 896 } 897 } 898 if(s->inputs!=NULL){ 899 fprintf(stderr,"\ninputs:\n",s->name); 900 dumpElementsAsYAML(s->inputs); 901 } 902 if(s->outputs!=NULL){ 903 fprintf(stderr,"\noutputs:\n",s->name); 904 dumpElementsAsYAML(s->outputs); 905 } 807 906 } 808 907
Note: See TracChangeset
for help on using the changeset viewer.