Changeset 363


Ignore:
Timestamp:
Sep 24, 2012, 8:40:22 AM (12 years ago)
Author:
djay
Message:

Remove uneeded header file and small fix to compile on win32 and use correct way to fill outputs parameters.

Location:
trunk/zoo-project/zoo-services/arithmetics
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-services/arithmetics/makefile.vc

    r216 r363  
    1 GEODIR=c:/OSGeo4W/
    2 TOOLS=c:/Users/djay/GeoLabs/tools/
    3 CFLAGS=-I$(GEODIR)/include -I$(TOOLS)/include -I../../zoo-kernel/ -I./ -DLINUX_FREE_ISSUE -DDEBUG -DWIN32
    4 CPP=cl /TP
     1TROOT= ../
     2!INCLUDE ../../zoo-kernel/nmake.opt
     3
     4#CFLAGS=-I$(GEODIR)/include -I$(TOOLS)/include -I../../zoo-kernel/ -I./ -DLINUX_FREE_ISSUE -DDEBUG -DWIN32
     5#CPP=cl /TP
    56
    67cgi-env/test_service.zo: test_service.c
    7         $(CPP) $(CFLAGS) /c test_service.c
    8         link /dll /out:cgi-env/test_service.zo ../../zoo-kernel/service_internal.obj ./test_service.obj -L$(TOOLS)/lib/libssl32.dll.a $(GEODIR)/lib/libxml2.lib $(GEODIR)/lib/gdal_i.lib $(TOOLS)/lib/libeay32.dll.a $(TOOLS)/lib/libcrypto.a $(TOOLS)/lib/libssl32.dll.a $(TOOLS)/lib/libintl.lib
     8        $(CPP) -DWIN32 -DZOO_SERVICE -DNEED_STRCASESTR $(CFLAGS) /c test_service.c
     9        link /dll /out:cgi-env/test_service.zo ../../zoo-kernel/service_internal.obj ../../zoo-kernel/ulinet.obj ../../zoo-kernel/service_internal_ms.obj ../../zoo-kernel/service_internal_js.obj ./test_service.obj $(LDFLAGS)
    910
    1011clean:
  • trunk/zoo-project/zoo-services/arithmetics/test_service.c

    r348 r363  
    3434        }
    3535        res=A*B;
    36         outputs=(maps*)malloc(sizeof(maps*));
    37         outputs->name="Result";
    3836        char tmp[256];
    3937        sprintf(tmp,"%i",res);
    40         outputs->content=createMap("value",tmp);
    41         addMapToMap(&outputs->content,createMap("datatype","float"));
    42         addMapToMap(&outputs->content,createMap("uom","meter"));
    43         outputs->next=NULL;
    44         dumpMaps(outputs);
    45         fprintf(stderr,"\nService internal print\n===\n");
     38        setMapInMaps(outputs,"Result","value",tmp);
    4639        return SERVICE_SUCCEEDED;
    4740  }
    4841
    49   int helloworld1(maps*& conf,maps*& inputs,maps*& outputs){
    50     outputs=(maps*)malloc(sizeof(maps*));
    51     outputs->name="Result";
    52     outputs->content=createMap("value","Hello World");
    53     addMapToMap(&outputs->content,createMap("datatype","string"));
    54     return SERVICE_SUCCEEDED;
    55   }
    56 
    57   int helloworld(map*& inputs,map*& outputs){
    58     outputs=createMap("output_0","Hello World\n");
    59     return SERVICE_SUCCEEDED;
    60   }
    61 
    62   int printArguments(map*& inputs,map*& outputs){
    63     char *res=(char *)malloc(sizeof(char));
    64     map* tmp=inputs;
    65     while(tmp!=NULL){
    66       res=(char *)realloc(res,strlen(res)+strlen(tmp->value)+strlen(tmp->name)+6);
    67       sprintf(res,"%s,\"%s\"=\"%s\"",res,tmp->name,tmp->value);
    68       //sprintf(res,"%s,\"%s\"=\"%s\"",res,tmp->name,tmp->value);
    69       tmp=tmp->next;
    70     }
    71     char *tmpVal=strdup(res+1);
    72     outputs=createMap("output_0",tmpVal);
    73     addToMap(outputs,"output_1",tmpVal);
    74 
    75     /*dumpMap(outputs);
    76       dumpMap(inputs);*/
    77     return SERVICE_SUCCEEDED;
    78   }
    79 
    80   int buildJsonArrayOfArgs(map*& inputs,map*& outputs){
    81     char *res=(char *)malloc(sizeof(char));
    82     map* tmp=inputs;
    83     while(tmp!=NULL){
    84       res=(char *)realloc(res,strlen(res)+strlen(tmp->value)+3);
    85       sprintf(res,"%s,\"%s\"",res,tmp->value);
    86       tmp=tmp->next;
    87     }
    88     char *tmpVal;
    89     if(strncmp(res,",",1)!=0){
    90       free(tmpVal);
    91       tmpVal=strdup(res+1);
    92       //dumpMap(inputs);     
    93     }else
    94       tmpVal=strdup(res);
    95     tmpVal=(char*)realloc(tmpVal,strlen(tmpVal)+2);
    96     sprintf(tmpVal,"[%s]",tmpVal);
    97     outputs=createMap("output_0",tmpVal+1);
    98     //dumpMap(outputs);
    99     //dumpMap(inputs);
    100     return SERVICE_SUCCEEDED;
    101   }
    102 
    10342}
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

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