这篇教程C++ throw_error函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中throw_error函数的典型用法代码示例。如果您正苦于以下问题:C++ throw_error函数的具体用法?C++ throw_error怎么用?C++ throw_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了throw_error函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: mc_flush_allVALUE mc_flush_all(int argc, VALUE *argv, VALUE self) { memcached_st *mc; VALUE delay; static memcached_return_t result; Data_Get_Struct(self, memcached_st, mc); rb_scan_args(argc, argv, "01", &delay); result = memcached_flush(mc, RTEST(delay) ? NUM2UINT(delay) : 0); if (result == MEMCACHED_SUCCESS) { return Qnil; } else { return throw_error(&result); }}
开发者ID:oleg-z,项目名称:memcache,代码行数:16,
示例2: done bool done() { //rankprintf("last_snt = %d/n", last_sent); if (-1 == last_sent) return true; //task_list[last_sent].display(); if (true != task_list[last_sent].sent) throw_error("Task never sent"); if (true == task_list[last_sent].complete) return true; else { int data = get_status(this_comm); rankprintf("Rec'd status %d from node 1/n", data); if (STATUS_IDLE == data) { task_list[last_sent].complete = true; return true; } else return false; } }
开发者ID:shaoguangleo,项目名称:ExecutionEngine,代码行数:16,
示例3: lookup_variable_valuestatic pSlipObject lookup_variable_value(pSlip gd, pSlipObject var, pSlipEnvironment env){ pSlipValue v; do { v = ScanForVar(var, env); if (v != NULL) return v->val; env = enclosing_environment(env); }while (env != NULL); throw_error(gd, "unbound variable %s for lookup/n", (char*)var->data.symbol.value); return NULL;}
开发者ID:stu,项目名称:bootstrap-slip,代码行数:16,
示例4: savevoid save(struct lexeme *tmpData, char to_save) { char *holder = NULL; if(length>=chunks*CHUNK) { //pokud je delka retezce vetsi nez alokovane if(chunks) holder = tmpData->value.string; //napln temp if((tmpData->value.string = (char *)malloc(++chunks*CHUNK)) == NULL) //alokuj pamet throw_error(CODE_ERROR_INTERNAL, "malloc error"); if(holder) { memcpy((void *)tmpData->value.string, (void *)holder, length); //kopiruj hodnotu retezce free(holder); //uvolni tmp } } tmpData->value.string[length++] = to_save; //ulozeni retezce}
开发者ID:gelidus,项目名称:IFJ15,代码行数:16,
示例5: pushvoid push(unsigned int **last_multis, unsigned int multiplier) { unsigned int *tmp = realloc(*last_multis, n_indents * sizeof(unsigned int)); if (tmp == NULL) { throw_error(stderr, errors[14], __FILE__, __func__, __LINE__); flags |= EXIT; if (*last_multis != NULL) { free(*last_multis); *last_multis = NULL; } } else { *last_multis = tmp; (*last_multis)[n_indents - 1] = multiplier; }}
开发者ID:sanctusraphael,项目名称:Fuck,代码行数:16,
示例6: ft_strlenchar *get_label_value(char **line, char *label, char *tmp){ int label_size; int i; label_size = ft_strlen(label); *line = ft_strsub(*line, label_size, ft_strlen(*line) - label_size); free(tmp); i = 0; while (i < label_size - 1) { if (ft_strchr(LABEL_CHARS, label[i]) == NULL) throw_error(1); i++; } return (label);}
开发者ID:magouin,项目名称:Corewar,代码行数:17,
示例7: parse_integercata::optional<int> cata::string_formatter::read_number_or_argument_index(){ if( consume_next_input_if( '*' ) ) { if( !has_digit() ) { return current_argument_index++; } const int index = parse_integer() - 1; // format specifiers are 1-based if( !consume_next_input_if( '$' ) ) { throw_error( "expected '$' after field precision" ); } return index ; } while( has_digit() ) { current_format.push_back( consume_next_input() ); } return cata::nullopt;}
开发者ID:RyanMcManaman,项目名称:Cataclysm-DDA,代码行数:17,
示例8: protocol_entry explicit protocol_entry(int protocol) { char name_buf_[name_buffer_length]; entry_type result_buf_, *result_; int retval = getprotobynumber_r( protocol, &result_buf_, name_buf_, sizeof name_buf_, &result_ ); if (result_ == nullptr || retval != 0) throw_error(retval); store_entry_elem(result_buf_); }
开发者ID:pfpacket,项目名称:libarex,代码行数:18,
示例9: set_variable_valuestatic void set_variable_value(pSlip gd, pSlipObject var, pSlipObject val, pSlipEnvironment env){ pSlipValue v; do { v = ScanForVar(var, env); if (v != NULL) { v->val = val; return; } env = enclosing_environment(env); }while (env != NULL); throw_error(gd, "unbound variable %s for assignment/n", (char*)var->data.symbol.value);}
开发者ID:stu,项目名称:bootstrap-slip,代码行数:18,
示例10: send_next int send_next() { int q=0; while(true == task_list[q].sent && q < n_tasks) { q++; } if (500 == q) { throw_error("No task"); return -1; } debugMark(1); send_task(this_comm, task_list[q].task_msg[0], task_list[q].task_msg[1], task_list[q].task_msg[2]); debugMark(2); task_list[q].sent = true; last_sent = q; return q; }
开发者ID:shaoguangleo,项目名称:ExecutionEngine,代码行数:18,
示例11: mc_deleteVALUE mc_delete(VALUE self, VALUE key) { memcached_st *mc; static memcached_return_t result; Data_Get_Struct(self, memcached_st, mc); key = StringValue(key); if (!use_binary(mc)) key = escape_key(key, NULL); result = memcached_delete(mc, RSTRING_PTR(key), RSTRING_LEN(key), 0); if (result == MEMCACHED_SUCCESS) { return Qtrue; } else if(result == MEMCACHED_NOTFOUND) { return Qnil; } else { return throw_error(&result); }}
开发者ID:oleg-z,项目名称:memcache,代码行数:18,
示例12: load_map_filevoid load_map_file(const char *mapfile, roomBase *roomdb){ FILE *fp = NULL; if ( (fp = fopen(mapfile, "r")) == NULL ) throw_error("could not open mapfile"); char line_buffer[LINE_BUFFER_SIZE] = { 0 }; char id_buffer[LINE_BUFFER_SIZE] = { 0 }; int coordinates_buffer[2]; char object_ids_buffer[LINE_BUFFER_SIZE] = { 0 }; char enemy_ids_buffer[LINE_BUFFER_SIZE] = { 0 }; //char dependency_object_ids_buffer[LINE_BUFFER_SIZE] = { 0 }; int locked_buffer; int room_index = 0; while ( fgets(line_buffer, LINE_BUFFER_SIZE, fp) != NULL ) { //sscanf(line_buffer, "%50[^|]|%d,%d|%50[^|]|%50[^|]", id_buffer, &coordinates_buffer[0], &coordinates_buffer[1], object_ids_buffer, dependency_object_ids_buffer); sscanf(line_buffer, "%50[^|]|%d,%d|%50[^|]|%50[^|]|%d", id_buffer, &coordinates_buffer[0], &coordinates_buffer[1], object_ids_buffer, enemy_ids_buffer, &locked_buffer); tokenise_room_objects(object_ids_buffer, &(roomdb->rooms[room_index])); tokenise_room_enemies(enemy_ids_buffer, &(roomdb->rooms[room_index])); //tokenise_room_dependency_objects(dependency_object_ids_buffer, &(roomdb->rooms[room_index])); strncpy(roomdb->rooms[room_index].id, id_buffer, ID_LENGTH); roomdb->rooms[room_index].coordinates[0] = coordinates_buffer[0]; roomdb->rooms[room_index].coordinates[1] = coordinates_buffer[1]; roomdb->rooms[room_index].locked = locked_buffer; //printf("ID: %s/n", id_buffer); //printf("Coordinates: %d,%d/n", coordinates_buffer[0], coordinates_buffer[1]); //printf("Room objects: %s/n", object_ids_buffer); //printf("Room dependency objects: %s/n", dependency_object_ids_buffer); memset(line_buffer, LINE_BUFFER_SIZE, '/0'); memset(id_buffer, LINE_BUFFER_SIZE, '/0'); memset(object_ids_buffer, LINE_BUFFER_SIZE, '/0'); coordinates_buffer[0] = 0; coordinates_buffer[1] = 0; locked_buffer = 0; room_index++; } roomdb->nrooms = room_index;}
开发者ID:Joshun,项目名称:textadventure-engine,代码行数:44,
示例13: daemon_find_user_by_namestatic gbooleandaemon_find_user_by_name (AccountsAccounts *accounts, GDBusMethodInvocation *context, const gchar *name){ Daemon *daemon = (Daemon*)accounts; User *user; user = daemon_local_find_user_by_name (daemon, name); if (user) { accounts_accounts_complete_find_user_by_name (NULL, context, user_get_object_path (user)); } else { throw_error (context, ERROR_FAILED, "Failed to look up user with name %s.", name); } return TRUE;}
开发者ID:freedesktop-unofficial-mirror,项目名称:accountsservice,代码行数:19,
示例14: daemon_find_user_by_idstatic gbooleandaemon_find_user_by_id (AccountsAccounts *accounts, GDBusMethodInvocation *context, gint64 uid){ Daemon *daemon = (Daemon*)accounts; User *user; user = daemon_local_find_user_by_id (daemon, uid); if (user) { accounts_accounts_complete_find_user_by_id (NULL, context, user_get_object_path (user)); } else { throw_error (context, ERROR_FAILED, "Failed to look up user with uid %d.", (int)uid); } return TRUE;}
开发者ID:freedesktop-unofficial-mirror,项目名称:accountsservice,代码行数:19,
示例15: load_objects_filevoid load_objects_file(const char *objectsfile, objectBase *objectdb){ FILE *fp = NULL; if ( (fp = fopen(objectsfile, "r")) == NULL ) throw_error("could not open objectsfile"); char line_buffer[LINE_BUFFER_SIZE] = { 0 }; char id_buffer[LINE_BUFFER_SIZE] = { 0 }; char name_buffer[LINE_BUFFER_SIZE] = { 0 }; char description_buffer[LINE_BUFFER_SIZE] = { 0 }; char action_buffer[LINE_BUFFER_SIZE] = { 0 }; char action_parameter_buffer[LINE_BUFFER_SIZE] = { 0 }; int removeable_buffer = 0; int hitpoints_buffer = 0; int object_index = 0; while ( fgets(line_buffer, LINE_BUFFER_SIZE, fp) != NULL ) { sscanf(line_buffer, "%50[^|]|%50[^|]|%50[^|]|%d|%d|%50[^|]|%50[^|/n]", id_buffer, name_buffer, description_buffer, &removeable_buffer, &hitpoints_buffer, action_buffer, action_parameter_buffer); //description_buffer[strlen(description_buffer) - 1] = 0; /* Remove newline */ strncpy(objectdb->objects[object_index].id, id_buffer, ID_LENGTH); strncpy(objectdb->objects[object_index].name, name_buffer, NAME_LENGTH); strncpy(objectdb->objects[object_index].description, description_buffer, DESCRIPTION_LENGTH); strncpy(objectdb->objects[object_index].action, action_buffer, ID_LENGTH); strncpy(objectdb->objects[object_index].action_parameter, action_parameter_buffer, ID_LENGTH); objectdb->objects[object_index].removeable = removeable_buffer; objectdb->objects[object_index].hitpoints = hitpoints_buffer; memset(line_buffer, '/0', LINE_BUFFER_SIZE); memset(id_buffer, '/0', LINE_BUFFER_SIZE); memset(name_buffer, '/0', LINE_BUFFER_SIZE); memset(description_buffer, '/0', LINE_BUFFER_SIZE); memset(action_buffer, '/0', LINE_BUFFER_SIZE); memset(action_parameter_buffer, '/0', LINE_BUFFER_SIZE); hitpoints_buffer = 0; removeable_buffer = 0; object_index++; } objectdb->nobjects = object_index; fclose(fp);}
开发者ID:Joshun,项目名称:textadventure-engine,代码行数:42,
示例16: forkvoid server_node::start(){ if (is_started()) throw std::runtime_error("Server node /"" + m_path + "/" is already started"); if (m_fork) { m_kill_sent = false; m_pid = fork(); if (m_pid == -1) { m_pid = 0; int err = -errno; throw_error(err, "Failed to fork process"); } else if (m_pid == 0) { char buffer[3][1024] = { " ", "-c" }; std::string ios_path = ioserv_path(); char * const args[] = { const_cast<char*>(ios_path.c_str()), buffer[1], const_cast<char*>(m_path.c_str()), NULL }; auto ld_path = std::string("LD_LIBRARY_PATH=") + getenv("LD_LIBRARY_PATH"); char * const env[] = { const_cast<char*>(ld_path.c_str()), NULL }; if (execve(ios_path.data(), args, env) == -1) { int err = -errno; std::cerr << create_error(err, "Failed to start process /"%s/"", ios_path.c_str()).message() << std::endl; quick_exit(1); } } } else { m_node = dnet_parse_config(m_path.c_str(), 0); } if (!is_started()) throw std::runtime_error("Can not start server with config file: /"" + m_path + "/"");}
开发者ID:diunko,项目名称:elliptics,代码行数:42,
示例17: mc_prependVALUE mc_prepend(VALUE self, VALUE key, VALUE value) { memcached_st *mc; static memcached_return_t result; Data_Get_Struct(self, memcached_st, mc); key = StringValue(key); if (!use_binary(mc)) key = escape_key(key, NULL); value = StringValue(value); result = memcached_prepend(mc, RSTRING_PTR(key), RSTRING_LEN(key), RSTRING_PTR(value), RSTRING_LEN(value), 0, 0); if (result == MEMCACHED_SUCCESS) { return Qtrue; } else if(result == MEMCACHED_NOTSTORED) { return Qfalse; } else { return throw_error(&result); }}
开发者ID:oleg-z,项目名称:memcache,代码行数:20,
示例18: process_translate_general |