Changeset 274
- Timestamp:
- Jul 18, 2011, 1:46:56 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-api/js/ZOO-api.js
r189 r274 6067 6067 * needs to be interpreted. 6068 6068 */ 6069 Execute: function(inputs ) {6069 Execute: function(inputs,outputs) { 6070 6070 if (this.identifier == null) 6071 6071 return null; 6072 var body = new XML('<wps:Execute service="WPS" version="1.0.0" xmlns:wps="'+this.namespaces['wps']+'" xmlns:ows="'+this.namespaces['ows']+'" xmlns:xlink="'+this.namespaces['xlink']+'" xmlns:xsi="'+this.namespaces['xsi']+'" xsi:schemaLocation="'+this.schemaLocation+'"><ows:Identifier>'+this.identifier+'</ows:Identifier>'+this.buildDataInputsNode(inputs)+ '</wps:Execute>');6072 var body = new XML('<wps:Execute service="WPS" version="1.0.0" xmlns:wps="'+this.namespaces['wps']+'" xmlns:ows="'+this.namespaces['ows']+'" xmlns:xlink="'+this.namespaces['xlink']+'" xmlns:xsi="'+this.namespaces['xsi']+'" xsi:schemaLocation="'+this.schemaLocation+'"><ows:Identifier>'+this.identifier+'</ows:Identifier>'+this.buildDataInputsNode(inputs)+this.buildDataOutputsNode(outputs)+'</wps:Execute>'); 6073 6073 body = body.toXMLString(); 6074 6074 var response = ZOO.Request.Post(this.url,body,['Content-Type: text/xml; charset=UTF-8']); 6075 6075 return response; 6076 6076 }, 6077 /** 6078 * Property: buildInput 6079 * Object containing methods to build WPS inputs. 6080 */ 6081 buildInput: { 6082 /** 6083 * Method: buildInput.complex 6084 * Given an E4XElement representing the WPS complex data input. 6077 buildOutput:{ 6078 /** 6079 * Method: buildOutput.ResponseDocument 6080 * Given an E4XElement representing the WPS ResponseDocument output. 6085 6081 * 6086 6082 * Parameters: … … 6091 6087 * {E4XElement} A WPS Input node. 6092 6088 */ 6089 'ResponseDocument': function(identifier,obj) { 6090 var output = new XML('<wps:ResponseForm xmlns:wps="'+this.namespaces['wps']+'"><wps:ResponseDocument><wps:Output'+(obj["mimeType"]?' mimeType="'+obj["mimeType"]+'" ':'')+(obj["encoding"]?' encoding="'+obj["encoding"]+'" ':'')+(obj["asReference"]?' asReference="'+obj["asReference"]+'" ':'')+'><ows:Identifier xmlns:ows="'+this.namespaces['ows']+'">'+identifier+'</ows:Identifier></wps:Output></wps:ResponseDocument></wps:ResponseForm>'); 6091 if (obj.encoding) 6092 output.*::Data.*::ComplexData.@encoding = obj.encoding; 6093 if (obj.schema) 6094 output.*::Data.*::ComplexData.@schema = obj.schema; 6095 output = output.toXMLString(); 6096 return output; 6097 }, 6098 'RawDataOutput': function(identifier,obj) { 6099 var output = new XML('<wps:ResponseForm xmlns:wps="'+this.namespaces['wps']+'"><wps:RawDataOutput><wps:Output '+(obj["mimeType"]?' mimeType="'+obj["mimeType"]+'" ':'')+(obj["encoding"]?' encoding="'+obj["encoding"]+'" ':'')+'><ows:Identifier xmlns:ows="'+this.namespaces['ows']+'">'+identifier+'</ows:Identifier></wps:Output></wps:RawDataOutput></wps:ResponseForm>'); 6100 if (obj.encoding) 6101 output.*::Data.*::ComplexData.@encoding = obj.encoding; 6102 if (obj.schema) 6103 output.*::Data.*::ComplexData.@schema = obj.schema; 6104 output = output.toXMLString(); 6105 return output; 6106 } 6107 6108 }, 6109 /** 6110 * Property: buildInput 6111 * Object containing methods to build WPS inputs. 6112 */ 6113 buildInput: { 6114 /** 6115 * Method: buildInput.complex 6116 * Given an E4XElement representing the WPS complex data input. 6117 * 6118 * Parameters: 6119 * identifier - {String} the input indetifier 6120 * data - {Object} A WPS complex data input. 6121 * 6122 * Returns: 6123 * {E4XElement} A WPS Input node. 6124 */ 6093 6125 'complex': function(identifier,data) { 6094 6126 var input = new XML('<wps:Input xmlns:wps="'+this.namespaces['wps']+'"><ows:Identifier xmlns:ows="'+this.namespaces['ows']+'">'+identifier+'</ows:Identifier><wps:Data><wps:ComplexData>'+data.value+'</wps:ComplexData></wps:Data></wps:Input>'); 6095 input.*::Data.*::ComplexData.@mimeType = data.mimetype ? data.mimetype : ' text/plain';6127 input.*::Data.*::ComplexData.@mimeType = data.mimetype ? data.mimetype : 'application/json'; 6096 6128 if (data.encoding) 6097 6129 input.*::Data.*::ComplexData.@encoding = data.encoding; … … 6160 6192 return '<wps:DataInputs xmlns:wps="'+this.namespaces['wps']+'">'+inputsArray.join('\n')+'</wps:DataInputs>'; 6161 6193 }, 6194 6195 buildDataOutputsNode:function(outputs){ 6196 var data, builder, outputsArray=[]; 6197 for (var attr in outputs) { 6198 data = outputs[attr]; 6199 builder = this.buildOutput[data.type]; 6200 /*if (data.mimetype || data.type == 'complex') 6201 builder = this.buildInput['complex']; 6202 else if (data.type == 'reference' || data.type == 'url') 6203 builder = this.buildInput['reference']; 6204 else 6205 builder = this.buildInput['literal'];*/ 6206 outputsArray.push(builder.apply(this,[attr,data])); 6207 } 6208 return outputsArray.join('\n'); 6209 }, 6210 6162 6211 CLASS_NAME: "ZOO.Process" 6163 6212 }); -
trunk/zoo-kernel/configure.ac
r208 r274 314 314 JS_FILE="" 315 315 else 316 JS_FILE="service_internal_js.o" 316 317 if test "$JSHOME" = "yes" 317 318 then 318 JS_FILE="service_internal_js.o"319 319 320 320 #on teste si on est sous debian like 321 321 if test -f "/usr/bin/dpkg" 322 322 then 323 if test -n "`dpkg -l | grep libmozjs -dev`"323 if test -n "`dpkg -l | grep libmozjs185-dev`" 324 324 then 325 JS_CPPFLAGS="-I/usr/include/ mozjs/"326 JS_LDFLAGS="-L/usr/lib -lmozjs -lm"327 JS_LIB="mozjs "325 JS_CPPFLAGS="-I/usr/include/js/" 326 JS_LDFLAGS="-L/usr/lib -lmozjs185 -lm" 327 JS_LIB="mozjs185" 328 328 else 329 XUL_VERSION="`dpkg -l | grep xulrunner | grep dev | awk '{print $3;}' | sed -e 's/\([[0-9]]\{1,2\}\.[[0-9]]\{1,2\}\.[[0-9]]\{1,2\}\.[[0-9]]\{1,2\}\).*/\1/'`"329 XUL_VERSION="`dpkg -l | grep xulrunner | grep dev | awk '{print $3;}' | cut -d'+' -f1`" 330 330 if test -n "$XUL_VERSION" 331 331 then … … 334 334 JS_LIB="mozjs" 335 335 else 336 AC_MSG_ERROR([You must install libmozjs -dev or xulrunner-dev ])336 AC_MSG_ERROR([You must install libmozjs185-dev or xulrunner-dev ]) 337 337 fi 338 338 fi 339 339 else 340 AC_MSG_ERROR([You must specify your custom install of lib js])340 AC_MSG_ERROR([You must specify your custom install of libmozjs185]) 341 341 fi 342 342 else 343 JS_CPPFLAGS="-I$JSHOME/include/ "344 JS_LDFLAGS="-L$JSHOME/lib -lmozjs -lm"345 JS_LIB="mozjs "343 JS_CPPFLAGS="-I$JSHOME/include/js/" 344 JS_LDFLAGS="-L$JSHOME/lib -lmozjs185 -lm" 345 JS_LIB="mozjs185" 346 346 347 347 fi … … 356 356 LIBS="$JS_LDFLAGS" 357 357 358 AC_CHECK_LIB([$JS_LIB], [JS_ CallFunctionName], [], [AC_MSG_ERROR([could not find $JS_LIB])], [])358 AC_CHECK_LIB([$JS_LIB], [JS_NewCompartmentAndGlobalObject,JS_CompileFile,JS_CallFunctionName], [], [AC_MSG_ERROR([could not find $JS_LIB])], []) 359 359 360 360 AC_SUBST([JS_CPPFLAGS]) … … 366 366 367 367 AC_CONFIG_FILES([Makefile]) 368 AC_CONFIG_FILES([ZOOMakefile.opts]) 368 369 AC_OUTPUT -
trunk/zoo-kernel/service_internal.c
r255 r274 258 258 259 259 JSBool 260 JSUpdateStatus(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)260 JSUpdateStatus(JSContext *cx, uintN argc, jsval *argv1) 261 261 { 262 jsval *argv = JS_ARGV(cx,argv1); 262 263 JS_MaybeGC(cx); 263 264 char *sid; … … 280 281 } 281 282 if(getMapFromMaps(conf,"lenv","status")!=NULL){ 282 if(status!=NULL) 283 fprintf(stderr,"STATUS RETURNED : %s\n",status); 284 if(status!=NULL){ 283 285 setMapInMaps(conf,"lenv","status",status); 286 free(status); 287 } 284 288 else 285 289 setMapInMaps(conf,"lenv","status","15"); -
trunk/zoo-kernel/service_internal.h
r253 r274 83 83 #ifdef USE_JS 84 84 char* JSValToChar(JSContext*,jsval*); 85 JSBool JSUpdateStatus(JSContext*, JSObject*,uintN,jsval *,jsval *);85 JSBool JSUpdateStatus(JSContext*,uintN,jsval *); 86 86 #endif 87 87 -
trunk/zoo-kernel/service_internal_js.c
r42 r274 27 27 static char dbg[1024]; 28 28 29 JSBool 30 JSAlert(JSContext *cx, uintN argc, jsval *argv1) 31 { 32 jsval *argv = JS_ARGV(cx,argv1); 33 int i=0; 34 JS_MaybeGC(cx); 35 for(i=0;i<argc;i++){ 36 JSString* jsmsg = JS_ValueToString(cx,argv[i]); 37 fprintf(stderr,"[ZOO-API:JS] %s\n",JS_EncodeString(cx,jsmsg)); 38 } 39 JS_MaybeGC(cx); 40 41 return JS_TRUE; 42 } 43 29 44 int zoo_js_support(maps** main_conf,map* request,service* s, 30 45 maps **inputs,maps **outputs) … … 57 72 return 1; 58 73 } 59 JS_SetOptions(cx, JSOPTION_VAROBJFIX );74 JS_SetOptions(cx, JSOPTION_VAROBJFIX | JSOPTION_JIT | JSOPTION_METHODJIT); 60 75 JS_SetVersion(cx, JSVERSION_LATEST); 61 76 JS_SetErrorReporter(cx, reportError); 62 77 63 78 /* Create the global object. */ 64 global = JS_NewObject(cx, &global_class, NULL, NULL); 65 if (global == NULL){ 66 return 1; 67 } 79 global = JS_NewCompartmentAndGlobalObject(cx, &global_class, NULL); 68 80 69 81 /* Populate the global object with the standard globals, … … 72 84 return 1; 73 85 } 86 74 87 if (!JS_DefineFunction(cx, global, "ZOORequest", JSRequest, 4, 0)) 75 88 return 1; 76 89 if (!JS_DefineFunction(cx, global, "ZOOUpdateStatus", JSUpdateStatus, 2, 0)) 90 return 1; 91 if (!JS_DefineFunction(cx, global, "alert", JSAlert, 2, 0)) 77 92 return 1; 78 93 … … 86 101 char api0[strlen(tmpm1->value)+strlen(ntmp)+15]; 87 102 sprintf(api0,"%s/%sZOO-proj4js.js",ntmp,tmpm1->value); 103 #ifdef JS_DEBUG 88 104 fprintf(stderr,"Trying to load %s\n",api0); 89 JSScript *api_script1=loadZooApiFile(cx,global,api0); 105 #endif 106 JSObject *api_script1=loadZooApiFile(cx,global,api0); 90 107 fflush(stderr); 91 108 92 109 char api1[strlen(tmpm1->value)+strlen(ntmp)+11]; 93 110 sprintf(api1,"%s/%sZOO-api.js",ntmp,tmpm1->value); 111 #ifdef JS_DEBUG 94 112 fprintf(stderr,"Trying to load %s\n",api1); 95 JSScript *api_script2=loadZooApiFile(cx,global,api1); 113 #endif 114 JSObject *api_script2=loadZooApiFile(cx,global,api1); 96 115 fflush(stderr); 97 116 … … 106 125 sprintf(filename,"%s/%s%s",ntmp,tmpm1->value,tmpm2->value); 107 126 filename[strlen(tmpm1->value)+strlen(tmpm2->value)+strlen(ntmp)+1]=0; 127 #ifdef JS_DEBUG 108 128 fprintf(stderr,"FILENAME %s\n",filename); 129 #endif 109 130 struct stat file_status; 110 131 stat(filename, &file_status); … … 112 133 uint16 lineno; 113 134 jsval rval; 114 FILE *jsfile=fopen(filename,"r");115 135 JSBool ok ; 116 JS Script *script = JS_CompileFileHandle(cx, global, filename,jsfile);136 JSObject *script = JS_CompileFile(cx, global, filename); 117 137 if(script!=NULL){ 118 138 (void)JS_ExecuteScript(cx, global, script, &rval); … … 127 147 JS_DestroyRuntime(rt); 128 148 JS_ShutDown(); 129 fclose(jsfile);130 149 exit(-1); 131 150 } … … 161 180 if(strlen(dbg)==0) 162 181 sprintf(dbg,"No result was found after the function call"); 163 sprintf(tmp1,"Unable to run %s from the JavScript file %s : \n %s",s->name,filename,dbg); 182 sprintf(tmp1,"Unable to run %s from the JavaScript file %s : \n %s",s->name,filename,dbg); 183 #ifdef JS_DEBUG 164 184 fprintf(stderr,"%s",tmp1); 185 #endif 165 186 map* err=createMap("text",tmp1); 166 187 addToMap(err,"code","NoApplicableCode"); … … 211 232 jsval tmp2; 212 233 JSBool hasElement=JS_GetProperty(cx,d,"outputs",&tmp2); 234 #ifdef JS_DEBUG 213 235 if(!hasElement) 214 236 fprintf(stderr,"No outputs property returned\n"); … … 217 239 else 218 240 fprintf(stderr,"outputs is not an array as expected\n"); 241 #endif 219 242 *outputs=mapsFromJSObject(cx,tmp2); 220 243 #ifdef JS_DEBUG 221 dumpMaps(out );244 dumpMaps(outputs); 222 245 #endif 223 246 } 224 247 225 248 /* Cleanup. */ 226 JS_DestroyScript(cx, script); 227 JS_DestroyScript(cx, api_script1); 228 JS_DestroyScript(cx, api_script2); 229 //JS_MaybeGC(cx); 230 // If we use the DestroyContext as requested to release memory then we get 231 // issue getting back the main configuration maps after coming back to the 232 // runRequest function ... 233 //JS_DestroyContext(cx); 249 JS_DestroyContext(cx); 234 250 JS_DestroyRuntime(rt); 235 251 JS_ShutDown(); … … 240 256 } 241 257 242 JS Script * loadZooApiFile(JSContext *cx,JSObject *global, char* filename){258 JSObject * loadZooApiFile(JSContext *cx,JSObject *global, char* filename){ 243 259 struct stat api_status; 244 260 int s=stat(filename, &api_status); 245 261 if(s==0){ 246 262 jsval rval; 247 FILE *jsfile=fopen(filename,"r");248 263 JSBool ok ; 249 JS Script *script = JS_CompileFileHandle(cx, global, filename,jsfile);264 JSObject *script = JS_CompileFile(cx, JS_GetGlobalObject(cx), filename); 250 265 if(script!=NULL){ 251 (void)JS_ExecuteScript(cx, global, script, &rval); 266 (void)JS_ExecuteScript(cx, JS_GetGlobalObject(cx), script, &rval); 267 #ifdef JS_DEBUG 252 268 fprintf(stderr,"**************\n%s correctly loaded\n**************\n",filename); 269 #endif 253 270 return script; 254 271 } 272 #ifdef JS_DEBUG 255 273 else 256 274 fprintf(stderr,"\n**************\nUnable to run %s\n**************\n",filename); 257 } 275 #endif 276 } 277 #ifdef JS_DEBUG 258 278 else 259 279 fprintf(stderr,"\n**************\nUnable to load %s\n**************\n",filename); 280 #endif 260 281 return NULL; 261 282 } … … 288 309 map* tmpm=t; 289 310 while(tmpm!=NULL){ 290 jsval jsstr = STRING_TO_JSVAL(JS_NewString (cx,tmpm->value,strlen(tmpm->value)));311 jsval jsstr = STRING_TO_JSVAL(JS_NewStringCopyN(cx,tmpm->value,strlen(tmpm->value))); 291 312 JS_SetProperty(cx, res, tmpm->name,&jsstr); 292 313 #ifdef JS_DEBUG … … 335 356 fprintf(stderr,"Properties length : %d \n",idp->length); 336 357 #endif 358 tres=(maps*)malloc(MAPS_SIZE); 359 tres->name=NULL; 360 tres->content=NULL; 361 tres->next=NULL; 362 337 363 for (index=0,argNum=idp->length;index<argNum;index++) { 338 364 jsval id = idp->vector[index]; … … 346 372 len1 = JS_GetStringLength(jsmsg); 347 373 #ifdef JS_DEBUG 348 fprintf(stderr,"Enumerate id : %d => %s\n",oi,JS_ GetStringBytes(jsmsg));374 fprintf(stderr,"Enumerate id : %d => %s\n",oi,JS_EncodeString(cx,jsmsg)); 349 375 #endif 350 376 jsval nvp=JSVAL_NULL; 351 if((JS_GetProperty(cx, JSVAL_TO_OBJECT(tmp1), JS_GetStringBytes(jsmsg), &nvp)==JS_FALSE)) 352 #ifdef JS_DEBUG 353 fprintf(stderr,"Enumerate id : %d => %s => No more value\n",oi,JS_GetStringBytes(jsmsg)); 354 #endif 377 if((JS_GetProperty(cx, JSVAL_TO_OBJECT(tmp1), JS_EncodeString(cx,jsmsg), &nvp)==JS_FALSE)){ 378 #ifdef JS_DEBUG 379 fprintf(stderr,"Enumerate id : %d => %s => No more value\n",oi,JS_EncodeString(cx,jsmsg)); 380 #endif 381 } 382 355 383 if(JSVAL_IS_OBJECT(nvp)){ 356 384 #ifdef JS_DEBUG … … 358 386 #endif 359 387 } 360 #ifdef JS_DEBUG 361 else 362 fprintf(stderr,"JSVAL NVP IS NOT OBJECT !!\n"); 363 #endif 364 JSObject *nvp1; 388 389 JSObject *nvp1=JSVAL_NULL; 365 390 JS_ValueToObject(cx,nvp,&nvp1); 366 391 jsval nvp1j=OBJECT_TO_JSVAL(nvp1); 367 392 if(JSVAL_IS_OBJECT(nvp1j)){ 368 #ifdef JS_DEBUG 369 fprintf(stderr,"JSVAL NVP1J IS OBJECT\n"); 370 #endif 371 tres=(maps*)malloc(MAPS_SIZE); 372 tres->name=strdup(JS_GetStringBytes(jsmsg)); 373 tres->content=mapFromJSObject(cx,nvp1j); 374 tres->next=NULL; 375 #ifdef JS_DEBUG 376 dumpMaps(res); 377 #endif 378 if(res==NULL) 379 res=dupMaps(&tres); 393 JSString *jsmsg1; 394 JSObject *nvp2=JSVAL_NULL; 395 jsmsg1 = JS_ValueToString(cx,nvp1j); 396 len1 = JS_GetStringLength(jsmsg1); 397 //#ifdef JS_DEBUG 398 fprintf(stderr,"JSVAL NVP1J IS OBJECT %s = %s\n",JS_EncodeString(cx,jsmsg),JS_EncodeString(cx,jsmsg1)); 399 //#endif 400 if(strcasecmp(JS_EncodeString(cx,jsmsg1),"[object Object]")==0){ 401 tres->name=strdup(JS_EncodeString(cx,jsmsg)); 402 tres->content=mapFromJSObject(cx,nvp1j); 403 } 380 404 else 381 addMapsToMaps(&res,tres); 382 freeMaps(&tres); 383 free(tres); 384 tres=NULL; 385 #ifdef JS_DEBUG 386 dumpMaps(res); 387 #endif 405 if(strcasecmp(JS_EncodeString(cx,jsmsg),"name")==0){ 406 tres->name=strdup(JS_EncodeString(cx,jsmsg1)); 407 } 408 else{ 409 if(tres->content==NULL) 410 tres->content=createMap(JS_EncodeString(cx,jsmsg),JS_EncodeString(cx,jsmsg1)); 411 else 412 addToMap(tres->content,JS_EncodeString(cx,jsmsg),JS_EncodeString(cx,jsmsg1)); 413 } 388 414 } 389 415 #ifdef JS_DEBUG … … 391 417 fprintf(stderr,"JSVAL NVP1J IS NOT OBJECT !!\n"); 392 418 #endif 419 393 420 } 421 //#ifdef JS_DEBUG 422 dumpMaps(tres); 423 //#endif 424 if(res==NULL) 425 res=dupMaps(&tres); 426 else 427 addMapsToMaps(&res,tres); 428 freeMaps(&tres); 429 free(tres); 430 tres=NULL; 431 394 432 } 395 433 } 396 #ifdef JS_DEBUG434 //#ifdef JS_DEBUG 397 435 dumpMaps(res); 398 #endif436 //#endif 399 437 return res; 400 438 } … … 423 461 len = JS_GetStringLength(jsmsg); 424 462 jsval nvp; 425 JS_GetProperty(cx, JSVAL_TO_OBJECT(t), JS_ GetStringBytes(jsmsg), &nvp);463 JS_GetProperty(cx, JSVAL_TO_OBJECT(t), JS_EncodeString(cx,jsmsg), &nvp); 426 464 jsmsg1 = JS_ValueToString(cx,nvp); 427 465 len1 = JS_GetStringLength(jsmsg1); 428 466 #ifdef JS_DEBUG 429 fprintf(stderr,"Enumerate id : %d [ %s => %s ]\n",index,JS_ GetStringBytes(jsmsg),JS_GetStringBytes(jsmsg1));467 fprintf(stderr,"Enumerate id : %d [ %s => %s ]\n",index,JS_EncodeString(cx,jsmsg),JS_EncodeString(cx,jsmsg1)); 430 468 #endif 431 469 if(res!=NULL){ 432 470 #ifdef JS_DEBUG 433 fprintf(stderr,"%s - %s\n",JS_ GetStringBytes(jsmsg),JS_GetStringBytes(jsmsg1));434 #endif 435 addToMap(res,JS_ GetStringBytes(jsmsg),JS_GetStringBytes(jsmsg1));471 fprintf(stderr,"%s - %s\n",JS_EncodeString(cx,jsmsg),JS_EncodeString(cx,jsmsg1)); 472 #endif 473 addToMap(res,JS_EncodeString(cx,jsmsg),JS_EncodeString(cx,jsmsg1)); 436 474 } 437 475 else{ 438 res=createMap(JS_ GetStringBytes(jsmsg),JS_GetStringBytes(jsmsg1));476 res=createMap(JS_EncodeString(cx,jsmsg),JS_EncodeString(cx,jsmsg1)); 439 477 res->next=NULL; 440 478 } -
trunk/zoo-kernel/service_internal_js.h
r42 r274 52 52 int zoo_js_support(maps**,map*,service*,maps **,maps **); 53 53 54 JS Script *loadZooApiFile(JSContext*,JSObject*,char*);54 JSObject *loadZooApiFile(JSContext*,JSObject*,char*); 55 55 56 56 #ifdef __cplusplus -
trunk/zoo-kernel/ulinet.c
r93 r274 385 385 jsmsg = JS_ValueToString(context,*arg); 386 386 len = JS_GetStringLength(jsmsg); 387 tmp = JS_ GetStringBytes(jsmsg);387 tmp = JS_EncodeString(context,jsmsg); 388 388 c = (char*)malloc((len+1)*sizeof(char)); 389 389 c[len] = '\0'; … … 435 435 436 436 JSBool 437 JSRequest(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)437 JSRequest(JSContext *cx, uintN argc, jsval *argv1) 438 438 { 439 jsval *argv = JS_ARGV(cx,argv1); 439 440 HINTERNET hInternet; 440 441 char *url; … … 488 489 fprintf(stderr,"content downloaded (%d) (%s) \n",dwRead,tmpValue); 489 490 #endif 490 *rval=STRING_TO_JSVAL(JS_NewString(cx,tmpValue,strlen(tmpValue)));491 JS_SET_RVAL(cx, argv1,STRING_TO_JSVAL(JS_NewStringCopyN(cx,tmpValue,strlen(tmpValue)))); 491 492 free(url); 492 493 if(argc>=2) -
trunk/zoo-kernel/ulinet.h
r1 r274 138 138 139 139 #ifdef USE_JS 140 JSBool JSRequest(JSContext*, JSObject*, uintN, jsval*, jsval*);140 JSBool JSRequest(JSContext*, uintN, jsval*); 141 141 #endif 142 142 -
trunk/zoo-kernel/zoo_service_loader.c
r260 r274 1632 1632 * Title, Asbtract 1633 1633 */ 1634 if(xmlStrncasecmp(cur2->name,BAD_CAST "Title",xmlStrlen(cur2->name))==0 ||1634 else if(xmlStrncasecmp(cur2->name,BAD_CAST "Title",xmlStrlen(cur2->name))==0 || 1635 1635 xmlStrncasecmp(cur2->name,BAD_CAST "Abstract",xmlStrlen(cur2->name))==0){ 1636 1636 xmlChar *val=
Note: See TracChangeset
for help on using the changeset viewer.