• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ JS_ValueToString函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中JS_ValueToString函数的典型用法代码示例。如果您正苦于以下问题:C++ JS_ValueToString函数的具体用法?C++ JS_ValueToString怎么用?C++ JS_ValueToString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了JS_ValueToString函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: xgg_pluginhelper_add

static JSBool xgg_pluginhelper_add(JSContext *pcxa, JSObject *pobja, uintN argc, jsval *pva1, jsval *rval)
{
	char	*psz1 = JS_GetStringBytes(JS_ValueToString(pcxa, pva1[1]));
	XJSE_TRACE("xgg_pluginhelper_add (%s)", psz1);

	XJSE_XGG_PLUGINHELPER_PRIV	*pv0 = 0;
	pv0 = JS_GetPrivate(pcxa, pobja);
	//XJSE_SAFENNP(pv0->pszurl, free);
	//pv0->pszurl = (char*)xjse_malloc(0, strlen(pszurl) + 1);
	//strcpy(pv0->pszurl, pszurl);

	return  JS_TRUE;
}
开发者ID:odistagon,项目名称:cyeonna,代码行数:13,代码来源:xgg_pluginhelper.c


示例2: smjs_load_uri

static JSBool
smjs_load_uri(JSContext *ctx, uintN argc, jsval *rval)
{
	jsval *argv = JS_ARGV(ctx, rval);
	struct smjs_load_uri_hop *hop;
	struct download *download;
	JSString *jsstr;
	unsigned char *uri_string;
	struct uri *uri;

	if (argc < 2) return JS_FALSE;

	jsstr = JS_ValueToString(smjs_ctx, argv[0]);
	uri_string = JS_EncodeString(smjs_ctx, jsstr);

	uri = get_uri(uri_string, 0);
	if (!uri) return JS_FALSE;

	download = mem_alloc(sizeof(*download));
	if (!download) {
		done_uri(uri);
		return JS_FALSE;
	}

	hop = mem_alloc(sizeof(*hop));
	if (!hop) {
		mem_free(download);
		done_uri(uri);
		return JS_FALSE;
	}

	hop->callback = argv[1];
	hop->ses = smjs_ses;
	if (!JS_AddNamedValueRoot(smjs_ctx, &hop->callback,
			     "smjs_load_uri_hop.callback")) {
		mem_free(hop);
		mem_free(download);
		done_uri(uri);
		return JS_FALSE;
	}

	download->data = hop;
	download->callback = (download_callback_T *) smjs_loading_callback;

	load_uri(uri, NULL, download, PRI_MAIN, CACHE_MODE_NORMAL, -1);

	done_uri(uri);

	return JS_TRUE;
}
开发者ID:ezc,项目名称:elinks,代码行数:50,代码来源:load_uri.c


示例3: win32_setdlldirectory

JSBool win32_setdlldirectory(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
	JS_BeginRequest(cx);
	if(argc < 1)
	{
		JS_ReportError(cx, "Must pass a path to SetDllDirectory.");
		JS_EndRequest(cx);
		return JS_FALSE;
	}
	JSString * str = JS_ValueToString(cx, *argv);
	*rval = SetDllDirectory((LPWSTR)JS_GetStringChars(str)) ? JSVAL_TRUE : JSVAL_FALSE;
	JS_EndRequest(cx);
	return JS_TRUE;
}
开发者ID:z4y4,项目名称:njord,代码行数:14,代码来源:win32s.cpp


示例4: JS_EvaluateScript

int cScriptEngine::Start()
{
   JSBool ok = 0;
   m_rval = 0;

   ok = JS_EvaluateScript(m_cx, m_gObj, m_script_code, m_script_length, "", 0, &m_rval);
	if(ok == JS_TRUE)
	{
      JSString *str;
		str = JS_ValueToString(m_cx, m_rval);
		char *s = JS_GetStringBytes(str);
		
	} else {
      JSString *str;
		str = JS_ValueToString(m_cx, m_rval);
		char *s = JS_GetStringBytes(str);

		// error
      return 2;
	}

   return 0;
}
开发者ID:jstty,项目名称:OlderProjects,代码行数:23,代码来源:cScriptEngine.cpp


示例5: go_obj_func_callback

