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

C++ duk_pop_2函数代码示例

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

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



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

示例1: dukky_application_cache_onobsolete_setter

static duk_ret_t dukky_application_cache_onobsolete_setter(duk_context *ctx)
{
	/* Get private data for method */
	application_cache_private_t *priv = NULL;
	duk_push_this(ctx);
	duk_get_prop_string(ctx, -1, dukky_magic_string_private);
	priv = duk_get_pointer(ctx, -1);
	duk_pop_2(ctx);
	if (priv == NULL) {
		return 0; /* can do? No can do. */
	}

	return 0;
}
开发者ID:EyMenZ,项目名称:NetSurf-OS3,代码行数:14,代码来源:application_cache.c


示例2: test

void test(duk_context *ctx) {
        int rc;

        duk_eval_string(ctx, "this.testFunc = eval.bind(this, 'print(\\'hello from eval\\')');");
	duk_pop(ctx);

	duk_push_global_object(ctx);
	duk_get_prop_string(ctx, -1, "testFunc");
	rc = duk_pcall(ctx, 0);
	printf("rc=%d\n", rc);
	duk_pop_2(ctx);

        printf("final top: %d\n", duk_get_top(ctx));
}
开发者ID:alwayrun,项目名称:duktape,代码行数:14,代码来源:test-indirect-eval.c


示例3: dukky_audio_track_kind_getter

static duk_ret_t dukky_audio_track_kind_getter(duk_context *ctx)
{
	/* Get private data for method */
	audio_track_private_t *priv = NULL;
	duk_push_this(ctx);
	duk_get_prop_string(ctx, -1, dukky_magic_string_private);
	priv = duk_get_pointer(ctx, -1);
	duk_pop_2(ctx);
	if (priv == NULL) {
		return 0; /* can do? No can do. */
	}

	return 0;
}
开发者ID:EyMenZ,项目名称:NetSurf-OS3,代码行数:14,代码来源:audio_track.c


示例4: dukky_validity_state_typeMismatch_getter

static duk_ret_t dukky_validity_state_typeMismatch_getter(duk_context *ctx)
{
	/* Get private data for method */
	validity_state_private_t *priv = NULL;
	duk_push_this(ctx);
	duk_get_prop_string(ctx, -1, dukky_magic_string_private);
	priv = duk_get_pointer(ctx, -1);
	duk_pop_2(ctx);
	if (priv == NULL) {
		return 0; /* can do? No can do. */
	}

	return 0;
}
开发者ID:EyMenZ,项目名称:NetSurf-OS3,代码行数:14,代码来源:validity_state.c


示例5: dukky_drag_event_dataTransfer_getter

static duk_ret_t dukky_drag_event_dataTransfer_getter(duk_context *ctx)
{
	/* Get private data for method */
	drag_event_private_t *priv = NULL;
	duk_push_this(ctx);
	duk_get_prop_string(ctx, -1, dukky_magic_string_private);
	priv = duk_get_pointer(ctx, -1);
	duk_pop_2(ctx);
	if (priv == NULL) {
		return 0; /* can do? No can do. */
	}

	return 0;
}
开发者ID:EyMenZ,项目名称:NetSurf-OS3,代码行数:14,代码来源:drag_event.c


示例6: dukky_html_anchor_element_protocol_getter

static duk_ret_t dukky_html_anchor_element_protocol_getter(duk_context *ctx)
{
	/* Get private data for method */
	html_anchor_element_private_t *priv = NULL;
	duk_push_this(ctx);
	duk_get_prop_string(ctx, -1, dukky_magic_string_private);
	priv = duk_get_pointer(ctx, -1);
	duk_pop_2(ctx);
	if (priv == NULL) {
		return 0; /* can do? No can do. */
	}

	return 0;
}
开发者ID:EyMenZ,项目名称:NetSurf-OS3,代码行数:14,代码来源:html_anchor_element.c


示例7: dukky_mutation_record_oldValue_getter

static duk_ret_t dukky_mutation_record_oldValue_getter(duk_context *ctx)
{
	/* Get private data for method */
	mutation_record_private_t *priv = NULL;
	duk_push_this(ctx);
	duk_get_prop_string(ctx, -1, dukky_magic_string_private);
	priv = duk_get_pointer(ctx, -1);
	duk_pop_2(ctx);
	if (priv == NULL) {
		return 0; /* can do? No can do. */
	}

	return 0;
}
开发者ID:EyMenZ,项目名称:NetSurf-OS3,代码行数:14,代码来源:mutation_record.c


