当前位置: 首页>>代码示例>>C++>>正文


C++ parser_priv函数代码示例

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


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

示例1: test_n0

static int test_n0(void *state) {
	enum parser_error r = parser_parse(state, "N:1:Detect Monsters");
	struct spell *s;

	eq(r, PARSE_ERROR_NONE);
	s = parser_priv(state);
	require(s);
	eq(s->sidx, 1);
	require(streq(s->name, "Detect Monsters"));
	ok;
}
开发者ID:EpicMan,项目名称:angband,代码行数:11,代码来源:s-info.c

示例2: parse_r_w

static enum parser_error parse_r_w(struct parser *p) {
	struct monster_race *r = parser_priv(p);

	if (!r)
		return PARSE_ERROR_MISSING_RECORD_HEADER;
	r->level = parser_getint(p, "level");
	r->rarity = parser_getint(p, "rarity");
	r->power = parser_getint(p, "power");
	r->mexp = parser_getint(p, "mexp");
	return PARSE_ERROR_NONE;
}
开发者ID:jenschou,项目名称:angband,代码行数:11,代码来源:init.c

示例3: parse_prefs_x

static enum parser_error parse_prefs_x(struct parser *p)
{
	struct prefs_data *d = parser_priv(p);
	assert(d != NULL);
	if (d->bypass) return PARSE_ERROR_NONE;

	/* XXX check for valid option */
	option_set(parser_getstr(p, "option"), FALSE);

	return PARSE_ERROR_NONE;
}
开发者ID:apwhite,项目名称:angband,代码行数:11,代码来源:prefs.c

示例4: test_time0

int test_time0(void *state) {
	enum parser_error r = parser_parse(state, "time:20+d30");
	struct artifact *a;

	eq(r, PARSE_ERROR_NONE);
	a = parser_priv(state);
	require(a);
	eq(a->time.base, 20);
	eq(a->time.sides, 30);
	ok;
}
开发者ID:Axydlbaaxr,项目名称:angband,代码行数:11,代码来源:a-info.c

示例5: test_base_object0

int test_base_object0(void *state) {
	enum parser_error r = parser_parse(state, "base-object:light:6");
	struct artifact *a;

	eq(r, PARSE_ERROR_NONE);
	a = parser_priv(state);
	require(a);
	eq(a->tval, TV_LIGHT);
	eq(a->sval, 6);
	ok;
}
开发者ID:Axydlbaaxr,项目名称:angband,代码行数:11,代码来源:a-info.c

示例6: test_g1

static int test_g1(void *state) {
	errr r = parser_parse(state, "G:!:W");
	struct object_kind *k;

	eq(r, 0);
	k = parser_priv(state);
	require(k);
	eq(k->d_char, '!');
	eq(k->d_attr, TERM_L_WHITE);
	ok;
}
开发者ID:apwhite,项目名称:angband,代码行数:11,代码来源:k-info.c

示例7: test_n0

static int test_n0(void *state) {
	enum parser_error r = parser_parse(state, "N:544:Carcharoth, the Jaws of Thirst");
	struct monster_race *mr;

	eq(r, PARSE_ERROR_NONE);
	mr = parser_priv(state);
	require(mr);
	eq(mr->ridx, 544);
	require(streq(mr->name, "Carcharoth, the Jaws of Thirst"));
	ok;
}
开发者ID:apwhite,项目名称:angband,代码行数:11,代码来源:r-info.c

示例8: test_slots0

int test_slots0(void *state) {
	enum parser_error r = parser_parse(state, "slots:2:33");
	struct store *s;

	eq(r, PARSE_ERROR_NONE);
	s = parser_priv(state);
	require(s);
	eq(s->normal_stock_min, 2);
	eq(s->normal_stock_max, 33);
	ok;
}
开发者ID:Dasaan,项目名称:angband,代码行数:11,代码来源:store.c

示例9: test_i0

/* Causes segfault: lookup_name() requires z_info/k_info */
int test_i0(void *state) {
	enum parser_error r = parser_parse(state, "normal:3:5");
	struct store *s;

	eq(r, PARSE_ERROR_NONE);
	s = parser_priv(state);
	require(s);
	require(s->normal_table[0]);
	require(s->normal_table[1]);
	ok;
}
开发者ID:Dasaan,项目名称:angband,代码行数:12,代码来源:store.c

示例10: test_g0

static int test_g0(void *state) {
	enum parser_error r = parser_parse(state, "G:C:v");
	struct monster_race *mr;

	eq(r, PARSE_ERROR_NONE);
	mr = parser_priv(state);
	require(mr);
	eq(mr->d_attr, TERM_VIOLET);
	eq(mr->d_char, 'C');
	ok;
}
开发者ID:EpicMan,项目名称:angband,代码行数:11,代码来源:r-info.c

示例11: test_store0

int test_store0(void *state) {
	enum parser_error r = parser_parse(state, "store:1:foobar");
	struct store *s;

	eq(r, PARSE_ERROR_NONE);
	s = parser_priv(state);
	require(s);
	eq(s->sidx, 0);
	streq(s->name, "foobar");
	ok;
}
开发者ID:Dasaan,项目名称:angband,代码行数:11,代码来源:store.c

示例12: parse_prefs_y

static enum parser_error parse_prefs_y(struct parser *p)
{
	struct prefs_data *d = parser_priv(p);
	assert(d != NULL);
	if (d->bypass)
		return PARSE_ERROR_NONE;

	option_set(parser_getstr(p, "option"), TRUE);

	return PARSE_ERROR_NONE;
}
开发者ID:NickMcConnell,项目名称:Beleriand,代码行数:11,代码来源:prefs.c

示例13: test_info0

int test_info0(void *state) {
	enum parser_error r = parser_parse(state, "info:9:2");
	struct feature *f;

	eq(r, PARSE_ERROR_NONE);
	f = parser_priv(state);
	require(f);
	eq(f->shopnum, 9);
	eq(f->dig, 2);
	ok;
}
开发者ID:NickMcConnell,项目名称:angband,代码行数:11,代码来源:f-info.c

示例14: test_graphics0

int test_graphics0(void *state) {
	enum parser_error r = parser_parse(state, "graphics:::red");
	struct feature *f;

	eq(r, PARSE_ERROR_NONE);
	f = parser_priv(state);
	require(f);
	eq(f->d_char, L':');
	eq(f->d_attr, COLOUR_RED);
	ok;
}
开发者ID:NickMcConnell,项目名称:angband,代码行数:11,代码来源:f-info.c

示例15: test_n0

static int test_n0(void *state) {
	errr r = parser_parse(state, "N:3:Test Object Kind");
	struct object_kind *k;

	eq(r, 0);
	k = parser_priv(state);
	require(k);
	eq(k->kidx, 3);
	require(streq(k->name, "Test Object Kind"));
	ok;
}
开发者ID:apwhite,项目名称:angband,代码行数:11,代码来源:k-info.c


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