/* The object function callback. */
JSBool go_obj_func_callback(JSContext *cx, uintN argc, jsval *vp) {
	JSObject *callee = JSVAL_TO_OBJECT(JS_CALLEE(cx, vp));

	jsval name;
	JS_GetProperty(cx, callee, "name", &name);

	char* cname = JS_EncodeString(cx, JS_ValueToString(cx, name));

	JSBool result = call_go_obj_func(JS_GetPrivate(cx, JS_THIS_OBJECT(cx, vp)), cname, argc, vp);

	JS_free(cx, (void*)cname);

	return result;
}
开发者ID:MrXiaoZ,项目名称:monkey,代码行数:15,代码来源:monkey.c


示例6: vm_dumpGCStats

static JSBool vm_dumpGCStats(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
  const char 	*filename = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
  FILE		*file;
  
  depth = JS_SuspendRequest(cx);
  file = fopen(filename, "w");
  flock(file, LOCK_EX);
  JS_ResumeRequest(cx);

  js_DumpGCStats();

  fclose(file);
}
开发者ID:wesgarland,项目名称:gpsee,代码行数:14,代码来源:vm.c


示例7: elixir_object_get_str

Eina_Bool
elixir_object_get_str(JSContext *cx, JSObject *obj, const char *name, const char **value)
{
   JSString *str;
   jsval propertie;

   if (!JS_GetProperty(cx, obj, name, &propertie))
     return EINA_FALSE;

   str = JS_ValueToString(cx, propertie);
   *value = elixir_get_string_bytes(str, NULL);

   return EINA_TRUE;
}
开发者ID:Limsik,项目名称:e17,代码行数:14,代码来源:elixir_object.c


示例8: syck_resolve

static JSBool
syck_resolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
	JSObject **objp)
{
if (_debug)
fprintf(stderr, "==> %s(%p,%p,0x%lx[%u],0x%x,%p) property %s flags 0x%x{%s,%s,%s,%s,%s}\n", __FUNCTION__, cx, obj, (unsigned long)id, (unsigned)JSVAL_TAG(id), (unsigned)flags, objp,
		JS_GetStringBytes(JS_ValueToString(cx, id)), flags,
		(flags & JSRESOLVE_QUALIFIED) ? "qualified" : "",
		(flags & JSRESOLVE_ASSIGNING) ? "assigning" : "",
		(flags & JSRESOLVE_DETECTING) ? "detecting" : "",
		(flags & JSRESOLVE_DECLARING) ? "declaring" : "",
		(flags & JSRESOLVE_CLASSNAME) ? "classname" : "");
    return JS_TRUE;
}
开发者ID:avokhmin,项目名称:RPM5,代码行数:14,代码来源:syck-js.c


示例9: JS_STATIC_DLL_CALLBACK

JS_STATIC_DLL_CALLBACK(JSBool) js__print(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
    uintN i, n;
    JSString * str;

    for (i = n = 0; i < argc; i++) {
        str = JS_ValueToString(cx, argv[i]);
        if (!str) return JS_FALSE;
        fprintf(stdout, "%s%s", i ? " " : "", JS_GetStringBytes(str));
    }
    n++;
    if (n) fputc('\n', stdout);
    return JS_TRUE;
}
开发者ID:mariokonrad,项目名称:embedded-language,代码行数:14,代码来源:simple.cpp


示例10: teletone_add_tone

static JSBool teletone_add_tone(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
	struct teletone_obj *tto = JS_GetPrivate(cx, obj);
	if (argc > 2) {
		int x;
        int nmax = argc;
		char *fval;
		char *map_str;
		map_str = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));

		if ( TELETONE_MAX_TONES < nmax ) {
			nmax = TELETONE_MAX_TONES;
		}

		for (x = 1; x < nmax; x++) {
			fval = JS_GetStringBytes(JS_ValueToString(cx, argv[x]));
			tto->ts.TONES[(int) *map_str].freqs[x - 1] = strtod(fval, NULL);
		}
		return JS_TRUE;
	}

	return JS_FALSE;
}
开发者ID:PauloFer1,项目名称:FreeSWITCH,代码行数:23,代码来源:mod_spidermonkey_teletone.c


示例11: Dump

