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

C++ prep函数代码示例

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

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



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

示例1: test_1b

/* duk_has_prop(), invalid index */
static duk_ret_t test_1b(duk_context *ctx) {
	duk_ret_t rc;

	prep(ctx);

	duk_push_string(ctx, "foo");
	rc = duk_has_prop(ctx, 234);
	printf("obj.foo -> rc=%d\n", (int) rc);

	printf("final top: %ld\n", (long) duk_get_top(ctx));
	return 0;
}
开发者ID:black13,项目名称:duktape_games,代码行数:13,代码来源:test-has-prop.cpp


示例2: test_1

static duk_ret_t test_1(duk_context *ctx) {
	duk_idx_t i, n;

	prep(ctx);
	duk_replace(ctx, -3);         /* -> [ 123 "foo" 345 ] */

	n = duk_get_top(ctx);
	for (i = 0; i < n; i++) {
		printf("%ld: %s\n", (long) i, duk_to_string(ctx, i));
	}
	return 0;
}
开发者ID:OakLabsInc,项目名称:duktape,代码行数:12,代码来源:test-replace.c


示例3: test_1b

/* duk_has_prop(), invalid index */
int test_1b(duk_context *ctx) {
	int rc;

	prep(ctx);

	duk_push_string(ctx, "foo");
	rc = duk_has_prop(ctx, 234);
	printf("obj.foo -> rc=%d\n", rc);

	printf("final top: %d\n", duk_get_top(ctx));
	return 0;
}
开发者ID:BpLife,项目名称:duktape,代码行数:13,代码来源:test-has-prop.c


示例4: test_1d

/* duk_del_prop(), non-configurable virtual property of a plain string.
 * Same behavior when called inside/outside of a Duktape/C activation.
 */
