Ignore:
Timestamp:
Sep 29, 2012, 3:59:06 PM (10 years ago)
Author:
djay
Message:

Update to make ZOO-Kernel able to compile and run from Windows Platforms. A special thanks to Espen Messel, Knut Landmark and Benrd Härtwig for providing many patches that I can successfully apply on the SVN source tree and to Farkas for continuing requesting for ZOO-Kernel to run on Windows platforms privately and through the ZOO-Discuss mailing list.

File:
1 edited

Legend:

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

    r360 r364  
    4545JSLoadScripts(JSContext *cx, uintN argc, jsval *argv1)
    4646{
    47   map* request = JS_GetContextPrivate(cx);
    48   map* tmpm1=getMap(request,"metapath");
     47  //map* request = JS_GetContextPrivate(cx);
     48  //map* tmpm1=getMap(request,"metapath");
    4949  JS_MaybeGC(cx);
    5050
     
    5858    JSString* jsmsg = JS_ValueToString(cx,argv[i]);
    5959    char *filename = JSValToChar(cx,&argv[i]);
    60     char api0[strlen(tmpm1->value)+strlen(ntmp)+strlen(filename)+2];
    61     sprintf(api0,"%s/%s/%s",ntmp,tmpm1->value,filename);
     60    char *api0=(char*)malloc((strlen(ntmp)+strlen(filename)+2)*sizeof(char));
     61    sprintf(api0,"%s/%s",ntmp,filename);
    6262#ifdef JS_DEBUG
    6363    fprintf(stderr,"Trying to load %s\n",api0);
     64    fflush(stderr);
    6465#endif
    6566    JSObject *api_script1=loadZooApiFile(cx,JS_GetGlobalObject(cx),api0);
    66     fflush(stderr);
    6767  }
    6868  JS_MaybeGC(cx);
     
    8383  JSClass global_class = {
    8484    "global", JSCLASS_GLOBAL_FLAGS,
    85     JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
     85    JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
    8686    JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
    8787    JSCLASS_NO_OPTIONAL_MEMBERS
     
    142142   * Load the first part of the ZOO-API
    143143   */
    144   char api0[strlen(tmpm1->value)+strlen(ntmp)+16];
     144  char *api0=(char*)malloc(strlen(tmpm1->value)+strlen(ntmp)+16);
    145145  sprintf(api0,"%s/%s/ZOO-proj4js.js",ntmp,tmpm1->value);
    146146#ifdef JS_DEBUG
     
    150150  fflush(stderr);
    151151
    152   char api1[strlen(tmpm1->value)+strlen(ntmp)+11];
     152  char *api1=(char*)malloc(strlen(tmpm1->value)+strlen(ntmp)+11);
    153153  sprintf(api1,"%s/%s/ZOO-api.js",ntmp,tmpm1->value);
    154154#ifdef JS_DEBUG
     
    165165  map* tmpm2=getMap(s->content,"serviceProvider");
    166166
    167   char filename[strlen(tmpm1->value)+strlen(tmpm2->value)+strlen(ntmp)+3];
     167  char *filename=(char*)malloc(strlen(tmpm1->value)+strlen(tmpm2->value)+strlen(ntmp)+3);
    168168  sprintf(filename,"%s/%s/%s",ntmp,tmpm1->value,tmpm2->value);
    169169  filename[strlen(tmpm1->value)+strlen(tmpm2->value)+strlen(ntmp)+2]=0;
     
    173173  struct stat file_status;
    174174  stat(filename, &file_status);
    175   char source[file_status.st_size];
     175  char *source=(char*)malloc(file_status.st_size);
    176176  uint16 lineno;
    177177  jsval rval;
     
    244244    fprintf(stderr,"An array was returned !\n");
    245245#endif
    246     jsint len;
     246    jsuint      len;
    247247    if((JS_GetArrayLength(cx, d, &len)==JS_FALSE)){
    248248#ifdef JS_DEBUG
     
    259259    JSBool hasElement=JS_GetElement(cx,d,1,&tmp2);
    260260    if(hasElement==JS_TRUE){
     261          freeMaps(outputs);
     262          free(*outputs);
    261263      *outputs=mapsFromJSObject(cx,tmp2);
    262264    }
     
    285287    *outputs=mapsFromJSObject(cx,tmp2);
    286288#ifdef JS_DEBUG
    287     dumpMaps(outputs);
    288 #endif
    289   }
    290 
     289    dumpMaps(*outputs);
     290#endif
     291  }
    291292  /* Cleanup. */
    292293  JS_DestroyContext(cx);
     
    355356  map* isBinary=getMap(t,"size");
    356357  map* tmap=getMapType(t);
     358#ifdef DEBUG
    357359  if(tmap==NULL)
    358360    fprintf(stderr,"tmap is null !\n");
    359361  else
    360362    fprintf(stderr,"tmap is not null ! (%s = %s)\n",tmap->name,tmap->value);
    361 
     363#endif
    362364  /* Avoid gesture of binary content which failed due to strlen function use */
    363365  if(isBinary!=NULL){
     
    441443
    442444        jsval nvp=JSVAL_NULL;
    443         if((JS_GetProperty(cx, JSVAL_TO_OBJECT(tt), JS_EncodeString(cx,jsmsg), &nvp)==JS_FALSE)){
     445        if((JS_GetProperty(cx, tt, JS_EncodeString(cx,jsmsg), &nvp)==JS_FALSE)){
    444446#ifdef JS_DEBUG
    445447          fprintf(stderr,"Enumerate id : %d => %s => No more value\n",oi,JS_EncodeString(cx,jsmsg));
     
    447449        }
    448450       
    449         JSObject *nvp1=JSVAL_NULL;
     451        JSObject *nvp1=JSVAL_TO_OBJECT(JSVAL_NULL);
    450452        JS_ValueToObject(cx,nvp,&nvp1);
    451453        jsval nvp1j=OBJECT_TO_JSVAL(nvp1);
     
    467469  }
    468470
    469   jsint len;
     471  jsuint len;
    470472  JSBool hasLen=JS_GetArrayLength(cx, tt, &len);
    471473  if(hasLen==JS_FALSE){
     
    522524        }
    523525
    524         JSObject *nvp1=JSVAL_NULL;
     526        JSObject *nvp1=JSVAL_TO_OBJECT(JSVAL_NULL);
    525527        JS_ValueToObject(cx,nvp,&nvp1);
    526528        jsval nvp1j=OBJECT_TO_JSVAL(nvp1);
    527529        if(JSVAL_IS_OBJECT(nvp1j)){
    528530          JSString *jsmsg1;
    529           JSObject *nvp2=JSVAL_NULL;
     531          JSObject *nvp2=JSVAL_TO_OBJECT(JSVAL_NULL);
    530532          jsmsg1 = JS_ValueToString(cx,nvp1j);
    531533          len1 = JS_GetStringLength(jsmsg1);
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