本文整理匯總了C++中E_ERROR函數的典型用法代碼示例。如果您正苦於以下問題:C++ E_ERROR函數的具體用法?C++ E_ERROR怎麽用?C++ E_ERROR使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了E_ERROR函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: main
int
main(int argc, char *argv[])
{
lexicon_t *lex;
model_def_t *mdef;
if (initialize(&lex, &mdef,
argc, argv) != S3_SUCCESS) {
E_ERROR("errors initializing.\n");
return 1;
}
if (init_gau(lex, mdef) != S3_SUCCESS) {
return 1;
}
return 0;
}
示例2: sbthread_wait
int
sbthread_wait(sbthread_t *th)
{
void *exit;
int rv;
/* It has already been joined. */
if (th->th == (pthread_t)-1)
return -1;
rv = pthread_join(th->th, &exit);
if (rv != 0) {
E_ERROR("Failed to join thread: %d\n", rv);
return -1;
}
th->th = (pthread_t)-1;
return (int)(long)exit;
}
示例3: sbthread_start
sbthread_t *
sbthread_start(cmd_ln_t *config, sbthread_main func, void *arg)
{
sbthread_t *th;
int rv;
th = ckd_calloc(1, sizeof(*th));
th->config = config;
th->func = func;
th->arg = arg;
th->msgq = sbmsgq_init(1024);
if ((rv = pthread_create(&th->th, NULL, &sbthread_internal_main, th)) != 0) {
E_ERROR("Failed to create thread: %d\n", rv);
sbthread_free(th);
return NULL;
}
return th;
}
示例4: fsg_model_writefile_symtab
void
fsg_model_writefile_symtab(fsg_model_t *fsg, char const *file)
{
FILE *fp;
assert(fsg);
E_INFO("Writing FSM symbol table '%s'\n", file);
if ((fp = fopen(file, "w")) == NULL) {
E_ERROR("Failed to open symbol table '%s' for writing: %s\n", file, strerror(errno));
return;
}
fsg_model_write_symtab(fsg, fp);
fclose(fp);
}
示例5: pj_calloc
PJ *PROJECTION(loxim) {
struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque));
if (0==Q)
return freeup_new (P);
P->opaque = Q;
Q->phi1 = pj_param(P->ctx, P->params, "rlat_1").f;
Q->cosphi1 = cos(Q->phi1);
if (Q->cosphi1 < EPS)
E_ERROR(-22);
Q->tanphi1 = tan(M_FORTPI + 0.5 * Q->phi1);
P->inv = s_inverse;
P->fwd = s_forward;
P->es = 0.;
return P;
}
示例6: sbthread_wait
int
sbthread_wait(sbthread_t *th)
{
DWORD rv, exit;
/* It has already been joined. */
if (th->th == NULL)
return -1;
rv = WaitForSingleObject(th->th, INFINITE);
if (rv == WAIT_FAILED) {
E_ERROR("Failed to join thread: WAIT_FAILED\n");
return -1;
}
GetExitCodeThread(th->th, &exit);
CloseHandle(th->th);
th->th = NULL;
return (int)exit;
}
示例7: priority_queue_add
void priority_queue_add(priority_queue_t *queue, void *element)
{
size_t i;
if (queue->size == queue->alloc_size) {
E_ERROR("Trying to add element into full queue\n");
return;
}
for (i = 0; i < queue->alloc_size; i++) {
if (queue->pointers[i] == NULL) {
queue->pointers[i] = element;
break;
}
}
if (queue->max_element == NULL || queue->compare(element, queue->max_element) < 0) {
queue->max_element = element;
}
queue->size++;
}
示例8: dict_add_g2p_word
int
dict_add_g2p_word(dict_t * dict, char const *word)
{
int32 wid = 0;
s3cipid_t *pron;
char **phonestr, *tmp;
int np, i;
char *phones;
phones = dict_g2p(word, dict->ngram_g2p_model);
if (phones == NULL)
return 0;
E_INFO("Adding phone %s for word %s \n", phones, word);
tmp = ckd_salloc(phones);
np = str2words(tmp, NULL, 0);
phonestr = ckd_calloc(np, sizeof(*phonestr));
str2words(tmp, phonestr, np);
pron = ckd_calloc(np, sizeof(*pron));
for (i = 0; i < np; ++i) {
pron[i] = bin_mdef_ciphone_id(dict->mdef, phonestr[i]);
if (pron[i] == -1) {
E_ERROR("Unknown phone %s in phone string %s\n",
phonestr[i], tmp);
ckd_free(phonestr);
ckd_free(tmp);
ckd_free(pron);
ckd_free(phones);
return -1;
}
}
ckd_free(phonestr);
ckd_free(tmp);
ckd_free(phones);
if ((wid = dict_add_word(dict, word, pron, np)) == -1) {
ckd_free(pron);
return -1;
}
ckd_free(pron);
return wid;
}
示例9: sbevent_init
sbevent_t *
sbevent_init(void)
{
sbevent_t *evt;
int rv;
evt = ckd_calloc(1, sizeof(*evt));
if ((rv = pthread_mutex_init(&evt->mtx, NULL)) != 0) {
E_ERROR("Failed to initialize mutex: %d\n", rv);
ckd_free(evt);
return NULL;
}
if ((rv = pthread_cond_init(&evt->cond, NULL)) != 0) {
E_ERROR_SYSTEM("Failed to initialize mutex: %d\n", rv);
pthread_mutex_destroy(&evt->mtx);
ckd_free(evt);
return NULL;
}
return evt;
}
示例10: calc_feat_idx
static int
calc_feat_idx(acmod_t *acmod, int frame_idx)
{
int n_backfr, feat_idx;
n_backfr = acmod->n_feat_alloc - acmod->n_feat_frame;
if (frame_idx < 0 || acmod->output_frame - frame_idx > n_backfr) {
E_ERROR("Frame %d outside queue of %d frames, %d alloc (%d > %d), cannot score\n",
frame_idx, acmod->n_feat_frame, acmod->n_feat_alloc,
acmod->output_frame - frame_idx, n_backfr);
return -1;
}
/* Get the index in feat_buf/framepos of the frame to be scored. */
feat_idx = ((acmod->feat_outidx + frame_idx - acmod->output_frame)
% acmod->n_feat_alloc);
if (feat_idx < 0) feat_idx += acmod->n_feat_alloc;
return feat_idx;
}
示例11: _blkarray_list_init
blkarray_list_t *
_blkarray_list_init(int32 maxblks, int32 blksize)
{
blkarray_list_t *bl;
if ((maxblks <= 0) || (blksize <= 0)) {
E_ERROR("Cannot allocate %dx%d blkarray\n", maxblks, blksize);
return NULL;
}
bl = (blkarray_list_t *) ckd_calloc(1, sizeof(blkarray_list_t));
bl->ptr = (void ***) ckd_calloc(maxblks, sizeof(void **));
bl->maxblks = maxblks;
bl->blksize = blksize;
bl->n_valid = 0;
bl->cur_row = -1; /* No row is allocated (dummy) */
bl->cur_row_free = blksize; /* The dummy row is full */
return bl;
}
示例12: ngram2wid
/**
* Map the given ngram string to an array of word IDs of the individual
* words in the ngram.
*
* args:
* ngram - the ngram string to map
* length - the length of the ngram string
* w - the word ID array
* lm - the language model to use
*
* returns:
* the number of words in the ngram string, or 0 if the string contains an
* unknown word
*/
int
ngram2wid(char *ngram, int length, s3lmwid32_t * w, lm_t * lm)
{
char *word[1024];
int nwd;
int i;
if ((nwd = str2words(ngram, word, length)) < 0)
E_FATAL("Increase word[] and w[] arrays size\n");
for (i = 0; i < nwd; i++) {
w[i] = lm_wid(lm, word[i]);
if (NOT_LMWID(lm, w[i])) {
E_ERROR("Unknown word: %s\n", word[i]);
return 0;
}
}
return nwd;
}
示例13: utt_decode_block
void
utt_decode_block(float ***block_feat, /* Incoming block of featurevecs */
int32 no_frm, /* No. of vecs in cepblock */
int32 * curfrm, /* Utterance level index of
frames decoded so far */
kb_t * kb /* kb structure with all model
and decoder info */
)
{
srch_t *s;
s = (srch_t *) kb->srch;
/* These are necessary! */
s->uttid = kb->uttid;
s->uttfile = kb->uttfile;
if (srch_utt_decode_blk(s, block_feat, no_frm, curfrm) == SRCH_FAILURE) {
E_ERROR("srch_utt_decode_blk failed. \n");
}
}
示例14: acmod_rewind
int
acmod_rewind(acmod_t *acmod)
{
/* If the feature buffer is circular, this is not possible. */
if (acmod->output_frame > acmod->n_feat_alloc) {
E_ERROR("Circular feature buffer cannot be rewound (output frame %d, "
"alloc %d)\n", acmod->output_frame, acmod->n_feat_alloc);
return -1;
}
/* Frames consumed + frames available */
acmod->n_feat_frame = acmod->output_frame + acmod->n_feat_frame;
/* Reset output pointers. */
acmod->feat_outidx = 0;
acmod->output_frame = 0;
acmod->senscr_frame = -1;
acmod->mgau->frame_idx = 0;
return 0;
}
示例15: cep_write_bin
int32 cep_write_bin(char const *file, float32 *buf, int32 len)
{
int32 fd;
#ifdef WIN32
fd = open(file, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0644);
#else
fd = open(file, O_WRONLY|O_CREAT|O_TRUNC, 0644);
#endif
if (fd < 0) {
E_ERROR("Couldn't open %s for writing\n", file);
return errno;
}
len *= sizeof(float32);
if (write(fd, (char *)&len, sizeof(int32)) != sizeof(int32)) return -1;
if (write(fd, (char *)buf, len) != len) return -1;
if (close(fd) != ESUCCESS) return -1;
return ESUCCESS;
}