static duk_ret_t test_1d(duk_context *ctx) {
	duk_ret_t rc;

	prep(ctx);

	duk_push_string(ctx, "length");
	rc = duk_del_prop(ctx, 2);
	printf("delete 'test_string'.length -> rc=%d\n", (int) rc);

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


示例5: test_1f

/* duk_del_prop(), DUK_INVALID_INDEX */
static duk_ret_t test_1f(duk_context *ctx) {
	duk_ret_t rc;

	prep(ctx);

	duk_push_string(ctx, "foo");
	rc = duk_del_prop(ctx, DUK_INVALID_INDEX);
	printf("delete obj.foo -> rc=%d\n", (int) rc);

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


示例6: test_1c

/* duk_del_prop(), non-configurable virtual property of a plain string.
 * Same behavior when called inside/outside of a Duktape/C activation.
 */
static duk_ret_t test_1c(duk_context *ctx) {
	duk_ret_t rc;

	prep(ctx);

	duk_push_int(ctx, 5);
	rc = duk_del_prop(ctx, 2);
	printf("delete 'test_string'[5] -> rc=%d\n", (int) rc);

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


示例7: test_1c

/* duk_del_prop(), non-configurable virtual property of a plain string,
 * called from inside a Duktape/C context.
*/
int test_1c(duk_context *ctx) {
	int rc;

	prep(ctx);

	duk_push_int(ctx, 5);
	rc = duk_del_prop(ctx, 2);
	printf("delete 'test_string'[5] -> rc=%d\n", rc);

	printf("final top: %d\n", duk_get_top(ctx));
	return 0;
}
开发者ID:BpLife,项目名称:duktape,代码行数:15,代码来源:test-del-prop.c


示例8: test_1e

/* duk_del_prop(), DUK_INVALID_INDEX */
int test_1e(duk_context *ctx) {
	int rc;

	prep(ctx);

	duk_push_string(ctx, "foo");
	rc = duk_del_prop(ctx, DUK_INVALID_INDEX);
	printf("delete obj.foo -> rc=%d\n", rc);

	printf("final top: %d\n", duk_get_top(ctx));
	return 0;
}
开发者ID:BpLife,项目名称:duktape,代码行数:13,代码来源:test-del-prop.c


示例9: test_1b

/* duk_del_prop(), non-configurable property (array 'length' property),
 * called from inside a Duktape/C context.
 */
int test_1b(duk_context *ctx) {
	int rc;

	prep(ctx);

	duk_push_string(ctx, "length");
	rc = duk_del_prop(ctx, 1);
	printf("delete arr.length -> rc=%d\n", rc);

	printf("final top: %d\n", duk_get_top(ctx));
	return 0;
}
开发者ID:BpLife,项目名称:duktape,代码行数:15,代码来源:test-del-prop.c


示例10: main

int main(int argc, char* argv[]) {
	if(argc >= 2){
		printf("\nLittle Man Computer simulator v1.0\n");
		printf("All command line arguments trigger this help.\n");
        printf("\nWhen you start, you will get a ? prompt.\nEnter your data as:\n\n? ADDRESS DATA\n\nAddressess can be between 1 and 99, data can be between 0 and 999.");
		printf("\nTwo special editor commands exist, enter them in the ? prompt as:\n\n? COMMAND ARGUMENT\n\n");
		printf("100: Run program, enter any number as the argument (nescessary).\n");
		printf("101: Print address, enter the address as the argument. 0 prints all stored data.\n");
        printf("\nData stored in memory addresses are interpreted as commands if reached by the counter during runtime.");
		printf("\nThese commands are the fundamentals of the LMC computer, and are different than the previously mentioned editor commands.\n");
		printf("\nYou can store actual data in addresses after the 000 command.\n\n");
		printf("1XX: ADD: Add data from memory bank XX to calculator.\n");
		printf("2XX: SUB: Subtract data from memory bank XX from calculator.\n");
		printf("3XX: STO: Store data from calculator in memory bank XX.\n");
		printf("5XX: LDA: Load data from memory bank XX into calculator.\n");
		printf("6XX: BR:  Branch (jump) to memory bank XX.\n");
		printf("7XX: BRZ: Branch (jump) to memory bank XX when calculator is ZERO.\n");
		printf("8XX: BRP: Branch (jump) to memory bank XX when calculator is POSITIVE.\n");
		printf("901: IN:  Ask user for input to be set as calculator value.\n");
		printf("902: OUT: Output calculator value.\n");
		printf("000: ZZZ: Coffee break, end execution.\n\n");
		printf("When your program is running, input prompts triggered with 901 will appear as: *\n\n");
		return 0;
	}
	
    int address, data, i;
    while(1){
        printf("? ");
        scanf("%d %d", &address, &data);
        if(address == 100){
			prep();
            run(data);
			reset();
        }
        else if(address == 101){
			if(data == 0){
				for(i = 1; i <= 99; i++){
					if(mem[i] != 0){
						printf("%d:%d\n", i, mem[i]);
					}
				}
			}
			else{
				printf("%d:%d\n", data, mem[data]);
			}
        }
        else{
            mem[address] = data;
        }
    }
    return 0;
}
开发者ID:ubuntufag,项目名称:scripts,代码行数:52,代码来源:lmc.c


示例11: v4l2_reader_enqueue_buffer

int v4l2_reader_enqueue_buffer (v4l2_reader *v, int index) {
  v4l2_buffer buffer;

  prep (&buffer);
  buffer.index = index;
  
  if (0 > ioctl (v->fd, VIDIOC_QBUF, &buffer)) {
    log_err ("queuing buffer");
    return 0;
  } else {
    return 1;
  }
}
开发者ID:mgorlick,项目名称:CRESTaceans,代码行数:13,代码来源:v4l2.c


示例12: test_2c

/* duk_has_prop_string(), DUK_INVALID_INDEX */
static duk_ret_t test_2c(duk_context *ctx, void *udata) {
	duk_ret_t rc;

	(void) udata;

	prep(ctx);

	rc = duk_has_prop_string(ctx, DUK_INVALID_INDEX, "foo");
	printf("obj.foo -> rc=%d\n", (int) rc);

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


示例13: start_gen_radius_cert

void start_gen_radius_cert(void)
{
	if (nvram_match("cert_running", "1") && pidof("openssl") > 0)
		return;		//already running
	prep();
	gen_cert("/jffs/etc/freeradius/certs/server.cnf", TYPE_SERVER, nvram_safe_get("radius_common"), nvram_safe_get("radius_passphrase"));
	gen_cert("/jffs/etc/freeradius/certs/ca.cnf", TYPE_CA, nvram_safe_get("radius_common"), nvram_safe_get("radius_passphrase"));
	nvram_set("cert_running", "1");
	//this takes a long time (depending from the cpu speed)
	system("cd /jffs/etc/freeradius/certs && ./bootstrap");
	sysprintf("sed \"s/private_key_password = whatever/private_key_password = %s/g\" /etc/freeradius/eap.conf > /jffs/etc/freeradius/eap.conf", nvram_safe_get("radius_passphrase"));
	nvram_set("cert_running", "0");
}
开发者ID:rogerhu,项目名称:dd-wrt,代码行数:13,代码来源:freeradius.c


示例14: test_2

static duk_ret_t test_2(duk_context *ctx) {
	duk_idx_t i, n;

	prep(ctx);
	duk_copy(ctx, -3, -3);  /* nop */

	n = duk_get_top(ctx);
	for (i = 0; i < n; i++) {
		printf("%ld: %s\n", (long) i, duk_to_string(ctx, i));
	}

	return 0;
}
开发者ID:OakLabsInc,项目名称:duktape,代码行数:13,代码来源:test-copy.c


示例15: test_1c

/* duk_get_prop(), DUK_INVALID_INDEX */
static duk_ret_t test_1c(duk_context *ctx) {
	duk_ret_t rc;

	prep(ctx);

	duk_push_string(ctx, "foo");
	rc = duk_get_prop(ctx, DUK_INVALID_INDEX);
	printf("obj.foo -> rc=%d, result='%s'\n", (int) rc, duk_to_string(ctx, -1));
	duk_pop(ctx);

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


示例16: test_delproplstring_a

/* duk_del_prop_lstring(), success case */
static duk_ret_t test_delproplstring_a(duk_context *ctx) {
	duk_ret_t rc;
	prep(ctx);

	rc = duk_del_prop_lstring(ctx, 0, "nul" "\x00" "keyx", 7);
	printf("delete obj.nul<NUL>key -> rc=%d\n", (int) rc);

	duk_json_encode(ctx, 0);
	printf("%s\n", duk_to_string(ctx, 0));

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


示例17: test_1b

/* duk_get_prop(), invalid index */
int test_1b(duk_context *ctx) {
	int rc;

	prep(ctx);

	duk_push_string(ctx, "foo");
	rc = duk_get_prop(ctx, 234);
	printf("obj.foo -> rc=%d, result='%s'\n", rc, duk_to_string(ctx, -1));
	duk_pop(ctx);

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


示例18: test_3c

/* duk_has_prop_index(), DUK_INVALID_INDEX */
static duk_ret_t test_3c(duk_context *ctx, void *udata) {
	duk_ret_t rc;

	(void) udata;

	prep(ctx);

	rc = duk_has_prop_index(ctx, DUK_INVALID_INDEX, 123);
	printf("obj[123] -> rc=%d\n", (int) rc);

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


示例19: runtaskgroup

/*
 * Do a task group: fork the processes, then wait for them.
 */
static
void
runtaskgroup(unsigned count,
	     void (*prep)(unsigned, unsigned),
	     void (*task)(unsigned, unsigned),
	     void (*cleanup)(unsigned, unsigned),
	     unsigned groupid)
{
	pid_t mypids[count];
	unsigned i;
	unsigned failures = 0;
	time_t secs;
	unsigned long nsecs;

	prep(groupid, count);

	for (i=0; i<count; i++) {
		mypids[i] = fork();
		if (mypids[i] < 0) {
			err(1, "fork");
		}
		if (mypids[i] == 0) {
			/* child (of second fork) */
			task(groupid, i);
			exit(0);
		}
		/* parent (of second fork) - continue */
	}

	/*
	 * now wait for the task to finish
	 */

	for (i=0; i<count; i++) {
		failures += dowait(mypids[i]);
	}

	/*
	 * Store the end time.
	 */

	__time(&secs, &nsecs);
	openresultsfile(O_WRONLY);
	putresult(groupid, secs, nsecs);
	closeresultsfile();

	cleanup(groupid, count);

	exit(failures ? 1 : 0);
}
开发者ID:SidhantDuggal,项目名称:os161hack,代码行数:53,代码来源:main.c


示例20: prep

void Command::indented_dump(const std::string &s,
                            std::ostream &out,
                            size_t indent_level,
                            size_t width,
                            bool prepad,
                            bool postpad,
                            char pad_char)
{
    std::string prep(indent_level, pad_char);

    if (s.size() > 0 && prepad)
        out << prep;

    std::vector<std::string> desc_lines;
    bool endl(true);
    boost::split(desc_lines, s, boost::algorithm::is_any_of(std::string("\n")));

    for (size_t l = 0; l < desc_lines.size(); ++l)
    {
        if (l > 0 && !endl)
            out << std::endl << prep;

        /* dump description taking care that it does not exceed Get_tty_cols() */
        std::vector<std::string> desc_tokens;
        boost::split(desc_tokens, desc_lines.at(l),
                     boost::algorithm::is_any_of(std::string(" \t")));

        size_t len(indent_level);
        for (size_t j = 0; j < desc_tokens.size(); ++j)
        {
            std::string token(desc_tokens.at(j));
            if (len + Get_real_string_size(token) + 1 >= width)
            {
                out << std::endl << prep;
                len = indent_level;
                endl = true;
            }
            if (token.empty() && (j == desc_tokens.size() - 1))
                continue;
            endl = false;

            out << token << " ";
            /* do not take into account special style characters */
            len += Get_real_string_size(token) + 1;
        }

        if (postpad && l == desc_lines.size() - 1)
            out << std::string(width - len, pad_char);
    }
}
开发者ID:alban,项目名称:OpenExanodes,代码行数:50,代码来源:info_help.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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