Dump(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
    JSString *str;
    if (!argc)
        return JS_TRUE;
    
    str = JS_ValueToString(cx, argv[0]);
    if (!str)
        return JS_FALSE;

    char *bytes = JS_GetStringBytes(str);
    fputs(bytes, stderr);
    return JS_TRUE;
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:14,代码来源:mozJSComponentLoader.cpp


示例12: Load

static JSBool
Load(JSContext *cx, uintN argc, jsval *vp)
{
    SG_context *pCtx = NULL;
    JSObject *thisobj = JS_THIS_OBJECT(cx, vp);
    jsval *argv = JS_ARGV(cx, vp);
    uintN i;
    if (!thisobj)
        return JS_FALSE;

	SG_context__alloc(&pCtx);
	if (pCtx==NULL)
		return JS_FALSE;

    for (i = 0; i < argc; i++) {
        JSString *str = JS_ValueToString(cx, argv[i]);
        char *filename = NULL;
    	uint32 oldopts;
    	JSObject *scriptObj;
        if (!str) {
        	SG_CONTEXT_NULLFREE(pCtx);
            return JS_FALSE;
        }
        argv[i] = STRING_TO_JSVAL(str);
        sg_jsglue__jsstring_to_sz(pCtx, cx, str, &filename);
        if (SG_context__has_err(pCtx)) {
        	SG_CONTEXT_NULLFREE(pCtx);
            return JS_FALSE;
        }
        errno = 0;
        oldopts = JS_GetOptions(cx);
        JS_SetOptions(cx, oldopts | JSOPTION_COMPILE_N_GO | JSOPTION_NO_SCRIPT_RVAL);
        scriptObj = JS_CompileFile(cx, thisobj, filename);
        SG_NULLFREE(pCtx, filename);
        JS_SetOptions(cx, oldopts);
        if (!scriptObj) {
        	SG_CONTEXT_NULLFREE(pCtx);
            return JS_FALSE;
        }

        if (!compileOnly && !JS_ExecuteScript(cx, thisobj, scriptObj, NULL)) {
        	SG_CONTEXT_NULLFREE(pCtx);
            return JS_FALSE;
        }
    }

	SG_CONTEXT_NULLFREE(pCtx);
    return JS_TRUE;
}
开发者ID:refaqtor,项目名称:sourcegear_veracity_clone,代码行数:49,代码来源:vscript.c


示例13: jwindow_alert

JSBool jwindow_alert(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
#define WEBC_JSCRIPT_USER_ALERT 1
#if (WEBC_JSCRIPT_USER_ALERT)
	if (argc >= 1)
	{
		char *str = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
		webc_user_alert_box((char *)str);

	}
	return JS_TRUE;
#else
    return jwindow_dialog(cx, obj, argc, argv, rval, WHICH_DIALOGUE_ALERT);
#endif
}
开发者ID:peteratebs,项目名称:webcwebbrowser,代码行数:15,代码来源:wjdialogs.cpp


示例14: win32_setcurrentdirectory

JSBool win32_setcurrentdirectory(JSContext * cx, JSObject * obj, uintN argc, jsval *argv, jsval * rval)
{
	JS_BeginRequest(cx);
	if(argc < 1 || !JSVAL_IS_STRING(*argv))
	{
		JS_ReportError(cx, "Must provide directory name to setcurrentdirectory.");
		JS_EndRequest(cx);
		return JS_FALSE;
	}

	JSString * pathName = JS_ValueToString(cx, *argv);
	*rval = SetCurrentDirectory((LPWSTR)JS_GetStringChars(pathName)) ? JSVAL_TRUE : JSVAL_FALSE;
	JS_EndRequest(cx);
	return JS_TRUE;
}
开发者ID:z4y4,项目名称:njord,代码行数:15,代码来源:win32s.cpp


示例15: jsGoto

static JSBool
jsGoto( JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval )
{
   if( ( 1 <= argc )
       &&
       JSVAL_IS_STRING( argv[0] ) )
   {
      gotoCalled_ = true ;
      abortCodeQueue();
      absoluteURL( JS_GetStringBytes( JS_ValueToString( cx, argv[0] ) ), gotoURL_ );
   }

   *rval = JSVAL_TRUE ;
   return JS_TRUE ;
}
开发者ID:boundarydevices,项目名称:bdScript,代码行数:15,代码来源:jsHyperlink.cpp


示例16: js_prop_set_from_jsval

void
js_prop_set_from_jsval(JSContext *cx, prop_t *p, jsval value, int recurse)
{
  JSBool b;
  if(JSVAL_IS_INT(value)) {
    prop_set_int(p, JSVAL_TO_INT(value));
  } else if(JSVAL_IS_BOOLEAN(value)) {
    prop_set_int(p, JSVAL_TO_BOOLEAN(value));
  } else if(JSVAL_IS_DOUBLE(value)) {
    double d;
    if(JS_ValueToNumber(cx, value, &d))
      prop_set_float(p, d);
  } else if(JS_HasInstance(cx, RichText, value, &b) && b) {
    JSObject *o = JSVAL_TO_OBJECT(value);
    jsval v2;

    if(!JS_EnterLocalRootScope(cx))
      return;

    if(!JS_GetProperty(cx, o, "text", &v2)) {
      JS_LeaveLocalRootScope(cx);
      return;
    }

    prop_set_string_ex(p, NULL, JS_GetStringBytes(JS_ValueToString(cx, v2)),
		       PROP_STR_RICH);
    JS_LeaveLocalRootScope(cx);

  } else if(JSVAL_IS_VOID(value) || JSVAL_IS_NULL(value)) {
    prop_set_void(p);
  } else if(recurse && JSVAL_IS_OBJECT(value)) {
    js_prop_from_object(cx, JSVAL_TO_OBJECT(value), p, recurse);
  } else {
    prop_set_string(p, JS_GetStringBytes(JS_ValueToString(cx, value)));
  }
}
开发者ID:carlinx,项目名称:showtime,代码行数:36,代码来源:js.c


示例17: js_on_exit

static JSBool
js_on_exit(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
    js_branch_t*	branch;

    if((branch=(js_branch_t*)JS_GetPrivate(cx,obj))==NULL)
        return(JS_FALSE);

    if(branch->exit_func==NULL)
        branch->exit_func=strListInit();

    strListPush(&branch->exit_func,JS_GetStringBytes(JS_ValueToString(cx, argv[0])));

    return(JS_TRUE);
}
开发者ID:ftnapps,项目名称:pkg-sbbs,代码行数:15,代码来源:js_internal.c


示例18: jsWrite

static JSBool
jsWrite( JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval )
{
   *rval = JSVAL_VOID ;
   for( uintN arg = 0 ; arg < argc ; arg++ )
   {
      JSString *str = JS_ValueToString(cx, argv[arg]);
      if( str )
         fwrite( JS_GetStringBytes( str ), JS_GetStringLength( str ), 1, stdout );
   }
   
   fflush( stdout );

   return JS_TRUE ;
}
开发者ID:boundarydevices,项目名称:bdScript,代码行数:15,代码来源:jsTTY.cpp


示例19: CheckExistingProject

//fl.fileExists 로 대체해서 필요없는 코드임
JSBool CheckExistingProject(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval) {
    if(argc != 1)
        return JS_FALSE;
    
    unsigned int filePathLen;
	unsigned short* filePath = JS_ValueToString(cx, argv[0], &filePathLen);
    FILE* file = OpenFileString(filePath, filePathLen, "r");
    if(file) {
        *rval = JS_BooleanToValue(JS_TRUE);
        return JS_TRUE;
    } else {
        *rval = JS_BooleanToValue(JS_FALSE);
        return JS_TRUE;
    }
}
开发者ID:devmario,项目名称:VBEngine,代码行数:16,代码来源:FlashCS5extension.c


示例20: to_s

/*
 * call-seq:
 *   to_s()
 *
 * Converts the JavaScript object to a string, using its toString method
 * if available.
 */
static VALUE to_s(VALUE self)
{
  RubyLandProxy* proxy;
  Data_Get_Struct(self, RubyLandProxy, proxy);
  JSContext * context = johnson_get_current_context(proxy->runtime);

  PREPARE_RUBY_JROOTS(context, 1);
  
  jsval proxy_value;
  JCHECK(get_jsval_for_proxy(proxy, &proxy_value));
  JROOT(proxy_value);
  
  JSString* str = JS_ValueToString(context, proxy_value);
  JRETURN_RUBY(CONVERT_JS_STRING_TO_RUBY(proxy->runtime, str));
}
开发者ID:aasmith,项目名称:johnson,代码行数:22,代码来源:ruby_land_proxy.c



注:本文中的JS_ValueToString函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ JS_malloc函数代码示例发布时间:2022-05-30
下一篇:
C++ JS_ValueToObject函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap