本文整理汇总了C++中check_param函数的典型用法代码示例。如果您正苦于以下问题:C++ check_param函数的具体用法?C++ check_param怎么用?C++ check_param使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_param函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: avro_schema_union_size
size_t avro_schema_union_size(const avro_schema_t union_schema)
{
check_param(EINVAL, is_avro_schema(union_schema), "union schema");
check_param(EINVAL, is_avro_union(union_schema), "union schema");
struct avro_union_schema_t *unionp = avro_schema_to_union(union_schema);
return unionp->branches->num_entries;
}
开发者ID:ColonelHou,项目名称:hpg-bigdata,代码行数:7,代码来源:schema.c
示例2: avro_schema_link_target
avro_schema_t avro_schema_link_target(avro_schema_t schema)
{
check_param(NULL, is_avro_schema(schema), "schema");
check_param(NULL, is_avro_link(schema), "schema");
struct avro_link_schema_t *link = avro_schema_to_link(schema);
return link->to;
}
开发者ID:AlexChen12,项目名称:avro,代码行数:8,代码来源:schema.c
示例3: avro_schema_to_json
int avro_schema_to_json(const avro_schema_t schema, avro_writer_t out)
{
check_param(EINVAL, is_avro_schema(schema), "schema");
check_param(EINVAL, out, "writer");
int rval;
if (is_avro_primitive(schema)) {
check(rval, avro_write_str(out, "{\"type\":\""));
}
switch (avro_typeof(schema)) {
case AVRO_STRING:
check(rval, avro_write_str(out, "string"));
break;
case AVRO_BYTES:
check(rval, avro_write_str(out, "bytes"));
break;
case AVRO_INT32:
check(rval, avro_write_str(out, "int"));
break;
case AVRO_INT64:
check(rval, avro_write_str(out, "long"));
break;
case AVRO_FLOAT:
check(rval, avro_write_str(out, "float"));
break;
case AVRO_DOUBLE:
check(rval, avro_write_str(out, "double"));
break;
case AVRO_BOOLEAN:
check(rval, avro_write_str(out, "boolean"));
break;
case AVRO_NULL:
check(rval, avro_write_str(out, "null"));
break;
case AVRO_RECORD:
return write_record(out, avro_schema_to_record(schema));
case AVRO_ENUM:
return write_enum(out, avro_schema_to_enum(schema));
case AVRO_FIXED:
return write_fixed(out, avro_schema_to_fixed(schema));
case AVRO_MAP:
return write_map(out, avro_schema_to_map(schema));
case AVRO_ARRAY:
return write_array(out, avro_schema_to_array(schema));
case AVRO_UNION:
return write_union(out, avro_schema_to_union(schema));
case AVRO_LINK:
return write_link(out, avro_schema_to_link(schema));
}
if (is_avro_primitive(schema)) {
return avro_write_str(out, "\"}");
}
avro_set_error("Unknown schema type");
return EINVAL;
}
开发者ID:7472741,项目名称:impala,代码行数:58,代码来源:schema.c
示例4: check_param_count
int32 scriptlib::debug_pre_set_target(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1);
check_param(L, PARAM_TYPE_CARD, 2);
card* t_card = *(card**) lua_touserdata(L, 1);
card* target = *(card**) lua_touserdata(L, 2);
t_card->add_card_target(target);
return 0;
}
开发者ID:Tianchenglipu,项目名称:ygopro-core,代码行数:9,代码来源:libdebug.cpp
示例5: check_param_count
int32 scriptlib::effect_set_operation(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_EFFECT, 1);
check_param(L, PARAM_TYPE_FUNCTION, 2);
effect* peffect = *(effect**) lua_touserdata(L, 1);
if(peffect->operation)
luaL_unref(L, LUA_REGISTRYINDEX, peffect->operation);
peffect->operation = interpreter::get_function_handle(L, 2);
return 0;
}
开发者ID:SetoKaibaK-C,项目名称:ygopro,代码行数:10,代码来源:libeffect.cpp
示例6: pop_main
// seg000:0000
void far pop_main() {
// debug only: check that the sequence table deobfuscation did not mess things up
#ifdef CHECK_SEQTABLE_MATCHES_ORIGINAL
check_seqtable_matches_original();
#endif
load_options();
apply_seqtbl_patches();
char sprintf_temp[100];
int i;
dathandle = open_dat("PRINCE.DAT", 0);
/*video_mode =*/ parse_grmode();
init_timer(60);
parse_cmdline_sound();
set_hc_pal();
current_target_surface = rect_sthg(onscreen_surface_, &screen_rect);
show_loading();
set_joy_mode();
cheats_enabled = check_param("megahit") != NULL;
#ifdef __DEBUG__
cheats_enabled = 1; // debug
#endif
draw_mode = check_param("draw") != NULL && cheats_enabled;
demo_mode = check_param("demo") != NULL;
init_copyprot_dialog();
#ifdef USE_REPLAY
init_record_replay();
#endif
if (cheats_enabled
#ifdef USE_REPLAY
|| recording
#endif
) {
for (i = 14; i >= 0; --i) {
snprintf(sprintf_temp, sizeof(sprintf_temp), "%d", i);
if (check_param(sprintf_temp)) {
start_level = i;
break;
}
}
}
init_game_main();
}
开发者ID:diddledan,项目名称:SDLPoP,代码行数:53,代码来源:seg000.c
示例7: ft_split_whitespaces
t_lenv *core(t_lenv *env, char *line)
{
char **param;
g_bool = 0;
param = ft_split_whitespaces(line);
if (param[0] && check_param(param[0]) == 0)
exec_core(env, param);
else if (param[0] && check_param(param[0]) == 1)
env = ft_parse(env, param);
if (g_bool != 2)
print_prompt();
g_bool = 0;
return (env);
}
开发者ID:qmuntada,项目名称:sh1,代码行数:15,代码来源:core.c
示例8: ask_user_for_blksize
/*
* ask the user to specify a blocksize
*/
static format_data_t ask_user_for_blksize(format_data_t params)
{
char c, str[ERR_LENGTH], buffer[20];
int i, rc;
i = params.blksize;
do {
params.blksize = i;
printf("Please enter the blocksize of the formatting [%d]: ", i);
if (fgets(buffer, sizeof(buffer), stdin) == NULL)
break;
rc = sscanf(buffer,"%d%c", ¶ms.blksize, &c);
if ((rc == 2) && (c == '\n'))
rc = 1;
if (rc == -1)
rc = 1; /* this happens, if enter is pressed */
if (rc != 1)
printf(" -- wrong input, try again.\n");
if (check_param(str, ERR_LENGTH, ¶ms) < 0) {
printf(" -- %s\n",str);
rc = 0;
}
} while (rc != 1);
return params;
}
开发者ID:hreinecke,项目名称:s390-tools,代码行数:33,代码来源:dasdfmt.c
示例9:
char *ft_convert_base(char *nbr, char *base_from, char *base_to)
{
int nb;
int nb_tmp;
int size;
int result;
if (check_param(nbr, base_from, base_to) == 1)
return (NULL);
result = 1;
nb = ft_base_ten(nbr, base_from);
if (nb == -1)
return (nbr);
nb_tmp = nb;
size = 0;
while (result != 0)
{
nb_tmp = nb_tmp / (int)ft_strlen(base_to);
result = nb_tmp;
size++;
}
if ((nbr = (char*)malloc(sizeof(nbr) * (size + 1))) == NULL)
return (NULL);
ft_base_to(nbr, base_to, nb, size);
nbr[size] = '\0';
return (nbr);
}
开发者ID:floklein,项目名称:42,代码行数:27,代码来源:ft_convert_base.c
示例10: write_instructions
int write_instructions(int fd, int fdwrite)
{
char *tmp;
int size;
int i;
char *ins;
char *param;
t_asm *my_asm;
i = 2;
my_asm = NULL;
while ((tmp = get_next_line(fd)))
{
i++;
if (tmp != NULL && tmp[0] != '.' && all_space(tmp) != 0)
{
tmp = remove_space(tmp);
ins = parse_action(tmp, 0);
param = parse_action(tmp, 1);
ins = remove_all_space(ins);
param = remove_all_space(param);
if (check_arg(ins) != 1 ||
check_param(ins, param) != 1)
return (error_line(i));
my_asm = add_action(my_asm, ins, param);
}
}
my_asm = my_asm->next;
if ((size = instructions_file(fdwrite, my_asm)) == -1
|| write_size(fdwrite, size) == -1)
return (-1);
return (0);
}
开发者ID:MrDarkSkil,项目名称:coreware,代码行数:34,代码来源:write_instructions.c
示例11: read_coordinates
void read_coordinates(FILE *fp, int *iatm, int count, int nb_atoms, PROT *prot) {
int k;
float x,y,z;
int iConf;
ATOM atom;
for (k=0; k<nb_atoms; k++) {
fread(&iConf,sizeof(int),1,fp);
fread(&x,sizeof(float),1,fp); fread(&y,sizeof(float),1,fp); fread(&z,sizeof(float),1,fp);
atom.serial = 0;
strcpy(atom.name,prot->res[count].conf[1].atom[iatm[k]].name);
atom.altLoc = prot->res[count].conf[1].atom[iatm[k]].altLoc;
strcpy(atom.resName,prot->res[count].conf[1].atom[iatm[k]].resName);
atom.chainID = prot->res[count].conf[1].atom[iatm[k]].chainID;
atom.resSeq = prot->res[count].conf[1].atom[iatm[k]].resSeq;
atom.iCode = prot->res[count].conf[1].atom[iatm[k]].iCode;
atom.iConf = iConf;
atom.xyz.x = x; atom.xyz.y = y; atom.xyz.z = z;
atom.rad = prot->res[count].conf[1].atom[iatm[k]].rad;
atom.crg = prot->res[count].conf[1].atom[iatm[k]].crg;
//strcpy(atom.history,prot->res[count].conf[1].atom[iatm[k]].history);
fread(atom.history, sizeof(char), 11, fp);
//sprintf(atom.history,"%s","01R000M000");//fixed 03-31/2009 Pascal
//printf("Atom History read:%s\n",atom.history);
strcpy(atom.confName,atom.resName); strncpy(atom.confName+3,atom.history,2); atom.confName[5] = '\0';
sprintf(atom.confID,"%i",iConf);//length 8
check_param(atom,prot);
}
};
开发者ID:GunnerLab,项目名称:mcce3.5,代码行数:31,代码来源:load_pdb_no_param.c
示例12: avro_datum_value_get_size
static int
avro_datum_value_get_size(const avro_value_iface_t *iface,
const void *vself, size_t *size)
{
AVRO_UNUSED(iface);
const avro_datum_t self = (const avro_datum_t) vself;
check_param(EINVAL, self, "datum instance");
if (is_avro_array(self)) {
*size = avro_array_size(self);
return 0;
}
if (is_avro_map(self)) {
*size = avro_map_size(self);
return 0;
}
if (is_avro_record(self)) {
avro_schema_t schema = avro_datum_get_schema(self);
*size = avro_schema_record_size(schema);
return 0;
}
avro_set_error("Can only get size of array, map, or record, %d", avro_typeof(self));
return EINVAL;
}
开发者ID:clayreimann,项目名称:ObjectiveAvro,代码行数:27,代码来源:datum_value.c
示例13: main
int main(int ac, char **av)
{
t_lst *a;
t_lst *b;
int i;
a = NULL;
b = NULL;
i = 1;
if (ac == 1)
ft_putendl("Error. No number.");
else
{
while (av[i])
{
if (check_param(av[i]) == -1)
{
ft_putendl("Error.");
exit(0);
}
a = add_new_number(a, av[i]);
i++;
}
}
ft_rra(&a);
aff_lst(a);
ft_putendl("");
aff_lst(b);
ft_putendl("");
return (0);
}
开发者ID:jbahus,项目名称:push_swap,代码行数:31,代码来源:main.c
示例14: avro_datum_value_append
static int
avro_datum_value_append(const avro_value_iface_t *iface,
void *vself, avro_value_t *child_out, size_t *new_index)
{
AVRO_UNUSED(iface);
avro_datum_t self = (avro_datum_t) vself;
check_param(EINVAL, self, "datum instance");
if (!is_avro_array(self)) {
avro_set_error("Can only append to array");
return EINVAL;
}
int rval;
avro_schema_t array_schema = avro_datum_get_schema(self);
avro_schema_t child_schema = avro_schema_array_items(array_schema);
avro_datum_t child_datum = avro_datum_from_schema(child_schema);
if (child_datum == NULL) {
return ENOMEM;
}
rval = avro_array_append_datum(self, child_datum);
avro_datum_decref(child_datum);
if (rval != 0) {
return rval;
}
if (new_index != NULL) {
*new_index = avro_array_size(self) - 1;
}
return avro_datum_as_child_value(child_out, child_datum);
}
开发者ID:clayreimann,项目名称:ObjectiveAvro,代码行数:33,代码来源:datum_value.c
示例15: avro_schema_union_append
int
avro_schema_union_append(const avro_schema_t union_schema,
const avro_schema_t schema)
{
check_param(EINVAL, is_avro_schema(union_schema), "union schema");
check_param(EINVAL, is_avro_union(union_schema), "union schema");
check_param(EINVAL, is_avro_schema(schema), "schema");
struct avro_union_schema_t *unionp = avro_schema_to_union(union_schema);
int new_index = unionp->branches->num_entries;
st_insert(unionp->branches, new_index, (st_data_t) schema);
const char *name = avro_schema_type_name(schema);
st_insert(unionp->branches_byname, (st_data_t) name,
(st_data_t) new_index);
avro_schema_incref(schema);
return 0;
}
开发者ID:AlexChen12,项目名称:avro,代码行数:17,代码来源:schema.c
示例16: avro_datum_value_set_null
static int
avro_datum_value_set_null(const avro_value_iface_t *iface, void *vself)
{
AVRO_UNUSED(iface);
avro_datum_t self = (avro_datum_t) vself;
check_param(EINVAL, is_avro_null(self), "datum instance");
return 0;
}
开发者ID:clayreimann,项目名称:ObjectiveAvro,代码行数:8,代码来源:datum_value.c
示例17: avro_datum_value_get_schema
static avro_schema_t
avro_datum_value_get_schema(const avro_value_iface_t *iface, const void *vself)
{
AVRO_UNUSED(iface);
const avro_datum_t self = (const avro_datum_t) vself;
check_param(NULL, self, "datum instance");
return avro_datum_get_schema(self);
}
开发者ID:clayreimann,项目名称:ObjectiveAvro,代码行数:8,代码来源:datum_value.c
示例18: avro_datum_value_reset
static int
avro_datum_value_reset(const avro_value_iface_t *iface, void *vself)
{
AVRO_UNUSED(iface);
avro_datum_t self = (avro_datum_t) vself;
check_param(EINVAL, self, "datum instance");
return avro_datum_reset(self);
}
开发者ID:clayreimann,项目名称:ObjectiveAvro,代码行数:8,代码来源:datum_value.c
示例19: check_param_count
int32 scriptlib::effect_is_activatable(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1);
uint32 playerid = lua_tointeger(L, 2);
effect* peffect = *(effect**) lua_touserdata(L, 1);
lua_pushboolean(L, peffect->is_activateable(playerid, peffect->pduel->game_field->nil_event));
return 1;
}
开发者ID:HuRRiCaNe276,项目名称:ygopro,代码行数:8,代码来源:libeffect.cpp
示例20: threaded
/* thread function */
void * threaded ( void * arg )
{
int ret = 0;
struct sched_param sp;
/* Set priority to a known value */
sp.sched_priority = sched_get_priority_max( SCHED_RR );
ret = pthread_setschedparam( pthread_self(), SCHED_RR, &sp );
if ( ret != 0 )
{
UNRESOLVED( ret, "Failed to set thread policy -- need to be root?" );
}
/* check the thread attributes have been applied
(we only check what is reported, not the real behavior)
*/
check_param( pthread_self(), SCHED_RR, sp.sched_priority );
/* Now set the priority to an invalid value. */
sp.sched_priority++;
ret = pthread_setschedparam( pthread_self(), SCHED_RR, &sp );
if ( ret != 0 )
{
/* check the thread attributes have been applied
(we only check what is reported, not the real behavior)
*/
check_param( pthread_self(), SCHED_RR, sp.sched_priority - 1 );
#if VERBOSE > 0
output( "Setting to a wrong priority failed with error %d (%s).\n",
ret,
strerror( ret ) );
}
else
{
output( "UNTESTED: setting to max prio + 1 did not fail.\n" );
#endif
}
return NULL;
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:47,代码来源:4-1.c
注:本文中的check_param函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论