您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ utarray_new函数代码示例

51自学网 2021-06-03 09:23:49
  C++
这篇教程C++ utarray_new函数代码示例写得很实用,希望能帮到您。

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

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

示例1: fcitx_utils_split_string

FCITX_EXPORT_APIUT_array* fcitx_utils_split_string(const char* str, char delm){    UT_array* array;    char delm_s[2] = {delm, '/0'};    utarray_new(array, fcitx_str_icd);    return fcitx_utils_append_split_string(array, str, delm_s);}
开发者ID:ascetic85,项目名称:fcitx,代码行数:8,


示例2: LoadQuickPhrase

/** * 加载快速输入词典 * @param void * @return void * @note 快速输入是在;的行为定义为2,并且输入;以后才可以使用的。 * 加载快速输入词典.如:输入“zg”就直接出现“中华人民共和国”等等。 * 文件中每一行数据的定义为:<字符组合> <短语> * 如:“zg 中华人民共和国” */void LoadQuickPhrase(QuickPhraseState * qpstate){    FILE *fp;    char *buf = NULL;    size_t len = 0;    char *buf1 = NULL;    QUICK_PHRASE tempQuickPhrase;    qpstate->uQuickPhraseCount = 0;    fp =  FcitxXDGGetFileWithPrefix("data", "QuickPhrase.mb", "r", NULL);    if (!fp)        return;    // 这儿的处理比较简单。因为是单索引对单值。    // 应该注意的是,它在内存中是以单链表保存的。    utarray_new(qpstate->quickPhrases, &qp_icd);    while (getline(&buf, &len, fp) != -1) {        if (buf1)            free(buf1);        buf1 = fcitx_utils_trim(buf);        char *p = buf1;        while (*p && !isspace(*p))            p ++;        if (*p == '/0')            continue;        while (isspace(*p)) {            *p = '/0';            p ++;        }        if (strlen(buf1) >= QUICKPHRASE_CODE_LEN)            continue;        if (strlen(p) >= QUICKPHRASE_PHRASE_LEN * UTF8_MAX_LENGTH)            continue;        strcpy(tempQuickPhrase.strCode, buf1);        strcpy(tempQuickPhrase.strPhrase, p);        utarray_push_back(qpstate->quickPhrases, &tempQuickPhrase);    }    if (buf)        free(buf);    if (buf1)        free(buf1);    if (qpstate->quickPhrases) {        utarray_sort(qpstate->quickPhrases, PhraseCmp);    }    fclose(fp);}
开发者ID:niubenben,项目名称:fcitx,代码行数:67,


示例3: layout

int layout(char *buf, size_t sz, char **obuf, size_t *osz) {  UT_array *namev,*hashv, *xv, *yv;  int i, pos, rc=-1, x, y;  unsigned char *s;  unsigned h;  utarray_new(namev, &ut_str_icd);  utarray_new(hashv, &ut_int_icd);  utarray_new(xv, &ut_int_icd);  utarray_new(yv, &ut_int_icd);  tpl_node *tn = tpl_map("A(s)", &s);  if (tpl_load(tn, TPL_MEM, buf, sz)) goto done;  while (tpl_unpack(tn,1) > 0) {    h = get_hash(s);    utarray_push_back(namev, &s);    utarray_push_back(hashv, &h);    free(s);  }  tpl_free(tn);  for(pos=0; pos < utarray_len(namev); pos++) {    place(pos,hashv,xv,yv);  }  /* every item has a place. prepare output. */  tn = tpl_map("A(sii)", &s, &x, &y);  for(i=0; i < utarray_len(namev); i++) {    s = *(unsigned char**)utarray_eltptr(namev,i);    x =            *(int*)utarray_eltptr(xv,i);    y =            *(int*)utarray_eltptr(yv,i);    tpl_pack(tn,1);  }  tpl_dump(tn, TPL_MEM, obuf, osz);  tpl_free(tn);  rc = 0; done:  utarray_free(namev);  utarray_free(hashv);  utarray_free(xv);  utarray_free(yv);  return rc;}
开发者ID:hotfics,项目名称:misc,代码行数:45,


示例4: MPIR_T_cvar_env_init

static inline void MPIR_T_cvar_env_init(void){    static const UT_icd cvar_table_entry_icd =                    {sizeof(cvar_table_entry_t), NULL, NULL, NULL};    utarray_new(cvar_table, &cvar_table_entry_icd);    cvar_hash = NULL;    MPIR_T_cvar_init();}
开发者ID:adevress,项目名称:MPICH-BlueGene,代码行数:9,


示例5: make_cfg

/* Constructs a new CFG.   Must be called once for every function.  */static struct control_flow_graph*make_cfg (void){  struct control_flow_graph* cfg = (struct control_flow_graph*)      malloc (sizeof (struct control_flow_graph));  memset (cfg, 0, sizeof (struct control_flow_graph));  utarray_new (cfg->edge_list, &edge_icd_dtor);  return cfg;}
开发者ID:zayac,项目名称:eq,代码行数:11,


示例6: book_add_help_history

/** * Enable book help history. */void book_add_help_history(const char *name){    if (!book_help_history_enabled) {        book_help_history_enabled = 1;        utarray_new(book_help_history, &ut_str_icd);    }    utarray_push_back(book_help_history, &name);}
开发者ID:liwcezar,项目名称:atrinik,代码行数:12,


示例7: tnn_module_init_sum

tnn_error tnn_module_init_sum(tnn_module *m, tnn_state *input, tnn_state *output, tnn_param *io){  tnn_error ret;  tnn_module_sum *c;  size_t i;  UT_icd sarray_icd = {sizeof(tnn_state*), NULL, NULL, NULL};  tnn_state *t;  //Check the sizes and validness  if(input->size % output->size != 0){    return TNN_ERROR_STATE_INCOMP;  }  if(input->valid != true){    return TNN_ERROR_STATE_INVALID;  }  //Defined type  m->t = TNN_MODULE_TYPE_SUM;  //Constant parameter is a new tnn_module_sum  c = (tnn_module_sum *)malloc(sizeof(tnn_module_sum));  m->c = c;  //Allocate sub-states  utarray_new(c->sarray, &sarray_icd);  if(c->sarray == NULL){    TNN_ERROR_ALLOC;  }  for(i = 0; i < input->size; i = i + output->size){    //Alloc and initialize the state    t = (tnn_state *)malloc(sizeof(tnn_state));    if(t == NULL){      return TNN_ERROR_ALLOC;    }    t->size = output->size;    //Get the substate and store it    TNN_MACRO_ERRORTEST(tnn_param_state_sub(io, input, t, i), ret);    utarray_push_back(c->sarray, &t);  }  //Init the state  tnn_state_init(&m->w, 0L);  //Link the inputs and outputs  m->input = input;  m->output = output;  //Store the functions  m->bprop = &tnn_module_bprop_sum;  m->fprop = &tnn_module_fprop_sum;  m->randomize = &tnn_module_randomize_sum;  m->destroy = &tnn_module_destroy_sum;  m->clone = &tnn_module_clone_sum;  m->debug = &tnn_module_debug_sum;    return TNN_ERROR_SUCCESS;}
开发者ID:Darengb,项目名称:Thunder-Neural-Networks,代码行数:57,


示例8: MPIR_T_cat_env_init

static inline void MPIR_T_cat_env_init(void){    static const UT_icd cat_table_entry_icd =                    {sizeof(cat_table_entry_t), NULL, NULL, NULL};    utarray_new(cat_table, &cat_table_entry_icd);    cat_hash = NULL;    cat_stamp = 0;}
开发者ID:adevress,项目名称:MPICH-BlueGene,代码行数:9,


示例9: strlen

UT_array *qgram_tokenize_to_utarray(const char *str, const qgram_t *qtype) {	int i;	int init_len = strlen(str) + 1;	char *tmp;	//Mem corruption will occur otherwise...	if(qtype->qgram_len < 1 || qtype->qgram_len > 3)		return NULL;	if(qtype->extended) {		tmp = calloc((init_len + qtype->qgram_len), sizeof(char));		for(i = 0; i < (qtype->qgram_len - 1); i++)			strcat(tmp, QGRAM_SP);		strcat(tmp, str);		for(i = 0; i < (qtype->qgram_len - 1); i++)			strcat(tmp, QGRAM_EP);	} else {		tmp = calloc(init_len, sizeof(char));		strcpy(tmp, str);	}	UT_array *strs;	utarray_new(strs, &ut_str_icd);	int cp = 0;	int len = strlen(tmp) - qtype->qgram_len + 1;	char *t_ptr, *el;	while(cp < len) {		t_ptr = (char *)&tmp[cp];		//Allocate all chars - plus terminator...		el = calloc((qtype->qgram_len + 1), sizeof(char));		//Copy bytes safely - strncpy should append the /0		strncpy(el, t_ptr, (sizeof(char) * qtype->qgram_len));		utarray_push_back(strs, &el);		free(el);		cp++;	}	free(tmp);	return (strs);}
开发者ID:aperi2007,项目名称:libsimmetrics,代码行数:56,


示例10: list_new

static Token list_new(Cmdline *cmdline){  Token token = {0};  List *l = malloc(sizeof(List));  ref_push(&cmdline->refs, l, VAR_LIST);  token.var.v_type = VAR_LIST;  utarray_new(l->items, &list_icd);  token.var.vval.v_list = l;  return token;}
开发者ID:jollywho,项目名称:nav,代码行数:10,


示例11: dicom_import

void dicom_import(const char *dirpath){    DIR *dir;    struct dirent *dirent;    dicom_t dicom, *dptr;    static UT_icd dicom_icd = {sizeof(dicom_t), NULL, NULL, NULL};    UT_array *all_files;    int w, h, d;    // Dimensions of the full data cube.    int i;    uint16_t *data;    uvec4b_t *cube;    // First we parse all the dicom images into a sorted array.    // XXX: how to propery iter a directory?    utarray_new(all_files, &dicom_icd);    dir = opendir(dirpath);    while ((dirent = readdir(dir))) {        if (dirent->d_name[0] == '.') continue;        asprintf(&dicom.path, "%s/%s", dirpath, dirent->d_name);        dicom_load(dicom.path, &dicom, NULL, 0);        CHECK(dicom.rows && dicom.columns);        utarray_push_back(all_files, &dicom);    }    closedir(dir);    utarray_sort(all_files, dicom_sort);    // Read all the file data one by one into the data cube.    w = dicom.columns;    h = dicom.rows;    d = utarray_len(all_files);    data = calloc(w * h * d, 2);    dptr = NULL;    while( (dptr = (dicom_t*)utarray_next(all_files, dptr))) {        i = utarray_eltidx(all_files, dptr);        dicom_load(dptr->path, &dicom,                   (char*)&data[w * h * i], w * h * 2);        free(dptr->path);    }    utarray_free(all_files);    // Generate 4 * 8bit RGBA values.    // XXX: we should maybe support voxel data in 2 bytes monochrome.    cube = malloc(w * h * d * sizeof(*cube));    for (i = 0; i < w * h * d; i++) {        cube[i] = uvec4b(255, 255, 255, clamp(data[i], 0, 255));    }    free(data);    // This could belong to the caller function.    mesh_blit(goxel()->image->active_layer->mesh, cube,              -w / 2, -h / 2, -d / 2, w, h, d);    free(cube);}
开发者ID:MyOwnClone,项目名称:goxel,代码行数:55,


示例12: tnn_module_clone_sum

tnn_error tnn_module_clone_sum(tnn_module *m1, tnn_module *m2, tnn_param *p, tnn_pstable *t){  tnn_error ret;  tnn_module_sum *c;  tnn_state *s1, *s2, **s;  UT_icd sarray_icd = {sizeof(tnn_state*), NULL, NULL, NULL};  size_t i;  //Routine check  if(m1->t != TNN_MODULE_TYPE_SUM){    return TNN_ERROR_MODULE_MISTYPE;  }  //Retrieve input and output  TNN_MACRO_ERRORTEST(tnn_pstable_find(t, m1->input, &m2->input), ret);  TNN_MACRO_ERRORTEST(tnn_pstable_find(t, m1->output, &m2->output), ret);  if(m1->input->size != m2->input->size || m1->output->size != m2->output->size){    return TNN_ERROR_STATE_INCOMP;  }  //Defined type  m2->t = TNN_MODULE_TYPE_SUM;  //Constant paramter is a new tnn_module_sum  c = (void*)malloc(sizeof(tnn_module_sum));  m2->c = c;  //Allocate the state  tnn_state_init(&m2->w, 0L);    //Find the sub states  utarray_new(c->sarray, &sarray_icd);  for(i = 0; i < utarray_len(((tnn_module_sum*)m1->c)->sarray); i = i + 1){    s2 = (tnn_state *) malloc(sizeof(tnn_state));    if(s2 == NULL){      return TNN_ERROR_ALLOC;    }    s = (tnn_state **)utarray_eltptr(((tnn_module_sum*)m1->c)->sarray, i);    s1 = *s;    TNN_MACRO_ERRORTEST(tnn_pstable_find(t, s1, &s2), ret);    if (s1->size != s2->size){      return TNN_ERROR_STATE_INCOMP;    }    utarray_push_back(c->sarray, &s2);  }  //Store the functions  m2->bprop = &tnn_module_bprop_sum;  m2->fprop = &tnn_module_fprop_sum;  m2->randomize = &tnn_module_randomize_sum;  m2->destroy = &tnn_module_destroy_sum;  m2->debug = &tnn_module_debug_sum;  m2->clone = &tnn_module_clone_sum;  return TNN_ERROR_SUCCESS;}
开发者ID:Darengb,项目名称:Thunder-Neural-Networks,代码行数:55,


示例13: DEFINE_init_module

/*-----------------------------------------------------------------------------*   Init functions*----------------------------------------------------------------------------*/DEFINE_init_module(){	input_buf = str_new(STR_SIZE);	p = str_data(input_buf);	input_stack	 = OBJ_NEW(List);	input_stack->free_data = m_free_compat;	init_sym();	utarray_new(scan_state, &ut_scan_state_icd);}
开发者ID:bitfixer,项目名称:bitfixer,代码行数:14,


示例14: compl_new

void compl_new(int size, int dynamic){  log_msg("COMPL", "compl_new");  compl_destroy(cur_cx);  cur_cx->cmpl = malloc(sizeof(fn_compl));  cur_cx->cmpl->rows    = malloc(size*sizeof(compl_item));  utarray_new(cur_cx->cmpl->matches, &icd);  cur_cx->cmpl->rowcount = size;  cur_cx->cmpl->matchcount = 0;  cur_cx->cmpl->comp_type = dynamic;}
开发者ID:Hummer12007,项目名称:nav,代码行数:11,


示例15: Yap_udi_init

/* * Init Yap udi interface */voidYap_udi_init(void){  UdiControlBlocks = NULL;  /*init indexing structures array*/  utarray_new(indexing_structures, &udicb_icd);  Yap_InitCPred("$udi_init", 1, p_new_udi, 0);  /* TODO: decide if udi.yap should be loaded automaticaly in init.yap */}
开发者ID:jfmc,项目名称:yap-6.3,代码行数:14,


示例16: MPIR_T_pvar_env_init

static inline void MPIR_T_pvar_env_init(void){    int i;    static const UT_icd pvar_table_entry_icd =                    {sizeof(pvar_table_entry_t), NULL, NULL, NULL};    utarray_new(pvar_table, &pvar_table_entry_icd);    for (i = 0; i < MPIR_T_PVAR_CLASS_NUMBER; i++) {        pvar_hashs[i] = NULL;    }}
开发者ID:adevress,项目名称:MPICH-BlueGene,代码行数:11,


示例17: zway_location_add_device

void zway_location_add_device(zway_location_ptr location, zway_device_ptr device) {    if (!device) {        return;    }        if (!location->devices) {        utarray_new(location->devices, &zway_device_ut_icd);    }        utarray_push_back(location->devices, device);}
开发者ID:sionyx,项目名称:pebble_zway_time,代码行数:11,


示例18: tsk_find_haddr_by_filename

// Find all the harddisk address corresponding to target file// // /param img_path          path of target image// /param file_path         the target filename// // Return NULL if error, otherwise a UT_array of (start, end) tuple will returned, where start and end are the harddisk byte addrsessesUT_array* tsk_find_haddr_by_filename(const char* img_path, const char* file_path){    TSK_IMG_TYPE_ENUM img_type ;    TSK_IMG_INFO *img;    TSK_VS_INFO *vs;     find_file_data data;    UT_array* ret = NULL;    img_type = tsk_img_type_toid(QCOW_IMG_TYPE);    //XXX([email
C++ utarray_next函数代码示例
C++ utarray_front函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。