示例8: dukky_document_fragment_childElementCount_getter

static duk_ret_t dukky_document_fragment_childElementCount_getter(duk_context *ctx)
{
	/* Get private data for method */
	document_fragment_private_t *priv = NULL;
	duk_push_this(ctx);
	duk_get_prop_string(ctx, -1, dukky_magic_string_private);
	priv = duk_get_pointer(ctx, -1);
	duk_pop_2(ctx);
	if (priv == NULL) {
		return 0; /* can do? No can do. */
	}

	return 0;
}
开发者ID:EyMenZ,项目名称:NetSurf-OS3,代码行数:14,代码来源:document_fragment.c


示例9: test

void test(duk_context *ctx) {
	duk_ret_t rc;

	duk_set_top(ctx, 0);

	duk_push_string(ctx, "foo");  /* dummy */

	/* success case */
	duk_push_int(ctx, 10);
	duk_push_int(ctx, 11);
	duk_push_int(ctx, 12);
	rc = duk_safe_call(ctx, test_1, 3 /*nargs*/, 2 /*nrets*/);
	if (rc == DUK_EXEC_SUCCESS) {
		printf("1st return value: %s\n", duk_to_string(ctx, -2));  /* 21 */
		printf("2nd return value: %s\n", duk_to_string(ctx, -1));  /* undefined */
	} else {
		printf("error: %s\n", duk_to_string(ctx, -2));
	}
	duk_pop_2(ctx);

	/* error case */
	duk_push_int(ctx, 10);
	duk_push_int(ctx, 11);
	duk_push_int(ctx, 12);
	rc = duk_safe_call(ctx, test_2, 3 /*nargs*/, 2 /*nrets*/);
	if (rc == DUK_EXEC_SUCCESS) {
		printf("1st return value: %s\n", duk_to_string(ctx, -2));  /* 21 */
		printf("2nd return value: %s\n", duk_to_string(ctx, -1));  /* undefined */
	} else {
		printf("error: %s\n", duk_to_string(ctx, -2));
	}
	duk_pop_2(ctx);

	/* XXX: also test invalid input stack shapes (like not enough args) */

	printf("final top: %ld\n", (long) duk_get_top(ctx));
}
开发者ID:CarterTsai,项目名称:duktape,代码行数:37,代码来源:test-safe-call.c


示例10: NativeSignal

static int NativeSignal(duk_context* ctx)
{
    const char* dest;
    uint32_t session;

    duk_push_this(ctx);
    duk_get_prop_string(ctx, -1, "dest");
    dest = duk_get_string(ctx, -1);
    duk_pop(ctx);
    duk_get_prop_string(ctx, -1, "session");
    session = duk_get_int(ctx, -1);
    duk_pop_2(ctx);
    InitSignal(ctx, dest, session);
    return 1;
}
开发者ID:anthony-ngu,项目名称:core-alljoyn-js,代码行数:15,代码来源:ajs_sessions.c


示例11: js_register_LocalStorage

    duk_ret_t js_register_LocalStorage(duk_context *ctx)
    {
        duk_push_global_object(ctx); /* global */
        duk_get_prop_string(ctx, -1, MURAL_JS_NAMESPACE); /* global, __MURAL__ */
        
        duk_push_c_function(ctx, w_LocalStorage_constructor, 0); /* global, __MURAL__, constructor */
        duk_push_object(ctx); /* global, __MURAL__, constructor, prototype */
        duk_put_function_list(ctx, -1, methods_of_LocalStorage);
        duk_put_prop_string(ctx, -2, "prototype"); /* global, __MURAL__, constructor */
        
        duk_put_prop_string(ctx, -2, "LocalStorage"); /* global, __MURAL__ */
        duk_pop_2(ctx);

        return 0;
    }
开发者ID:caivega,项目名称:Mural,代码行数:15,代码来源:LocalStorage.cpp


示例12: w_LocalStorage_prototype_removeItem

    int w_LocalStorage_prototype_removeItem(duk_context *ctx)
    {
        const char *key = duk_require_string(ctx, 0);

        duk_push_this(ctx); /* this */
        duk_get_prop_string(ctx, -1, "__MURAL_DATA__"); /* this, __MURAL_DATA__ */
        duk_del_prop_string(ctx, -1, key); /* this, __MURAL_DATA__ */

        LocalStorage *inst = getNativePointer<LocalStorage>(ctx);
        duk_json_encode(ctx, -1); /* this, JSON(__MURAL_DATA__) */
        inst->setData(duk_to_string(ctx, -1)); /* this, string(JSON(__MURAL_DATA__)) */

        duk_pop_2(ctx);

        return 0;
    }
