Ignore:
Timestamp:
Aug 26, 2011, 3:53:26 PM (4 years ago)
Author:
djay
Message:

Fix bug #62. Use the same data structure in JS as in Python. Fix again bug #42.

File:
1 edited

Legend:

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

    r287 r328  
    7777
    7878  /* Create the global object. */
    79   //global = JS_NewCompartmentAndGlobalObject(cx, &global_class, NULL);
    80   global = JS_NewObject(cx, &global_class, NULL,NULL);
     79  //#ifdef JS_NewCompartmentAndGlobalObject
     80  global = JS_NewCompartmentAndGlobalObject(cx, &global_class, NULL);
     81  //#else
     82  //global = JS_NewObject(cx, &global_class, NULL,NULL);
     83  //#endif
    8184
    8285  /* Populate the global object with the standard globals,
     
    284287
    285288JSObject* JSObject_FromMaps(JSContext *cx,maps* t){
    286   JSObject *res = JS_NewArrayObject(cx, 0, NULL);
     289
     290  JSObject* res=JS_NewObject(cx, NULL, NULL, NULL);
     291  //JSObject *res = JS_NewArrayObject(cx, 0, NULL);
    287292  if(res==NULL)
    288293    fprintf(stderr,"Array Object is NULL!\n");
    289294  maps* tmp=t;
     295
    290296  while(tmp!=NULL){
    291297    jsuint len;
     
    293299    JSObject *pval=JSObject_FromMap(cx,tmp->content);
    294300    jsval pvalj=OBJECT_TO_JSVAL(pval);
    295     JS_SetProperty(cx, res1, tmp->name, &pvalj);
    296     JS_GetArrayLength(cx, res, &len);
    297     jsval res1j = OBJECT_TO_JSVAL(res1);
    298     JS_SetElement(cx,res,len,&res1j);
     301    JS_SetProperty(cx, res, tmp->name, &pvalj);
     302
    299303#ifdef JS_DEBUG
    300304    fprintf(stderr,"Length of the Array %d, element : %s added \n",len,tmp->name);
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