Changeset 640 for trunk/zoo-project/zoo-kernel/service_internal_js.c
- Timestamp:
- May 28, 2015, 4:25:06 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service_internal_js.c
r586 r640 23 23 */ 24 24 25 #include "service_internal.h" 25 #include "service_internal_js.h" 26 #include "response_print.h" 26 27 27 28 #ifndef JSCLASS_GLOBAL_FLAGS … … 67 68 JSLoadScripts(JSContext *cx, uintN argc, jsval *argv1) 68 69 { 69 //map* request = JS_GetContextPrivate(cx);70 //map* tmpm1=getMap(request,"metapath");71 70 JS_MaybeGC(cx); 72 71 … … 78 77 JS_MaybeGC(cx); 79 78 for(i=0;i<argc;i++){ 80 JSString* jsmsg = JS_ValueToString(cx,argv[i]);81 79 char *filename = JSValToChar(cx,&argv[i]); 82 80 char *api0=(char*)malloc((strlen(ntmp)+strlen(filename)+2)*sizeof(char)); … … 110 108 int zoo_js_support(maps** main_conf,map* request,service* s,maps **inputs,maps **outputs) 111 109 { 112 maps* main=*main_conf;110 /*maps* main=*main_conf; 113 111 maps* _inputs=*inputs; 114 maps* _outputs=*outputs; 112 maps* _outputs=*outputs;*/ 115 113 116 114 /* The class of the global object. */ … … 202 200 /* Your application code here. This may include JSAPI calls 203 201 to create your own custom JS objects and run scripts. */ 204 maps* out=*outputs;202 //maps* out=*outputs; 205 203 int res=SERVICE_FAILED; 206 maps* mc=*main_conf;204 //maps* mc=*main_conf; 207 205 map* tmpm2=getMap(s->content,"serviceProvider"); 208 206 … … 216 214 stat(filename, &file_status); 217 215 //char *source=(char*)malloc(file_status.st_size); 218 uint16 lineno;216 //uint16 lineno; 219 217 jsval rval; 220 218 JSBool ok ; … … 281 279 } 282 280 283 jsval t=OBJECT_TO_JSVAL(d);281 //jsval t=OBJECT_TO_JSVAL(d); 284 282 if(JS_IsArrayObject(cx,d)){ 285 283 #ifdef JS_DEBUG … … 395 393 if(s==0){ 396 394 jsval rval; 397 JSBool ok ;398 395 JSObject *script = JS_CompileFile(cx, JS_GetGlobalObject(cx), filename); 399 396 if(script!=NULL){ … … 425 422 JSObject* JSObject_FromMaps(JSContext *cx,maps* t){ 426 423 JSObject* res=JS_NewObject(cx, NULL, NULL, NULL); 427 //JSObject *res = JS_NewArrayObject(cx, 0, NULL);428 424 if(res==NULL) 429 425 fprintf(stderr,"Array Object is NULL!\n"); 430 426 maps* tmp=t; 431 427 while(tmp!=NULL){ 432 jsuint len;433 JSObject* res1=JS_NewObject(cx, NULL, NULL, NULL);434 428 JSObject *pval=JSObject_FromMap(cx,tmp->content); 435 429 jsval pvalj=OBJECT_TO_JSVAL(pval); … … 452 446 JSObject* JSObject_FromMap(JSContext *cx,map* t){ 453 447 JSObject* res=JS_NewObject(cx, NULL, NULL, NULL); 454 jsval resf = OBJECT_TO_JSVAL(res);455 448 map* tmpm=t; 456 449 map* isArray=getMap(t,"isArray"); … … 463 456 fprintf(stderr,"tmap is not null ! (%s = %s)\n",tmap->name,tmap->value); 464 457 #endif 465 while( tmpm!=NULL){458 while(isArray==NULL && tmpm!=NULL){ 466 459 jsval jsstr; 467 if((is Array==NULL && isBinary!=NULL && strncasecmp(tmpm->name,"value",5)==0))460 if((isBinary!=NULL && strncasecmp(tmpm->name,"value",5)==0)) 468 461 jsstr = STRING_TO_JSVAL(JS_NewStringCopyN(cx,tmpm->value,atoi(isBinary->value))); 469 462 else … … 534 527 jsval id = idp->vector[index]; 535 528 jsval vp; 536 JSString* str;537 529 JS_IdToValue(cx,id,&vp); 538 char * c, *tmp;530 char *tmp; 539 531 JSString *jsmsg; 540 532 size_t len1; … … 583 575 fprintf(stderr,"outputs array length : %d\n",len); 584 576 #endif 585 for(oi=0; oi < len;oi++){577 for(oi=0;hasLen && oi < len;oi++){ 586 578 #ifdef JS_DEBUG 587 579 fprintf(stderr,"outputs array length : %d step %d \n",len,oi); … … 605 597 jsval id = idp->vector[index]; 606 598 jsval vp; 607 JSString* str;608 599 JS_IdToValue(cx,id,&vp); 609 char * c, *tmp;600 char *tmp; 610 601 JSString *jsmsg; 611 602 size_t len1; … … 706 697 jsval id = idp->vector[index]; 707 698 jsval vp; 708 JSString* str;709 699 JS_IdToValue(cx,id,&vp); 710 char * c, *tmp, *tmp1;700 char *tmp, *tmp1; 711 701 JSString *jsmsg,*jsmsg1; 712 702 size_t len,len1; … … 877 867 jsval *argv = JS_ARGV(cx,argv1); 878 868 HINTERNET hInternet; 879 HINTERNET res;880 HINTERNET res1;881 869 JSObject *header; 882 870 char *url; … … 884 872 char* tmpValue; 885 873 size_t dwRead; 886 int i=0;887 874 JS_MaybeGC(cx); 888 875 hInternet=InternetOpen("ZooWPSClient\0",
Note: See TracChangeset
for help on using the changeset viewer.