Changeset 333 for trunk/zoo-project/zoo-kernel
- Timestamp:
- Sep 9, 2011, 4:43:47 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service_internal_js.c
r329 r333 329 329 jsint oi=0; 330 330 JSObject* tt=JSVAL_TO_OBJECT(t); 331 #ifdef JS_DEBUG332 fprintf(stderr,"Is finally an array ?\n");333 331 if(JS_IsArrayObject(cx,tt)){ 332 #ifdef JS_DEBUG 334 333 fprintf(stderr,"Is finally an array !\n"); 335 } 336 else 334 #endif 335 } 336 else{ 337 #ifdef JS_DEBUG 337 338 fprintf(stderr,"Is not an array !\n"); 338 339 #endif 340 JSIdArray *idp=JS_Enumerate(cx,tt); 341 if(idp!=NULL) { 342 int index; 343 jsdouble argNum; 344 #ifdef JS_DEBUG 345 fprintf(stderr,"Properties length : %d \n",idp->length); 346 #endif 347 348 for (index=0,argNum=idp->length;index<argNum;index++) { 349 jsval id = idp->vector[index]; 350 jsval vp; 351 JSString* str; 352 JS_IdToValue(cx,id,&vp); 353 char *c, *tmp; 354 JSString *jsmsg; 355 size_t len1; 356 jsmsg = JS_ValueToString(cx,vp); 357 len1 = JS_GetStringLength(jsmsg); 358 359 tres=(maps*)malloc(MAPS_SIZE); 360 tres->name=strdup(JS_EncodeString(cx,jsmsg)); 361 tres->content=NULL; 362 tres->next=NULL; 363 364 jsval nvp=JSVAL_NULL; 365 if((JS_GetProperty(cx, JSVAL_TO_OBJECT(tt), JS_EncodeString(cx,jsmsg), &nvp)==JS_FALSE)){ 366 #ifdef JS_DEBUG 367 fprintf(stderr,"Enumerate id : %d => %s => No more value\n",oi,JS_EncodeString(cx,jsmsg)); 368 #endif 369 } 370 371 JSObject *nvp1=JSVAL_NULL; 372 JS_ValueToObject(cx,nvp,&nvp1); 373 jsval nvp1j=OBJECT_TO_JSVAL(nvp1); 374 if(JSVAL_IS_OBJECT(nvp1j)){ 375 tres->content=mapFromJSObject(cx,nvp1j); 376 } 377 378 if(res==NULL) 379 res=dupMaps(&tres); 380 else 381 addMapsToMaps(&res,tres); 382 freeMaps(&tres); 383 free(tres); 384 tres=NULL; 385 386 387 } 388 } 389 } 390 339 391 jsint len; 340 392 JSBool hasLen=JS_GetArrayLength(cx, tt, &len);
Note: See TracChangeset
for help on using the changeset viewer.