本文整理汇总了C++中JS_FS函数的典型用法代码示例。如果您正苦于以下问题:C++ JS_FS函数的具体用法?C++ JS_FS怎么用?C++ JS_FS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了JS_FS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: webInit
void webInit(JSContext *cx){
curl_global_init(CURL_GLOBAL_DEFAULT);
curlHandle = curl_multi_init();
if(!curlHandle){
fprint(stderr,"Unable to start curl\n");
exit(EXIT_FAILURE);
}
JSObject* object = NULL;
object = JS_DefineObject(cx, JS_GetGlobalObject(cx),"web", NULL, NULL,0);
if(object) {
static JSFunctionSpec webFuncSpec[5]= {
JS_FS("getRq", webGetRq,0,0),
JS_FS("postRq", webPostRq,0,0),
JS_FS("launchBrowser",webLaunchBrowser,0,0),
JS_FS("monsterHash",webMonsterHash,0,0),
JS_FS_END
};
if(!JS_DefineFunctions(cx, object, webFuncSpec))
fprint(stderr,"Unable to create web object\n");
print("loaded module web\n");
} else {
fprint(stderr,"Problem creating web object, perhaps oom\n EXITING\n");
exit(EXIT_FAILURE);
}
}
示例2: initLine
void initLine(JSContext *cx){
static JSFunctionSpec lineFuncSpec[3]= {
JS_FS("drawLines", drawLines,0,0),
JS_FS("addPoint",addPoint,0,0),
JS_FS_END
};
JS_InitClass(cx, JS_GetGlobalObject(cx), NULL , &lineList, constructorLL, 1, NULL , lineFuncSpec,NULL,NULL);
}
示例3: utilInit
void utilInit(JSContext *cx){
JSObject* object = NULL;
object = JS_DefineObject(cx, JS_GetGlobalObject(cx),"util", NULL, NULL,0);
if(object) {
static const JSFunctionSpec utilFuncSpec[2] = {
JS_FS("forceGC", utilForceGC,0,0),
JS_FS_END
};
if(!JS_DefineFunctions(cx, object, utilFuncSpec))
fprint(stderr,"Unable to create util object\n");
//print("loaded module util\n");
} else {
fprint(stderr,"Problem creating util object, perhaps oom\n EXITING\n");
exit(EXIT_FAILURE);
}
}
示例4: init
//---------------------------------------------------
// Exposing the functionality
//---------------------------------------------------
JSBool init(JSContext* cx, JSObject* scope)
{
JSFunctionSpec functions[] = {
// VOID FUNCTION, 1 PARAMETER
JS_FS("void_param0_constCharPtr", void_param0_constCharPtr_wrap, 1, 0),
JS_FS("void_param0_stdString", void_param0_stdString_wrap, 1, 0),
JS_FS("void_param0_constStdStringRef", void_param0_constStdStringRef_wrap, 1, 0),
// RETURN VALUE, NO PARAMETER
JS_FS("constCharPtr_param0", constCharPtr_param0_wrap, 0, 0),
JS_FS("stdString_param0", stdString_param0_wrap, 0, 0),
JS_FS("constStdStringRef_param0", constStdStringRef_param0_wrap, 0, 0),
JS_FS("constStdStringPtr_param0", constStdStringPtr_param0_wrap, 0, 0),
JS_FS_END
};
if(!JS_DefineFunctions(cx, scope, functions))
return false;
return true;
}
示例5: rstr_release
ji->ji_root, NULL, 0, 0, year, season, episode,
0);
rstr_release(imdb);
rstr_release(title);
*rval = JSVAL_VOID;
return JS_TRUE;
}
/**
*
*/
static JSFunctionSpec item_proto_functions[] = {
JS_FS("onEvent", js_item_onEvent, 2, 0, 0),
JS_FS("destroy", js_item_destroy, 0, 0, 0),
JS_FS("addOptURL", js_item_addOptURL, 2, 0, 0),
JS_FS("addOptAction", js_item_addOptAction, 2, 0, 0),
JS_FS("addOptSeparator", js_item_addOptSeparator, 1, 0, 0),
JS_FS("dump", js_item_dump, 0, 0, 0),
JS_FS("enable", js_item_enable, 0, 0, 0),
JS_FS("disable", js_item_disable, 0, 0, 0),
JS_FS("moveBefore", js_item_moveBefore, 1, 0, 0),
JS_FS("bindVideoMetadata", js_item_bindVideoMetadata, 1, 0, 0),
JS_FS_END
};
/**
*
示例6: JS_FS
////////////////////////////////////////////////////////////////////////////////
// Class: http
// Description: Manages HTTP state
////////////////////////////////////////////////////////////////////////////////
// Section: Global variables
struct unit_ext m_http_ext = {
.load = m_http_load,
.post = m_http_post,
.unload = m_http_unload,
};
static JSFunctionSpec m_http_functions[] = {
JS_FS("header", m_http_header, 1, 0),
JS_FS("setcookie", m_http_setcookie, 1, 0),
JS_FS("session", m_http_session, 0, 0),
JS_FS_END
};
////////////////////////////////////////////////////////////////////////////////
// Section: Interface
JSBool m_http_load(unit_t n) {
if (!JS_DefineFunctions(n->context, n->global, m_http_functions))
return JS_FALSE;
return JS_TRUE;
}
JSBool m_http_post(unit_t n) {
示例7: JS_FS
#include <string.h>
#include <errno.h>
// lib includes
#include <jsapi.h>
// local includes
#include "../../pistonmonkey.h"
#include "../../jsutil.h"
#include "../../memutil.h"
#include "File.h"
// local globals
static JSFunctionSpec File_functions[] =
{
JS_FS("exists", File_function_exists, 0, 0, 0),
JS_FS("isFile", File_function_isFile, 0, 0, 0),
JS_FS("isDirectory", File_function_isDirectory, 0, 0, 0),
JS_FS("readAll", File_function_readAll, 0, 0, 0),
JS_FS("size", File_function_size, 0, 0, 0),
JS_FS_END
};
static JSFunctionSpec File_functions_static[] =
{
JS_FS("exists", File_function_exists_static, 0, 0, 0),
JS_FS("isFile", File_function_isFile_static, 0, 0, 0),
JS_FS("isDirectory", File_function_isDirectory_static, 0, 0, 0),
JS_FS("readAll", File_function_readAll_static, 0, 0, 0),
JS_FS("size", File_function_size_static, 0, 0, 0),
JS_FS_END
示例8: switch
switch (rpmaugPrint(aug, NULL, _path)) {
case 0: /* success */
*rval = JSVAL_TRUE;
break;
default:
case -1: /* failure */
*rval = JSVAL_FALSE;
break;
}
ok = JS_TRUE;
exit:
return ok;
}
static JSFunctionSpec rpmaug_funcs[] = {
JS_FS("defvar", rpmaug_defvar, 0,0),
JS_FS("get", rpmaug_get, 0,0),
JS_FS("set", rpmaug_set, 0,0),
JS_FS("insert", rpmaug_insert, 0,0),
JS_FS("rm", rpmaug_rm, 0,0),
JS_FS("remove", rpmaug_rm, 0,0),
JS_FS("mv", rpmaug_mv, 0,0),
JS_FS("move", rpmaug_mv, 0,0),
JS_FS("match", rpmaug_match, 0,0),
JS_FS("save", rpmaug_save, 0,0),
JS_FS("load", rpmaug_load, 0,0),
JS_FS("print", rpmaug_print, 0,0),
JS_FS_END
};
/* --- Object properties */
示例9: JS_FS
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
req_dtor,
JSCLASS_NO_OPTIONAL_MEMBERS
};
JSPropertySpec CouchHTTPProperties[] = {
{"status", 0, JSPROP_READONLY, req_status, NULL},
{0, 0, 0, 0, 0}
};
JSFunctionSpec CouchHTTPFunctions[] = {
JS_FS("_open", (JSNative) req_open, 3, JSFUN_FAST_NATIVE, 0),
JS_FS("_setRequestHeader", (JSNative) req_set_hdr, 2, JSFUN_FAST_NATIVE, 0),
JS_FS("_send", (JSNative) req_send, 1, JSFUN_FAST_NATIVE, 0),
JS_FS_END
};
static JSClass global_class = {
"GlobalClass",
JSCLASS_GLOBAL_FLAGS,
JS_PropertyStub,
JS_PropertyStub,
JS_PropertyStub,
JS_PropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
示例10: JS_FS
{"SYSLOG_LOCAL7", LOG_LOCAL7},
#if 0
// syslog priorities
{"SYSLOG_EMERG", LOG_EMERG},
{"SYSLOG_ALERT", LOG_ALERT},
{"SYSLOG_CRIT", LOG_CRIT},
{"SYSLOG_ERR", LOG_ERR},
{"SYSLOG_WARNING", LOG_WARNING},
{"SYSLOG_NOTICE", LOG_NOTICE},
{"SYSLOG_INFO", LOG_INFO},
{"SYSLOG_DEBUG", LOG_DEBUG},
#endif
};
static JSFunctionSpec Sys_functions[] = {
JS_FS("openlog", Sys_openlog, 2, 0),
JS_FS("loadModule", Sys_loadModule, 1, 0),
JS_FS_END
};
JSBool js_sys_init(JSContext *cx, JSObject *global)
{
JSObject *sys;
unsigned i;
sys = JS_DefineObject(cx, global, Sys_class.name, &Sys_class, NULL, 0);
if (!sys)
return JS_FALSE;
if (!JS_DefineFunctions(cx, sys, Sys_functions))
return JS_FALSE;
示例11: GET_PRIVATE
GET_PRIVATE(ch);
return JS_TRUE;
}
JSPropertySpec ngx_http_js__nginx_chain__props[] =
{
// {"uri", REQUEST_URI, JSPROP_READONLY, NULL, NULL},
{0, 0, 0, NULL, NULL}
};
JSFunctionSpec ngx_http_js__nginx_chain__funcs[] = {
JS_FS("toString", method_toString, 0, 0, 0),
JS_FS_END
};
JSClass ngx_http_js__nginx_chain__class =
{
"Chain",
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(NGX_JS_CHAIN_SLOTS_COUNT),
JS_PropertyStub, JS_PropertyStub, getProperty, setProperty,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
JSCLASS_NO_OPTIONAL_MEMBERS
};
JSBool
ngx_http_js__nginx_chain__init(JSContext *cx, JSObject *global)
{
示例12: fprintf
*rval = JSVAL_FALSE;
{ int ret = mpf->sync(mpf);
if (ret)
fprintf(stderr, "DB_MPOOLFILE->sync: %s\n", db_strerror(ret));
*rval = (!ret ? JSVAL_TRUE : JSVAL_FALSE);
}
ok = JS_TRUE;
exit:
return ok;
}
static JSFunctionSpec rpmmpf_funcs[] = {
JS_FS("close", rpmmpf_Close, 0,0,0),
JS_FS("get", rpmmpf_Get, 0,0,0),
JS_FS("open", rpmmpf_Open, 0,0,0),
JS_FS("put", rpmmpf_Put, 0,0,0),
JS_FS("sync", rpmmpf_Sync, 0,0,0),
JS_FS_END
};
/* --- Object properties */
#define _TABLE(_v) #_v, _##_v, JSPROP_ENUMERATE, NULL, NULL
enum rpmmpf_tinyid {
_DEBUG = -2,
_CLEARLEN = -3,
_FILEID = -4,
示例13: JS_ARGV
jsval *argv = JS_ARGV(cx, vp);
JSObject *obj = JS_THIS_OBJECT(cx, vp);
void * ptr = JS_GetInstancePrivate(cx, obj, &rpmpsClass, NULL);
rpmps ps = ptr;
JSBool ok = JS_FALSE;
_METHOD_DEBUG_ENTRY(_debug);
rpmpsPrint(NULL, ps);
ok = JS_TRUE;
return ok;
}
static JSFunctionSpec rpmps_funcs[] = {
JS_FS("push", rpmps_push, 0,0),
JS_FS("print", rpmps_print, 0,0),
JS_FS_END
};
/* --- Object properties */
enum rpmps_tinyid {
_DEBUG = -2,
_LENGTH = -3,
};
static JSPropertySpec rpmps_props[] = {
{"debug", _DEBUG, JSPROP_ENUMERATE, NULL, NULL},
{"length", _LENGTH, JSPROP_ENUMERATE, NULL, NULL},
{NULL, 0, 0, NULL, NULL}
};
示例14: BackdropGetColorFunc
return JS_TRUE;
}
JSBool
BackdropGetColorFunc(JSContext *cx, unsigned argc, jsval *vp)
{
uint8_t r, g, b;
backdrop_get_color(&r, &g, &b);
JSObject *list = JS_NewArrayObject(cx, 3, NULL);
if (list) {
JS::Value val;
val = INT_TO_JSVAL(red);
JS_SetElement(cx, list, 0, &val);
val = INT_TO_JSVAL(green);
JS_SetElement(cx, list, 1, &val);
val = INT_TO_JSVAL(blue);
JS_SetElement(cx, list, 2, &val);
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(list));
return JS_TRUE;
}
return JS_FALSE;
}
JSFunctionSpec backdrop_functions[3] = {
JS_FS("backdropGetColor", BackdropGetColorFunc, 0, 0),
JS_FS("backdropSetColor", BackdropSetColorFunc, 3, 0),
JS_FS_END
};
示例15: DOUBLE_TO_JSVAL
return DOUBLE_TO_JSVAL(d);
break;
case HMF_DBL:
if((d = JS_NewDouble(cx, f->hmf_dbl)) != NULL)
return DOUBLE_TO_JSVAL(d);
break;
}
return JSVAL_NULL;
}
/**
*
*/
static JSFunctionSpec setting_functions[] = {
JS_FS("createBool", js_createBool, 4, 0, 0),
JS_FS("createString", js_createString, 4, 0, 0),
JS_FS("createMultiOpt", js_createMultiOpt, 5, 0, 0),
JS_FS("createInfo", js_createInfo, 3, 0, 0),
JS_FS("createDivider", js_createDivider, 1, 0, 0),
JS_FS("createInt", js_createInt, 8, 0, 0),
JS_FS("createAction", js_createAction, 2, 0, 0),
JS_FS("destroy", js_destroy, 0, 0, 0),
JS_FS_END
};
/**
*