开发者ID:caivega,项目名称:Mural,代码行数:16,代码来源:LocalStorage.cpp


示例13: _gum_duk_require_uint64

guint64
_gum_duk_require_uint64 (duk_context * ctx,
                         duk_idx_t index,
                         GumDukCore * core)
{
  GumDukUInt64 * object;

  duk_dup (ctx, index);
  duk_push_heapptr (ctx, core->uint64);
  if (!duk_instanceof (ctx, -2, -1))
    _gum_duk_throw (ctx, "expected UInt64");
  duk_pop_2 (ctx);

  object = _gum_duk_require_data (ctx, index);

  return object->value;
}
开发者ID:TechLord-Forever,项目名称:frida-gum,代码行数:17,代码来源:gumdukvalue.c


示例14: module_search

// Duktape.modSearch function, needed for loading modules with require()
duk_ret_t module_search(duk_context *ctx) {
    const char *id = duk_require_string(ctx, 0);

    // C modules: add functions to exports variable (3rd argument) and return undefined
    for (int i = 0; i < c_module_count; i++) {
	if (!strcmp(c_module_list[i].name, id)) {
	    duk_push_c_function(ctx, c_module_list[i].init_func, 0);
	    duk_call(ctx, 0);
	    duk_enum(ctx, -1, 0);
	    while(duk_next(ctx, -1, 1)) {
		duk_put_prop(ctx, 2);
	    }
	    duk_pop_2(ctx);
	    return 0;
	}
    }

    // JS modules: return source code as a string
    // Read from file "modname.js.tns"
    int module_filename_len = strlen(id) + strlen(".js.tns") + 1;
    char *module_filename = malloc(module_filename_len);
    if (!module_filename) goto error;
    snprintf(module_filename, module_filename_len, "%s.js.tns", id);
    FILE *module_file = fopen(module_filename, "r");
    free(module_filename);
    if (!module_file) goto error;
    if (fseek(module_file, 0, SEEK_END) != 0) goto error;
    long module_file_size = ftell(module_file);
    if (module_file_size == -1) goto error;
    rewind(module_file);
    char *src = malloc(module_file_size);
    if (!src) goto error;
    fread(src, 1, module_file_size, module_file);
    if (ferror(module_file)) goto error;
    fclose(module_file);

    duk_push_lstring(ctx, src, module_file_size);
    free(src);

    return 1;
    
error:
    duk_push_error_object(ctx, DUK_ERR_ERROR, "module %s not found: %s", id, strerror(errno));
    duk_throw(ctx);
}
开发者ID:fgalliat,项目名称:duktape-nspire,代码行数:46,代码来源:module.c


示例15: kbjs_PinId_str

/*----------------------------------------------------------------------------*/
static duk_ret_t
kbjs_PinId_str(duk_context *context)
{
    /* STACK: [this] */
    duk_push_this(context);

    /* STACK: [this, void*] */
    duk_get_prop_string(context, (duk_idx_t)-1, KBJS_INSTANCE_PTR);
    kbjs_PinId *pin_id = duk_get_pointer(context, (duk_idx_t)-1);
    /* STACK: [] */
    duk_pop_2(context);

    /* STACK: ["PIN*"] */
    duk_push_string(context, pin_id->str);

    /* Return string */
    return (duk_ret_t)1;
}
开发者ID:petervaro,项目名称:hackathon,代码行数:19,代码来源:pin_ids.c


示例16: test

void test(duk_context *ctx) {
	duk_ret_t rc;

        duk_eval_string(ctx, "this.testFunc = eval.bind(this, 'print(\\'hello from eval\\')');");
	duk_pop(ctx);

	duk_push_global_object(ctx);
	duk_get_prop_string(ctx, -1, "testFunc");
	rc = duk_pcall(ctx, 0);
	printf("rc=%d\n", (int) rc);
	if (rc != 0) {
		/* unexpected error */
		printf("error=%s\n", duk_safe_to_string(ctx, -1));
	}
	duk_pop_2(ctx);

        printf("final top: %ld\n", (long) duk_get_top(ctx));
}
开发者ID:CarterTsai,项目名称:duktape,代码行数:18,代码来源:test-indirect-eval.c


示例17: test_2

