Changeset 403 for trunk/zoo-project/zoo-kernel/service_internal_js.c
- Timestamp:
- Mar 27, 2013, 9:32:42 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service_internal_js.c
r384 r403 112 112 113 113 /* Create the global object. */ 114 //#ifdef JS_NewCompartmentAndGlobalObject115 114 global = JS_NewCompartmentAndGlobalObject(cx, &global_class, NULL); 116 //#else117 //global = JS_NewObject(cx, &global_class, 0,0);118 //#endif119 115 120 116 /* Populate the global object with the standard globals, … … 124 120 } 125 121 122 /* Define specific function and global variable to share with JS runtime 123 */ 126 124 jsval tmp=INT_TO_JSVAL(3); 127 125 if (!JS_SetProperty(cx, global, "SERVICE_SUCCEEDED", &tmp)) … … 385 383 fprintf(stderr,"Array Object is NULL!\n"); 386 384 maps* tmp=t; 387 388 385 while(tmp!=NULL){ 389 386 jsuint len; … … 392 389 jsval pvalj=OBJECT_TO_JSVAL(pval); 393 390 JS_SetProperty(cx, res, tmp->name, &pvalj); 394 395 391 #ifdef JS_DEBUG 396 392 fprintf(stderr,"Length of the Array %d, element : %s added \n",len,tmp->name); … … 408 404 map* isBinary=getMap(t,"size"); 409 405 map* tmap=getMapType(t); 410 #ifdef DEBUG406 #ifdef JS_DEBUG 411 407 if(tmap==NULL) 412 408 fprintf(stderr,"tmap is null !\n"); … … 414 410 fprintf(stderr,"tmap is not null ! (%s = %s)\n",tmap->name,tmap->value); 415 411 #endif 416 /* Avoid gesture of binary content which failed due to strlen function use */ 417 if(isBinary!=NULL){ 418 return res; 419 } 420 while(tmpm!=NULL){ 421 if(isArray==NULL || strncasecmp(tmpm->name,"value",5)!=0 || 422 (tmap!=NULL && strncasecmp(tmpm->name,tmap->name,strlen(tmap->name))!=0)){ 423 jsval jsstr = STRING_TO_JSVAL(JS_NewStringCopyN(cx,tmpm->value,strlen(tmpm->value))); 412 if(isArray==NULL){ 413 while(tmpm!=NULL){ 414 jsval jsstr; 415 if(isBinary!=NULL && strncasecmp(tmpm->name,"value",5)==0) 416 jsstr = STRING_TO_JSVAL(JS_NewStringCopyN(cx,tmpm->value,atoi(isBinary->value))); 417 else 418 jsstr = STRING_TO_JSVAL(JS_NewStringCopyN(cx,tmpm->value,strlen(tmpm->value))); 424 419 JS_SetProperty(cx, res, tmpm->name,&jsstr); 425 420 #ifdef JS_DEBUG 426 fprintf(stderr," %s => %s\n",tmpm->name,tmpm->value);427 #endif 428 }429 tmpm=tmpm->next;430 } 431 if(isArray!=NULL){421 fprintf(stderr,"[JS] %s => %s\n",tmpm->name,tmpm->value); 422 #endif 423 tmpm=tmpm->next; 424 } 425 } 426 else{ 432 427 map* len=getMap(t,"length"); 433 428 int cnt=atoi(len->value); … … 515 510 free(tres); 516 511 tres=NULL; 517 518 512 519 513 } 520 514 } … … 604 598 fprintf(stderr,"JSVAL NVP1J IS NOT OBJECT !!\n"); 605 599 #endif 606 607 600 } 608 601 #ifdef JS_DEBUG
Note: See TracChangeset
for help on using the changeset viewer.