本文整理汇总了C++中INTERNAL_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ INTERNAL_ERROR函数的具体用法?C++ INTERNAL_ERROR怎么用?C++ INTERNAL_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了INTERNAL_ERROR函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: print_move_path
static void
print_move_path(const struct game *original_game,
const move *m,
enum move_notation_type mn)
{
char str[MOVE_STR_BUFFER_LENGTH];
bool first = true;
struct game *g = game_copy(original_game);
if (g == NULL)
INTERNAL_ERROR();
for (; *m != 0; ++m) {
if (!is_uci) {
if (game_turn(g) == white || first)
printf("%u. ", game_full_move_count(g));
if (first && game_turn(g) == black)
printf("... ");
}
first = false;
(void) print_move(game_current_position(g),
*m, str, mn, game_turn(g));
printf("%s ", str);
if (game_append(g, *m) != 0)
INTERNAL_ERROR();
}
game_destroy(g);
}
开发者ID:GBuella,项目名称:Taltos,代码行数:27,代码来源:command_loop.c
示例2: SRA_StatisticsNextPath
bool SRA_StatisticsNextPath ( const SRA_Statistics * self, ctx_t ctx, const char * path, const char** next )
{
FUNC_ENTRY ( ctx, rcSRA, rcDatabase, rcAccessing );
const DictionaryEntry * node = NULL;
assert ( self );
if ( path == NULL )
INTERNAL_ERROR ( xcParamNull, "path is NULL" );
else if ( path[0] == 0 )
{
node = ( const DictionaryEntry * ) BSTreeFirst ( & self -> dictionary );
}
else
{
node = ( const DictionaryEntry * ) BSTreeFind ( & self -> dictionary, ( const void * ) path, DictionaryEntryFind );
if ( node == NULL )
{
INTERNAL_ERROR ( xcUnexpected, "dictionary item '%s' is not found", path );
}
else
{
node = ( const DictionaryEntry * ) BSTNodeNext ( & node -> dad );
}
}
if ( node == NULL )
{
*next = NULL;
return false;
}
*next = node -> path;
return true;
}
开发者ID:ncbi,项目名称:ncbi-vdb,代码行数:34,代码来源:SRA_Statistics.c
示例3: SRA_StatisticsGetAsU64
uint64_t SRA_StatisticsGetAsU64 ( const SRA_Statistics * self, ctx_t ctx, const char * path )
{
FUNC_ENTRY ( ctx, rcSRA, rcDatabase, rcAccessing );
assert ( self );
if ( path == NULL )
INTERNAL_ERROR ( xcParamNull, "path is NULL" );
else
{
DictionaryEntry * node = ( DictionaryEntry * )
BSTreeFind ( & self -> dictionary, ( const void * ) path, DictionaryEntryFind );
if ( node == NULL )
{
INTERNAL_ERROR ( xcUnexpected, "dictionary item '%s' is not found", path );
}
else
{
switch ( node -> type )
{
case NGS_StatisticValueType_Int64:
if ( node -> value . i64 < 0 )
{
INTERNAL_ERROR ( xcUnexpected, "cannot convert dictionary item '%s' from in64_t to uint64_t", path );
}
else
{
return ( uint64_t ) node -> value . i64;
}
break;
case NGS_StatisticValueType_UInt64:
return node -> value . i64;
case NGS_StatisticValueType_Real:
if ( node -> value . real < 0 || node -> value . real > ULLONG_MAX )
{
INTERNAL_ERROR ( xcUnexpected, "cannot convert dictionary item '%s' from double to uint64_t", path );
}
else
{
return ( uint64_t ) xtrunc ( node -> value . real );
}
break;
case NGS_StatisticValueType_String:
return NGS_StringToU64 ( node -> value . str, ctx );
default :
INTERNAL_ERROR ( xcUnexpected, "unexpected type %u for dictionary item '%s'", node -> type, path );
break;
}
}
}
return 0;
}
开发者ID:ncbi,项目名称:ncbi-vdb,代码行数:57,代码来源:SRA_Statistics.c
示例4: SRA_StatisticsGetAsString
NGS_String* SRA_StatisticsGetAsString ( const SRA_Statistics * self, ctx_t ctx, const char * path )
{
FUNC_ENTRY ( ctx, rcSRA, rcDatabase, rcAccessing );
assert ( self );
if ( path == NULL )
INTERNAL_ERROR ( xcParamNull, "path is NULL" );
else
{
DictionaryEntry * node = ( DictionaryEntry * )
BSTreeFind ( & self -> dictionary, ( const void * ) path, DictionaryEntryFind );
if ( node == NULL )
{
INTERNAL_ERROR ( xcUnexpected, "dictionary item '%s' is not found", path );
}
else
{
switch ( node -> type )
{
case NGS_StatisticValueType_UInt64:
{
char buf[1024];
size_t num_writ;
string_printf ( buf, sizeof(buf), &num_writ, "%lu", node -> value . u64 );
return NGS_StringMakeCopy ( ctx, buf, num_writ );
}
break;
case NGS_StatisticValueType_Int64:
{
char buf[1024];
size_t num_writ;
string_printf ( buf, sizeof(buf), &num_writ, "%li", node -> value . i64 );
return NGS_StringMakeCopy ( ctx, buf, num_writ );
}
case NGS_StatisticValueType_Real:
{
char buf[1024];
size_t num_writ;
string_printf ( buf, sizeof(buf), &num_writ, "%f", node -> value . real );
return NGS_StringMakeCopy ( ctx, buf, num_writ );
}
case NGS_StatisticValueType_String:
return NGS_StringDuplicate ( node -> value . str, ctx );
default :
INTERNAL_ERROR ( xcUnexpected, "unexpected type %u for dictionary item '%s'", node -> type, path );
break;
}
}
}
return NULL;
}
开发者ID:ncbi,项目名称:ncbi-vdb,代码行数:57,代码来源:SRA_Statistics.c
示例5: handle_filt_cmd
/**
* Internal method to handle a command that relies
* on a filter name and a single key, responses are handled using
* handle_multi_response.
*/
static void handle_filt_cmd(bloom_conn_handler *handle, char *args, int args_len,
int(*filtmgr_func)(bloom_filtmgr *, char*)) {
// If we have no args, complain.
if (!args) {
handle_client_err(handle->conn, (char*)&FILT_NEEDED, FILT_NEEDED_LEN);
return;
}
// Scan past the filter name
char *key;
int key_len;
int after = buffer_after_terminator(args, args_len, ' ', &key, &key_len);
if (after == 0) {
handle_client_err(handle->conn, (char*)&UNEXPECTED_ARGS, UNEXPECTED_ARGS_LEN);
return;
}
// Call into the filter manager
int res = filtmgr_func(handle->mgr, args);
switch (res) {
case 0:
handle_client_resp(handle->conn, (char*)DONE_RESP, DONE_RESP_LEN);
break;
case -1:
handle_client_resp(handle->conn, (char*)FILT_NOT_EXIST, FILT_NOT_EXIST_LEN);
break;
case -2:
handle_client_resp(handle->conn, (char*)FILT_NOT_PROXIED, FILT_NOT_PROXIED_LEN);
break;
default:
INTERNAL_ERROR();
break;
}
}
开发者ID:ailove-lab,项目名称:bloomd,代码行数:39,代码来源:conn_handler.c
示例6: NGS_StringToU64
static uint64_t NGS_StringToU64( const NGS_String * str, ctx_t ctx )
{
/* have to guarantee NUL-termination for strtou64/strtod */
char buf[4096];
if ( sizeof(buf) > NGS_StringSize ( str, ctx ) )
{
char* end;
uint64_t value;
string_copy ( buf, sizeof(buf),
NGS_StringData ( str, ctx ), NGS_StringSize ( str, ctx ) );
errno = 0;
value = strtou64 ( buf, &end, 10 );
if ( *end == 0 )
{
if ( errno == 0 )
{
return value;
}
}
else
{ /* attempt to parse as a double */
double dbl;
errno = 0;
dbl = strtod ( buf, &end );
if ( *end == 0 && errno == 0 && dbl >= 0 && dbl <= ULLONG_MAX )
{
return ( uint64_t ) xtrunc ( dbl );
}
}
}
INTERNAL_ERROR ( xcUnexpected, "cannot convert dictionary value '%.*s' from string to uint64",
NGS_StringSize ( str, ctx ), NGS_StringData ( str, ctx ) );
return 0;
}
开发者ID:ncbi,项目名称:ncbi-vdb,代码行数:35,代码来源:SRA_Statistics.c
示例7: switch
void CSPELL_constant_val_to_string
(
AST_constant_n_t *cp,
char *str
)
{
char const *str2;
switch (cp->kind) {
case AST_nil_const_k:
sprintf (str, "NULL");
break;
case AST_boolean_const_k:
if (cp->value.boolean_val)
sprintf (str, "ndr_true");
else
sprintf (str, "ndr_false");
break;
case AST_int_const_k:
sprintf (str, "%ld", cp->value.int_val);
break;
case AST_string_const_k:
STRTAB_str_to_string (cp->value.string_val, &str2);
sprintf (str, "\"%s\"", str2);
break;
case AST_char_const_k:
sprintf (str, "'%s'", mapchar(cp, FALSE));
break;
default:
INTERNAL_ERROR("Unsupported tag in CSPELL_constant_val_to_string");
break;
}
}
开发者ID:HumbleRepose,项目名称:dcerpc,代码行数:33,代码来源:cspeldcl.c
示例8: INTERNAL_ERROR
static MonomialIdeal *wrapperFrobbyAlexanderDual(const MonomialIdeal *I,
const M2_arrayint top)
// Assumption: top is an array of at least the number of variables of I
// whose v-th entry is at least as large as the v-th exp of any mingen of I
{
// Create a Frobby Ideal containing I.
int nv = I->topvar() + 1;
if (nv == 0)
{
INTERNAL_ERROR("attempting to use frobby with zero variables");
return 0;
}
mpz_t *topvec = 0;
if (top->len > 0)
{
topvec = newarray(mpz_t, top->len);
for (int i = 0; i < top->len; i++)
mpz_init_set_si(topvec[i], top->array[i]);
}
MonomialIdeal *result = FrobbyAlexanderDual(I, topvec);
// Clean up
if (topvec != 0)
{
for (int i = 0; i < top->len; i++) mpz_clear(topvec[i]);
deletearray(topvec);
}
return result;
}
开发者ID:DanGrayson,项目名称:M2,代码行数:32,代码来源:x-monideal.cpp
示例9: ArgsGetOptU64
static
uint64_t ArgsGetOptU64 ( Args *self, const ctx_t *ctx, const char *optname, uint32_t *count )
{
rc_t rc;
uint64_t val = 0;
uint32_t dummy;
if ( count == NULL )
count = & dummy;
rc = ArgsOptionCount ( self, optname, count );
if ( rc == 0 && * count != 0 )
{
const char *str;
rc = ArgsOptionValue ( self, optname, 0, & str );
if ( rc != 0 )
INTERNAL_ERROR ( rc, "failed to retrieve '%s' parameter", optname );
else
{
char *end;
val = strtou64 ( str, & end, 0 );
if ( end [ 0 ] != 0 )
{
rc = RC ( rcExe, rcArgv, rcParsing, rcParam, rcIncorrect );
ERROR ( rc, "bad '%s' parameter: '%s'", optname, str );
}
}
}
return val;
}
开发者ID:DCGenomics,项目名称:sra-tools,代码行数:31,代码来源:sra-sort.c
示例10: _notmuch_string_list_sort
void
_notmuch_string_list_sort (notmuch_string_list_t *list)
{
notmuch_string_node_t **nodes, *node;
int i;
if (list->length == 0)
return;
nodes = talloc_array (list, notmuch_string_node_t *, list->length);
if (unlikely (nodes == NULL))
INTERNAL_ERROR ("Could not allocate memory for list sort");
for (i = 0, node = list->head; node; i++, node = node->next)
nodes[i] = node;
qsort (nodes, list->length, sizeof (*nodes), cmpnode);
for (i = 0; i < list->length - 1; ++i)
nodes[i]->next = nodes[i+1];
nodes[i]->next = NULL;
list->head = nodes[0];
list->tail = &nodes[i]->next;
talloc_free (nodes);
}
开发者ID:T-J-Teru,项目名称:notmuch,代码行数:26,代码来源:string-list.c
示例11: print_popular
/* Print the most common variant of a list of unique mailboxes, and
* conflate the counts. */
static void
print_popular (const search_context_t *ctx, GList *list)
{
GList *l;
mailbox_t *mailbox = NULL, *m;
int max = 0;
int total = 0;
for (l = list; l; l = l->next) {
m = l->data;
total += m->count;
if (m->count > max) {
mailbox = m;
max = m->count;
}
}
if (! mailbox)
INTERNAL_ERROR("Empty list in address hash table\n");
/* The original count is no longer needed, so overwrite. */
mailbox->count = total;
print_mailbox (ctx, mailbox);
}
开发者ID:marc1006,项目名称:notmuch,代码行数:27,代码来源:notmuch-search.c
示例12: set_state
/*
* set_state() -- initialize the RNG so that
* appropriate data sets can be generated.
* For each table that is to be generated, calculate the number of rows/child, and send that to the
* seed generation routine in speed_seed.c. Note: assumes that tables are completely independent.
* Returns the number of rows to be generated by the named step.
*/
DSS_HUGE
set_state(int table, long sf, long procs, long step, DSS_HUGE *extra_rows)
{
int i;
DSS_HUGE rowcount, remainder, result;
if (sf == 0 || step == 0)
return(0);
rowcount = tdefs[table].base / procs;
if ((sf / procs) > (int)MAX_32B_SCALE)
INTERNAL_ERROR("SCALE OVERFLOW. RE-RUN WITH MORE CHILDREN.");
rowcount *= sf;
remainder = (tdefs[table].base % procs) * sf;
rowcount += remainder / procs;
result = rowcount;
for (i=0; i < step - 1; i++)
{
if (table == LINE) /* special case for shared seeds */
tdefs[table].gen_seed(1, rowcount);
else
tdefs[table].gen_seed(0, rowcount);
/* need to set seeds of child in case there's a dependency */
/* NOTE: this assumes that the parent and child have the same base row count */
if (tdefs[table].child != NONE)
tdefs[tdefs[table].child].gen_seed(0,rowcount);
}
*extra_rows = remainder % procs;
if (step > procs) /* moving to the end to generate updates */
tdefs[table].gen_seed(0, *extra_rows);
return(result);
}
开发者ID:chsc0817,项目名称:DBImpl-projekt,代码行数:40,代码来源:bm_utils.c
示例13: switch
static void CSPELL_type_tail
(
FILE *fid,
type_tail_t *tail,
boolean encoding_services /* TRUE => [encode] or [decode] on operation */
)
{
int i;
for (i = 0; i < tail->len; i++)
switch (tail->vec[i].kind) {
case p_k:
fprintf (fid, ")");
break;
case a_k:
CSPELL_array_bounds (
fid,
tail->vec[i].content.array_info.array,
tail->vec[i].content.array_info.in_typedef_or_struct);
break;
case f_k:
CSPELL_function_sig (
fid,
tail->vec[i].content.function_info.param_list,
tail->vec[i].content.function_info.function_def,
encoding_services);
break;
default:
INTERNAL_ERROR("Invalid tail kind");
}
}
开发者ID:HumbleRepose,项目名称:dcerpc,代码行数:31,代码来源:cspell.c
示例14: INTERNAL_ERROR
void NAMETABLE_clear_temp_name_mode
(
void
)
{
NAMETABLE_temp_name_t * This,
* next;
/*
* Bugcheck if not in temporary mode.
*/
if (!NAMETABLE_names_are_temporary)
INTERNAL_ERROR ("Not in temp name mode");
/*
* Walk the list of temp name blocks, freeing the name and then the block.
*/
for (This = NAMETABLE_temp_chain; This != NULL; ) {
NAMETABLE_delete_node (This->node);
next = This->next;
FREE (This);
This = next;
}
/*
* Balance the nametable after all these deletions.
*/
NAMETABLE_balance_tree();
/*
* Clear the temporary flag and the chain head.
*/
NAMETABLE_names_are_temporary = FALSE;
NAMETABLE_temp_chain = NULL;
}
开发者ID:HumbleRepose,项目名称:dcerpc,代码行数:35,代码来源:nametbl.c
示例15: MakeNode
static
DictionaryEntry * MakeNode ( SRA_Statistics * self, ctx_t ctx, const char * path )
{
FUNC_ENTRY ( ctx, rcSRA, rcDatabase, rcAccessing );
size_t path_size = string_size ( path );
DictionaryEntry * node = malloc ( sizeof ( * node ) + path_size );
if ( node == NULL )
{
SYSTEM_ERROR ( xcNoMemory, "allocating dictionary item" );
}
else
{
rc_t rc;
string_copy ( node -> path, path_size + 1, path, path_size );
/*TODO: decide whether to allow overwriting (not allowed now) */
rc = BSTreeInsertUnique ( & self -> dictionary, & node -> dad, NULL, DictionaryEntryCompare );
if ( rc == 0 )
{
return node;
}
INTERNAL_ERROR ( xcUnexpected, "inserting dictionary item '%s' rc = %R", node -> path, rc );
free ( node );
}
return NULL;
}
开发者ID:ncbi,项目名称:ncbi-vdb,代码行数:28,代码来源:SRA_Statistics.c
示例16: handle_flush_cmd
static void handle_flush_cmd(bloom_conn_handler *handle, char *args, int args_len) {
// If we have a specfic filter, use filt_cmd
if (args) {
handle_filt_cmd(handle, args, args_len, filtmgr_flush_filter);
return;
}
// List all the filters
bloom_filter_list_head *head;
int res = filtmgr_list_filters(handle->mgr, NULL, &head);
if (res != 0) {
INTERNAL_ERROR();
return;
}
// Flush all, ignore errors since
// filters might get deleted in the process
bloom_filter_list *node = head->head;
while (node) {
filtmgr_flush_filter(handle->mgr, node->filter_name);
node = node->next;
}
// Respond
handle_client_resp(handle->conn, (char*)DONE_RESP, DONE_RESP_LEN);
// Cleanup
filtmgr_cleanup_list(head);
}
开发者ID:ailove-lab,项目名称:bloomd,代码行数:30,代码来源:conn_handler.c
示例17: permute_dist
long *
permute_dist(distribution *d, long stream)
{
static distribution *dist = NULL;
int i;
if (d != NULL)
{
if (d->permute == (long *)NULL)
{
d->permute = (long *)malloc(sizeof(long) * (DIST_SIZE(d)));
MALLOC_CHECK(d->permute);
for (i=0; i < (DIST_SIZE(d)); i++)
*(d->permute + i) = i;
}
dist = d;
return(permute(dist->permute, DIST_SIZE(dist), stream));
}
if (dist != NULL)
return(permute(NULL, DIST_SIZE(dist), stream));
else
INTERNAL_ERROR("Bad call to permute_dist");
}
开发者ID:YIwama,项目名称:bcb,代码行数:25,代码来源:permute.c
示例18: handle_multi_response
/**
* Helper to handle sending the response to the multi commands,
* either multi or bulk.
* @arg handle The conn handle
* @arg cmd_res The result of the command
* @arg num_keys The number of keys in the result buffer. This should NOT be
* more than MULTI_OP_SIZE.
* @arg res_buf The result buffer
* @arg end_of_input Should the last result include a new line
* @return 0 on success, 1 if we should stop.
*/
static int handle_multi_response(bloom_conn_handler *handle, int cmd_res, int num_keys, char *res_buf, int end_of_input) {
// Do nothing if we get too many keys
if (num_keys > MULTI_OP_SIZE || num_keys <= 0) return 1;
if (cmd_res != 0) {
switch (cmd_res) {
case -1:
handle_client_resp(handle->conn, (char*)FILT_NOT_EXIST, FILT_NOT_EXIST_LEN);
break;
default:
INTERNAL_ERROR();
break;
}
return 1;
}
// Allocate buffers for our response, plus a newline
char *resp_bufs[MULTI_OP_SIZE];
int resp_buf_lens[MULTI_OP_SIZE];
// Set the response buffers according to the results
int last_key = 1;
for (int i=0; i < num_keys; i++) {
last_key = end_of_input && (i == (num_keys - 1));
switch (res_buf[i]) {
case 0:
resp_bufs[i] = (char*)((last_key) ? NO_RESP : NO_SPACE);
resp_buf_lens[i] = (last_key) ? NO_RESP_LEN: NO_SPACE_LEN;
break;
case 1:
resp_bufs[i] = (char*)((last_key) ? YES_RESP : YES_SPACE);
resp_buf_lens[i] = (last_key) ? YES_RESP_LEN: YES_SPACE_LEN;
break;
default:
INTERNAL_ERROR();
return 1;
}
}
// Write out!
send_client_response(handle->conn, (char**)&resp_bufs, (int*)&resp_buf_lens, num_keys);
return 0;
}
开发者ID:ailove-lab,项目名称:bloomd,代码行数:54,代码来源:conn_handler.c
示例19: SRA_StatisticsGetAsDouble
double SRA_StatisticsGetAsDouble ( const SRA_Statistics * self, ctx_t ctx, const char * path )
{
FUNC_ENTRY ( ctx, rcSRA, rcDatabase, rcAccessing );
assert ( self );
if ( path == NULL )
INTERNAL_ERROR ( xcParamNull, "path is NULL" );
else
{
DictionaryEntry * node = ( DictionaryEntry * )
BSTreeFind ( & self -> dictionary, ( const void * ) path, DictionaryEntryFind );
if ( node == NULL )
{
INTERNAL_ERROR ( xcUnexpected, "dictionary item '%s' is not found", path );
}
else
{
switch ( node -> type )
{
case NGS_StatisticValueType_Int64:
return ( double ) node -> value . i64;
case NGS_StatisticValueType_UInt64:
return ( double ) node -> value . u64;
case NGS_StatisticValueType_Real:
return node -> value . real;
case NGS_StatisticValueType_String:
return NGS_StringToReal ( node -> value . str, ctx );
break;
default :
INTERNAL_ERROR ( xcUnexpected, "unexpected type %u for dictionary item '%s'", node -> type, path );
break;
}
}
}
return 0;
}
开发者ID:ncbi,项目名称:ncbi-vdb,代码行数:42,代码来源:SRA_Statistics.c
示例20: NGS_StringSize
/* Size
* retrieve data length
*/
size_t NGS_StringSize ( const NGS_String * self, ctx_t ctx )
{
if ( self == NULL )
{
FUNC_ENTRY ( ctx, rcSRA, rcString, rcAccessing );
INTERNAL_ERROR ( xcSelfNull, "attempt to access NULL NGS_String" );
return 0;
}
return self -> size;
}
开发者ID:ncbi,项目名称:ncbi-vdb,代码行数:14,代码来源:NGS_String.c
注:本文中的INTERNAL_ERROR函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论