Ignore:
Timestamp:
May 28, 2015, 4:25:06 PM (9 years ago)
Author:
djay
Message:

First version including zoo_service shared library

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/service_internal_js.c

    r586 r640  
    2323 */
    2424
    25 #include "service_internal.h"
     25#include "service_internal_js.h"
     26#include "response_print.h"
    2627
    2728#ifndef JSCLASS_GLOBAL_FLAGS
     
    6768JSLoadScripts(JSContext *cx, uintN argc, jsval *argv1)
    6869{
    69   //map* request = JS_GetContextPrivate(cx);
    70   //map* tmpm1=getMap(request,"metapath");
    7170  JS_MaybeGC(cx);
    7271
     
    7877  JS_MaybeGC(cx);
    7978  for(i=0;i<argc;i++){
    80     JSString* jsmsg = JS_ValueToString(cx,argv[i]);
    8179    char *filename = JSValToChar(cx,&argv[i]);
    8280    char *api0=(char*)malloc((strlen(ntmp)+strlen(filename)+2)*sizeof(char));
     
    110108int zoo_js_support(maps** main_conf,map* request,service* s,maps **inputs,maps **outputs)
    111109{
    112   maps* main=*main_conf;
     110  /*maps* main=*main_conf;
    113111  maps* _inputs=*inputs;
    114   maps* _outputs=*outputs;
     112  maps* _outputs=*outputs;*/
    115113
    116114  /* The class of the global object. */
     
    202200  /* Your application code here. This may include JSAPI calls
    203201     to create your own custom JS objects and run scripts. */
    204   maps* out=*outputs;
     202  //maps* out=*outputs;
    205203  int res=SERVICE_FAILED;
    206   maps* mc=*main_conf;
     204  //maps* mc=*main_conf;
    207205  map* tmpm2=getMap(s->content,"serviceProvider");
    208206
     
    216214  stat(filename, &file_status);
    217215  //char *source=(char*)malloc(file_status.st_size);
    218   uint16 lineno;
     216  //uint16 lineno;
    219217  jsval rval;
    220218  JSBool ok ;
     
    281279  }
    282280
    283   jsval t=OBJECT_TO_JSVAL(d);
     281  //jsval t=OBJECT_TO_JSVAL(d);
    284282  if(JS_IsArrayObject(cx,d)){
    285283#ifdef JS_DEBUG
     
    395393  if(s==0){
    396394    jsval rval;
    397     JSBool ok ;
    398395    JSObject *script = JS_CompileFile(cx, JS_GetGlobalObject(cx), filename);
    399396    if(script!=NULL){
     
    425422JSObject* JSObject_FromMaps(JSContext *cx,maps* t){
    426423  JSObject* res=JS_NewObject(cx, NULL, NULL, NULL);
    427   //JSObject *res = JS_NewArrayObject(cx, 0, NULL);
    428424  if(res==NULL)
    429425    fprintf(stderr,"Array Object is NULL!\n");
    430426  maps* tmp=t;
    431427  while(tmp!=NULL){
    432     jsuint len;
    433     JSObject* res1=JS_NewObject(cx, NULL, NULL, NULL);
    434428    JSObject *pval=JSObject_FromMap(cx,tmp->content);
    435429    jsval pvalj=OBJECT_TO_JSVAL(pval);
     
    452446JSObject* JSObject_FromMap(JSContext *cx,map* t){
    453447  JSObject* res=JS_NewObject(cx, NULL, NULL, NULL);
    454   jsval resf =  OBJECT_TO_JSVAL(res);
    455448  map* tmpm=t;
    456449  map* isArray=getMap(t,"isArray");
     
    463456    fprintf(stderr,"tmap is not null ! (%s = %s)\n",tmap->name,tmap->value);
    464457#endif
    465   while(tmpm!=NULL){
     458  while(isArray==NULL && tmpm!=NULL){
    466459    jsval jsstr;
    467     if((isArray==NULL && isBinary!=NULL && strncasecmp(tmpm->name,"value",5)==0))
     460    if((isBinary!=NULL && strncasecmp(tmpm->name,"value",5)==0))
    468461      jsstr = STRING_TO_JSVAL(JS_NewStringCopyN(cx,tmpm->value,atoi(isBinary->value)));
    469462    else
     
    534527        jsval id = idp->vector[index];
    535528        jsval vp;
    536         JSString* str;
    537529        JS_IdToValue(cx,id,&vp);
    538         char *c, *tmp;
     530        char *tmp;
    539531        JSString *jsmsg;
    540532        size_t len1;
     
    583575  fprintf(stderr,"outputs array length : %d\n",len);
    584576#endif
    585   for(oi=0;oi < len;oi++){
     577  for(oi=0;hasLen && oi < len;oi++){
    586578#ifdef JS_DEBUG
    587579    fprintf(stderr,"outputs array length : %d step %d \n",len,oi);
     
    605597        jsval id = idp->vector[index];
    606598        jsval vp;
    607         JSString* str;
    608599        JS_IdToValue(cx,id,&vp);
    609         char *c, *tmp;
     600        char *tmp;
    610601        JSString *jsmsg;
    611602        size_t len1;
     
    706697      jsval id = idp->vector[index];
    707698      jsval vp;
    708       JSString* str;
    709699      JS_IdToValue(cx,id,&vp);
    710       char *c, *tmp, *tmp1;
     700      char *tmp, *tmp1;
    711701      JSString *jsmsg,*jsmsg1;
    712702      size_t len,len1;
     
    877867  jsval *argv = JS_ARGV(cx,argv1);
    878868  HINTERNET hInternet;
    879   HINTERNET res;
    880   HINTERNET res1;
    881869  JSObject *header;
    882870  char *url;
     
    884872  char* tmpValue;
    885873  size_t dwRead;
    886   int i=0;
    887874  JS_MaybeGC(cx);
    888875  hInternet=InternetOpen("ZooWPSClient\0",
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