Changeset 336 for trunk/zoo-project/zoo-kernel
- Timestamp:
- Sep 22, 2011, 2:59:40 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service_internal_js.c
r333 r336 42 42 } 43 43 44 JSBool 45 JSLoadScripts(JSContext *cx, uintN argc, jsval *argv1) 46 { 47 map* request = JS_GetContextPrivate(cx); 48 map* tmpm1=getMap(request,"metapath"); 49 JS_MaybeGC(cx); 50 51 char ntmp[1024]; 52 getcwd(ntmp,1024); 53 54 jsval *argv = JS_ARGV(cx,argv1); 55 int i=0; 56 JS_MaybeGC(cx); 57 for(i=0;i<argc;i++){ 58 JSString* jsmsg = JS_ValueToString(cx,argv[i]); 59 char *filename = JSValToChar(cx,&argv[i]); 60 char api0[strlen(tmpm1->value)+strlen(ntmp)+strlen(filename)+2]; 61 sprintf(api0,"%s/%s/%s",ntmp,tmpm1->value,filename); 62 #ifdef JS_DEBUG 63 fprintf(stderr,"Trying to load %s\n",api0); 64 #endif 65 JSObject *api_script1=loadZooApiFile(cx,JS_GetGlobalObject(cx),api0); 66 fflush(stderr); 67 } 68 JS_MaybeGC(cx); 69 JS_SET_RVAL(cx, argv1, JSVAL_VOID); 70 71 return JS_TRUE; 72 } 73 74 44 75 int zoo_js_support(maps** main_conf,map* request,service* s, 45 76 maps **inputs,maps **outputs) … … 94 125 return 1; 95 126 if (!JS_DefineFunction(cx, global, "alert", JSAlert, 2, 0)) 127 return 1; 128 if (!JS_DefineFunction(cx, global, "importScripts", JSLoadScripts, 1, 0)) 96 129 return 1; 97 130 131 /** 132 * Add private context object 133 */ 134 void* cxPrivate = request; 135 JS_SetContextPrivate(cx,cxPrivate); 136 98 137 map* tmpm1=getMap(request,"metapath"); 99 138 char ntmp[1024];
Note: See TracChangeset
for help on using the changeset viewer.