static duk_ret_t test_2(duk_context *ctx) {
	const char *str;

	printf("context is strict: %d\n", duk_is_strict_call(ctx));

	duk_push_c_function(ctx, test_2_inner, 0);
	duk_call(ctx, 0);
	duk_pop(ctx);

	duk_push_global_object(ctx);
	duk_get_prop_string(ctx, -1, "foo2");
	str = duk_get_string(ctx, -1);
	printf("global.foo2=%s\n", str ? str : "NULL");
	duk_pop_2(ctx);

	printf("final top: %ld\n", (long) duk_get_top(ctx));
	return 0;
}
开发者ID:CarterTsai,项目名称:duktape,代码行数:18,代码来源:test-eval-strictness.c


示例18: test_1

static duk_ret_t test_1(duk_context *ctx) {
	const char *str;

	/* Eval happens outside of a Duktape/C activation.  The eval code was
	 * executed in non-strict mode also in Duktape 0.11.0 and prior.
	 */

	printf("context is strict: %d\n", duk_is_strict_call(ctx));
	duk_eval_string_noresult(ctx, "print('test_1 evalcode, typeof Math:', typeof Math); var foo1 = 'bar';");
	duk_push_global_object(ctx);
	duk_get_prop_string(ctx, -1, "foo1");
	str = duk_get_string(ctx, -1);
	printf("global.foo1=%s\n", str ? str : "NULL");
	duk_pop_2(ctx);

	printf("final top: %ld\n", (long) duk_get_top(ctx));
	return 0;
}
开发者ID:CarterTsai,项目名称:duktape,代码行数:18,代码来源:test-eval-strictness.c


示例19: ClearTriggerCallback

static int ClearTriggerCallback(duk_context* ctx, int pinFunc, AJS_IO_PinTriggerCondition condition)
{
    int32_t trigId;

    AJS_TargetIO_PinDisableTrigger(PinCtxPtr(ctx), pinFunc, condition, &trigId);
    if (trigId != AJS_IO_PIN_NO_TRIGGER) {
        duk_get_global_string(ctx, AJS_IOObjectName);
        duk_get_prop_string(ctx, -1, AJS_HIDDEN_PROP("trigs"));
        duk_del_prop_index(ctx, -1, trigId);
        duk_pop_2(ctx);
    }
    duk_push_this(ctx);
    duk_del_prop_string(ctx, -1, "trigger");
    /*
     * Leave pin object on the stack
     */
    return 1;
}
开发者ID:avernon,项目名称:asl_distribution,代码行数:18,代码来源:ajs_io.c


示例20: AJS_HandleAcceptSession

AJ_Status AJS_HandleAcceptSession(duk_context* ctx, AJ_Message* msg, uint16_t port, uint32_t sessionId, const char* joiner)
{
    uint32_t accept = TRUE;
    SessionInfo* sessionInfo;

    /*
     * Create an entry in the sessions table so we can track this peer
     */
    AJS_GetGlobalStashObject(ctx, "sessions");
    sessionInfo = AllocSessionObject(ctx, joiner);
    /*
     * If there is no handler automatically accept the connection
     */
    AJS_GetAllJoynProperty(ctx, "onPeerConnected");
    if (duk_is_callable(ctx, -1)) {
        /* Empty interface array */
        duk_push_array(ctx);
        AddServiceObject(ctx, sessionInfo, "/", joiner);
        if (AJS_DebuggerIsAttached()) {
            msg = AJS_CloneAndCloseMessage(ctx, msg);
        }
        if (duk_pcall(ctx, 1) != DUK_EXEC_SUCCESS) {
            AJS_ConsoleSignalError(ctx);
            accept = FALSE;
        } else {
            accept = duk_get_boolean(ctx, -1);
        }
    }
    duk_pop_2(ctx);
    /*
     * It is possible that we already have an outbound session to this peer so if we are not
     * accepting the session we can only delete the entry if the refCount is zero.
     */
    if (accept) {
        ++sessionInfo->refCount;
        sessionInfo->port = port;
        sessionInfo->sessionId = sessionId;
    } else if (sessionInfo->refCount == 0) {
        duk_del_prop_string(ctx, -1, joiner);
    }
    /* Pop sessions object */
    duk_pop(ctx);
    return AJ_BusReplyAcceptSession(msg, accept);
}
开发者ID:anthony-ngu,项目名称:core-alljoyn-js,代码行数:44,代码来源:ajs_sessions.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ duk_push_array函数代码示例发布时间:2022-05-30
下一篇:
C++ duk_pop函数代码示例发布时间: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