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

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

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

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

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

示例1: features_index_add_single

static voidfeatures_index_add_single(const char* str, size_t len, VALUE offset){    struct st_table *features_index;    VALUE this_feature_index = Qnil;    st_data_t short_feature_key;    Check_Type(offset, T_FIXNUM);    short_feature_key = feature_key(str, len);    features_index = get_loaded_features_index_raw();    st_lookup(features_index, short_feature_key, (st_data_t *)&this_feature_index);    if (NIL_P(this_feature_index)) {	st_insert(features_index, short_feature_key, (st_data_t)offset);    }    else if (RB_TYPE_P(this_feature_index, T_FIXNUM)) {	VALUE feature_indexes[2];	feature_indexes[0] = this_feature_index;	feature_indexes[1] = offset;	this_feature_index = (VALUE)xcalloc(1, sizeof(struct RArray));	RBASIC(this_feature_index)->flags = T_ARRAY; /* fake VALUE, do not mark/sweep */	rb_ary_cat(this_feature_index, feature_indexes, numberof(feature_indexes));	st_insert(features_index, short_feature_key, (st_data_t)this_feature_index);    }    else {	Check_Type(this_feature_index, T_ARRAY);	rb_ary_push(this_feature_index, offset);    }}
开发者ID:tenderlove,项目名称:ruby,代码行数:30,


示例2: avro_schema_record_field_append

intavro_schema_record_field_append(const avro_schema_t record_schema,				const char *field_name,				const avro_schema_t field_schema){	check_param(EINVAL, is_avro_schema(record_schema), "record schema");	check_param(EINVAL, is_avro_record(record_schema), "record schema");	check_param(EINVAL, field_name, "field name");	check_param(EINVAL, is_avro_schema(field_schema), "field schema");	if (!is_avro_id(field_name)) {		avro_set_error("Invalid Avro identifier");		return EINVAL;	}	if (record_schema == field_schema) {		avro_set_error("Cannot create a circular schema");		return EINVAL;	}	struct avro_record_schema_t *record = avro_schema_to_record(record_schema);	struct avro_record_field_t *new_field = (struct avro_record_field_t *) avro_new(struct avro_record_field_t);	if (!new_field) {		avro_set_error("Cannot allocate new record field");		return ENOMEM;	}	new_field->index = record->fields->num_entries;	new_field->name = avro_strdup(field_name);	new_field->type = avro_schema_incref(field_schema);	st_insert(record->fields, record->fields->num_entries,		  (st_data_t) new_field);	st_insert(record->fields_byname, (st_data_t) new_field->name,		  (st_data_t) new_field);	return 0;}
开发者ID:AlexChen12,项目名称:avro,代码行数:35,


示例3: initSymTab

void initSymTab(void){	st_insert("integer", "integer", -1, -1);	st_insert("boolean", "boolean", -1, -1);	st_insert("string", "string", -1, -1);	st_insert("real", "real", -1, -1);}
开发者ID:Frank-Shaw,项目名称:Pascal-to-MIPS-Compiler,代码行数:7,


示例4: features_index_add_single

static voidfeatures_index_add_single(VALUE short_feature, VALUE offset){    struct st_table *features_index;    VALUE this_feature_index = Qnil;    char *short_feature_cstr;    Check_Type(offset, T_FIXNUM);    Check_Type(short_feature, T_STRING);    short_feature_cstr = StringValueCStr(short_feature);    features_index = get_loaded_features_index_raw();    st_lookup(features_index, (st_data_t)short_feature_cstr, (st_data_t *)&this_feature_index);    if (NIL_P(this_feature_index)) {	st_insert(features_index, (st_data_t)ruby_strdup(short_feature_cstr), (st_data_t)offset);    }    else if (RB_TYPE_P(this_feature_index, T_FIXNUM)) {	VALUE feature_indexes[2];	feature_indexes[0] = this_feature_index;	feature_indexes[1] = offset;	this_feature_index = (VALUE)xcalloc(1, sizeof(struct RArray));	RBASIC(this_feature_index)->flags = T_ARRAY; /* fake VALUE, do not mark/sweep */	rb_ary_cat(this_feature_index, feature_indexes, numberof(feature_indexes));	st_insert(features_index, (st_data_t)short_feature_cstr, (st_data_t)this_feature_index);    }    else {	Check_Type(this_feature_index, T_ARRAY);	rb_ary_push(this_feature_index, offset);    }}
开发者ID:scorpion007,项目名称:ruby,代码行数:31,


示例5: load_lock

static char *load_lock(const char *ftptr){    st_data_t data;    st_table *loading_tbl = get_loading_table();    if (!st_lookup(loading_tbl, (st_data_t)ftptr, &data)) {	/* partial state */	ftptr = ruby_strdup(ftptr);	data = (st_data_t)rb_thread_shield_new();	st_insert(loading_tbl, (st_data_t)ftptr, data);	return (char *)ftptr;    }    else if (RB_TYPE_P((VALUE)data, T_IMEMO) && imemo_type((VALUE)data) == imemo_memo) {	struct MEMO *memo = MEMO_CAST(data);	void (*init)(void) = (void (*)(void))memo->u3.func;	data = (st_data_t)rb_thread_shield_new();	st_insert(loading_tbl, (st_data_t)ftptr, data);	(*init)();	return (char *)"";    }    if (RTEST(ruby_verbose)) {	rb_warning("loading in progress, circular require considered harmful - %s", ftptr);	rb_backtrace_print_to(rb_stderr);    }    switch (rb_thread_shield_wait((VALUE)data)) {      case Qfalse:	data = (st_data_t)ftptr;	st_insert(loading_tbl, data, (st_data_t)rb_thread_shield_new());	return 0;      case Qnil:	return 0;    }    return (char *)ftptr;}
开发者ID:scorpion007,项目名称:ruby,代码行数:35,


示例6: insertNode

/* Procedure insertNode inserts  * identifiers stored in t into  * the symbol table  */static void insertNode( TreeNode * t){ switch (t->nodekind)    {    case ExpK:      switch (t->kind.exp)	{ case IdK:	    if (st_lookup(t->attr.name) == -1)	      printf("Id wasn't declared./n");	    else	      st_insert(t, 0, 0);	    break;	default:	  break;	}      break;    case DeclK:      if (t->array_size >= 0) { // if variable is not void	if (st_advanced_lookup(t->attr.name, t->scope) == -1) {	  st_insert(t, location++, 1);	} else {	  printf("Declation Error %s/n",t->attr.name); location--;	}      }      break;    default:      break;    }}
开发者ID:JaneJung,项目名称:cminus,代码行数:32,


示例7: avro_memoize_set

voidavro_memoize_set(avro_memoize_t *mem,		 void *key1, void *key2,		 void *result){	/*	 * First see if there's already a cached value for this key.  If	 * so, we don't want to allocate a new avro_memoize_key_t	 * instance.	 */	avro_memoize_key_t  key;	key.key1 = key1;	key.key2 = key2;	union {		st_data_t  data;		void  *value;	} val;	if (st_lookup(mem->cache, (st_data_t) &key, &val.data)) {		st_insert(mem->cache, (st_data_t) &key, (st_data_t) result);		return;	}	/*	 * If it's a new key pair, then we do need to allocate.	 */	avro_memoize_key_t  *real_key = avro_new(avro_memoize_key_t);	real_key->key1 = key1;	real_key->key2 = key2;	st_insert(mem->cache, (st_data_t) real_key, (st_data_t) result);}
开发者ID:Adimpression,项目名称:avro-mobile,代码行数:35,


示例8: st_spec_st_foreach

VALUE st_spec_st_foreach(VALUE self) {  int total = 0;  st_table *tbl = st_init_numtable_with_size(128);  st_insert(tbl, 1, 3);  st_insert(tbl, 2, 4);  st_foreach(tbl, sum, (st_data_t)&total);  st_free_table(tbl);  return INT2FIX(total);}
开发者ID:MSNexploder,项目名称:jruby,代码行数:9,


示例9: st_spec_st_lookup

VALUE st_spec_st_lookup(VALUE self) {  st_data_t result = (st_data_t)0;  st_table *tbl = st_init_numtable_with_size(128);  st_insert(tbl, 7, 42);  st_insert(tbl, 2, 4);  st_lookup(tbl, (st_data_t)7, &result);  st_free_table(tbl);#if SIZEOF_LONG == SIZEOF_VOIDP  return ULONG2NUM(result);#else  return ULL2NUM(result);#endif}
开发者ID:MSNexploder,项目名称:jruby,代码行数:13,


示例10: NODE

NODE(sl_node_def_t, def){    sl_vm_insn_t insn;    sl_compile_state_t sub_cs;    size_t i, on_reg;    init_compile_state(&sub_cs, cs->vm, cs, node->req_arg_count + node->opt_arg_count + 1);    for(i = 0; i < node->req_arg_count; i++) {        st_insert(sub_cs.vars, (st_data_t)node->req_args[i], (st_data_t)(i + 1));    }    for(i = 0; i < node->opt_arg_count; i++) {        st_insert(sub_cs.vars, (st_data_t)node->opt_args[i].name, (st_data_t)(node->req_arg_count + i + 1));    }    sub_cs.section->name = node->name;    sub_cs.section->req_registers = node->req_arg_count;    sub_cs.section->arg_registers = node->req_arg_count + node->opt_arg_count;    sub_cs.section->opt_skip = sl_alloc(cs->vm->arena, sizeof(size_t) * (node->opt_arg_count + 1));        for(i = 0; i < node->opt_arg_count; i++) {        sub_cs.section->opt_skip[i] = sub_cs.section->insns_count;        compile_node(&sub_cs, node->opt_args[i].default_value, node->req_arg_count + i + 1);    }    sub_cs.section->opt_skip[node->opt_arg_count] = sub_cs.section->insns_count;        compile_node(&sub_cs, node->body, 0);    insn.opcode = SL_OP_RETURN;    emit(&sub_cs, insn);    insn.uint = 0;    emit(&sub_cs, insn);        if(node->on) {        on_reg = reg_alloc(cs);        compile_node(cs, node->on, on_reg);        insn.opcode = SL_OP_DEFINE_ON;        emit(cs, insn);        insn.uint = on_reg;        emit(cs, insn);        reg_free(cs, on_reg);    } else {        insn.opcode = SL_OP_DEFINE;        emit(cs, insn);    }    insn.imm = node->name;    emit(cs, insn);    insn.section = sub_cs.section;    emit(cs, insn);    insn.uint = dest;    emit(cs, insn);}
开发者ID:tinkertim,项目名称:slash,代码行数:48,


示例11: _reverse_merge_func

static int _reverse_merge_func(VALUE k, VALUE v, VALUE self_st) {  st_table* t = (st_table*)self_st;  if (!st_is_member(t, k)) {    st_insert(t, (st_data_t)k, (st_data_t)v);  }  return ST_CONTINUE;}
开发者ID:fsword,项目名称:nyara,代码行数:7,


示例12: main

int main(void){    size_t max = 100;    size_t n = 20;    char buf[strsiz];    size_t i;    st_t st = st_init(max);    for (i = 0; i < n; i++) {        item_t t = newitem(randkey(), randstr(buf, strsiz));        st_insert(st, t);    }    st_sort(st, print);    printf("/nThe item with key 11 is: ");    print(st_search(st, 11));    printf("/nThe 4th smallest key is: ");    print(st_select(st, 4));    st_delete(st, st_search(st, 11));    printf("/n delete the item with key 11./n");    st_sort(st, print);    /* delete all item */    while (!st_empty(st)) {        item_t x = st_select(st, 0);        printf("delete item: ");        print(x);        st_delete(st, st_select(st, 0));    }    st_finalize(&st);    return 0;}
开发者ID:algking,项目名称:algorithms-in-c,代码行数:33,


示例13: clone_method

static intclone_method(ID mid, NODE *body, VALUE nklass){    NODE *fbody = body->nd_body;    if (fbody) {	VALUE nbody;	switch (nd_type(fbody)) {	  case NODE_SCOPE:	    fbody = rb_copy_node_scope(fbody, ruby_cref);    	    break;	  case NODE_BMETHOD:	    nbody = rb_block_dup(fbody->nd_cval, nklass, (VALUE)ruby_cref);	    fbody = NEW_BMETHOD(nbody);	    break;	  case NODE_DMETHOD:	    nbody = rb_method_dup(fbody->nd_cval, nklass, (VALUE)ruby_cref);	    fbody = NEW_DMETHOD(nbody);	    break;	}    }    st_insert(RCLASS(nklass)->m_tbl, mid, (st_data_t)NEW_METHOD(fbody, body->nd_noex));    return ST_CONTINUE;}
开发者ID:asimoov,项目名称:emscripted-ruby,代码行数:25,


示例14: checkMinterms

/**Function********************************************************************  Synopsis    [Check that minterm counts have not changed.]  Description [Counts the minterms in the global functions of the  primary outputs of the network passed as argument.  When it is calld with the second argument set to NULL, it allocates  a symbol table and stores, for each output, the minterm count. If  an output does not have a BDD, it stores a NULL pointer for it.  If it is called with a non-null second argument, it assumes that  the symbol table contains the minterm counts measured previously  and it compares the new counts to the old ones. Finally, it frees  the symbol table.  check_minterms is designed so that it can be called twice: once before  reordering, and once after reordering.  Returns a pointer to the symbol table on the first invocation and NULL  on the second invocation.]  SideEffects [None]  SeeAlso     []******************************************************************************/st_table *checkMinterms(  BnetNetwork * net,  DdManager * dd,  st_table * previous){    BnetNode *po;    int numPi;    char *name;    double *count, newcount, *oldcount;    int flag,err,i;    numPi = net->ninputs;    if (previous == NULL) {	previous = st_init_table(strcmp,st_strhash);	if (previous == NULL) {	    (void) printf("checkMinterms out-of-memory/n");	    return(NULL);	}	for (i = 0; i < net->noutputs; i++) {	    if (!st_lookup(net->hash,net->outputs[i],&po)) {		exit(2);	    }	    name = net->outputs[i];	    if (po->dd != NULL) {		count = ALLOC(double,1);		*count = Cudd_CountMinterm(dd,po->dd,numPi);		err = st_insert(previous, name, (char *) count);	    } else {
开发者ID:AndrewSmart,项目名称:CS5600,代码行数:53,


示例15: create_symbol_table

symbol_table * create_symbol_table(){	char * lib_functions[] = {					"print","input","objectmemberkeys","objecttotalmembers",				  	"objectcopy","totalarguments","argument","typeof","strtonum",				  	"sqrt","cos","sin" };		unsigned int i;	st_entry * symbol;	symbol_table * st = (symbol_table *)malloc(sizeof(symbol_table));	if(memerror(st,"symbol table"))		return NULL;	for(i=0;i<BUCKET_SIZE;i++)		st->hash_table[i] = NULL;	st->scope_list = NULL;	// We add all the library functions from the beginning in the symbol table.	for(i=0;i<12;i++){		symbol = create_symbol(lib_functions[i],1,0,0,LIBFUNC,0,0);		if(memerror(symbol,"initalize lib func")){			free(st);			return NULL;		}		st_insert(&st,&symbol);	}	return st;}
开发者ID:chrispe92,项目名称:Alpha-Compiler,代码行数:28,


示例16: coverage_increase_counter_uncached

static struct cov_array * coverage_increase_counter_uncached(char *sourcefile, unsigned int sourceline, char mark_only) {  struct cov_array *carray = NULL;   if(sourcefile == NULL) {    /* "can't happen", just ignore and avoid segfault */    return NULL;  }   else if(!st_lookup(coverinfo, (st_data_t)sourcefile, (st_data_t*)&carray)) {    VALUE arr;        arr = rb_hash_aref(oSCRIPT_LINES__, rb_str_new2(sourcefile));    if(NIL_P(arr))       return 0;    rb_check_type(arr, T_ARRAY);    carray = calloc(1, sizeof(struct cov_array));    carray->ptr = calloc(RARRAY(arr)->len, sizeof(unsigned int));    carray->len = RARRAY(arr)->len;    st_insert(coverinfo, (st_data_t)strdup(sourcefile), (st_data_t) carray);  }   else {    /* recovered carray, sanity check */    assert(carray && "failed to create valid carray");  }  if(mark_only) {    if(!carray->ptr[sourceline])      carray->ptr[sourceline] = 1;  } else {    if (carray && carray->len > sourceline) {      carray->ptr[sourceline]++;    }  }  return carray;}
开发者ID:CoralineAda,项目名称:rcov,代码行数:35,


示例17: enc_set_default_encoding

static intenc_set_default_encoding(struct default_encoding *def, VALUE encoding, const char *name){    int overridden = FALSE;    if (def->index != -2)	/* Already set */	overridden = TRUE;    if (NIL_P(encoding)) {	def->index = -1;	def->enc = 0;	st_insert(enc_table.names, (st_data_t)strdup(name),		  (st_data_t)UNSPECIFIED_ENCODING);    }    else {	def->index = rb_enc_to_index(rb_to_encoding(encoding));	def->enc = 0;	enc_alias_internal(name, def->index);    }    if (def == &default_external)	enc_set_filesystem_encoding();    return overridden;}
开发者ID:217,项目名称:ruby,代码行数:26,


示例18: Map_CreateTableGate2Super

/**Function*************************************************************  Synopsis    []  Description []                 SideEffects []  SeeAlso     []***********************************************************************/st_table * Map_CreateTableGate2Super( Map_Man_t * pMan ){    Map_Super_t * pSuper;    st_table * tTable;    int i, nInputs, v;    tTable = st_init_table(strcmp, st_strhash);    for ( i = 0; i < pMan->pSuperLib->nSupersAll; i++ )    {        pSuper = pMan->pSuperLib->ppSupers[i];        if ( pSuper->nGates == 1 )        {            // skip different versions of the same root gate            nInputs = Mio_GateReadInputs(pSuper->pRoot);            for ( v = 0; v < nInputs; v++ )                if ( pSuper->pFanins[v]->Num != nInputs - 1 - v )                    break;            if ( v != nInputs )                continue;//            printf( "%s/n", Mio_GateReadName(pSuper->pRoot) );            if ( st_insert( tTable, (char *)pSuper->pRoot, (char *)pSuper ) )            {                assert( 0 );            }        }    }    return tTable;}
开发者ID:SpectreV,项目名称:HPowerEstimator,代码行数:38,


示例19: find_class_path

static VALUEfind_class_path(VALUE klass){    struct fc_result arg;    arg.name = 0;    arg.path = 0;    arg.klass = klass;    arg.track = rb_cObject;    arg.prev = 0;    if (RCLASS_CONST_TBL(rb_cObject)) {	st_foreach_safe(RCLASS_CONST_TBL(rb_cObject), fc_i, (st_data_t)&arg);    }    if (arg.path == 0) {	st_foreach_safe(rb_class_tbl, fc_i, (st_data_t)&arg);    }    if (arg.path) {	st_data_t tmp = tmp_classpath;	if (!RCLASS_IV_TBL(klass)) {	    RCLASS_IV_TBL(klass) = st_init_numtable();	}	st_insert(RCLASS_IV_TBL(klass), (st_data_t)classpath, arg.path);	st_delete(RCLASS_IV_TBL(klass), &tmp, 0);	return arg.path;    }    return Qnil;}
开发者ID:alexanderblair,项目名称:Gemdata,代码行数:27,


示例20: classname

static VALUEclassname(VALUE klass){    VALUE path = Qnil;    st_data_t n;    if (!klass) klass = rb_cObject;    if (RCLASS_IV_TBL(klass)) {	if (!st_lookup(RCLASS_IV_TBL(klass), (st_data_t)classpath, &n)) {	    if (!st_lookup(RCLASS_IV_TBL(klass), (st_data_t)classid, &n)) {		return find_class_path(klass);	    }	    path = rb_str_dup(rb_id2str(SYM2ID((VALUE)n)));	    OBJ_FREEZE(path);	    st_insert(RCLASS_IV_TBL(klass), (st_data_t)classpath, (st_data_t)path);	    n = classid;	    st_delete(RCLASS_IV_TBL(klass), &n, 0);	}	else {	    path = (VALUE)n;	}	if (TYPE(path) != T_STRING) {	    rb_bug("class path is not set properly");	}	return path;    }    return find_class_path(klass);}
开发者ID:alexanderblair,项目名称:Gemdata,代码行数:28,


示例21: newobj_tramp

static VALUEnewobj_tramp(){  VALUE ret = rb_newobj();  struct obj_track *tracker = NULL;  if (track_objs) {    tracker = malloc(sizeof(*tracker));    if (tracker) {      if (ruby_current_node && ruby_current_node->nd_file && *ruby_current_node->nd_file) {        tracker->source = strdup(ruby_current_node->nd_file);        tracker->line = nd_line(ruby_current_node);      } else if (ruby_sourcefile) {        tracker->source = strdup(ruby_sourcefile);        tracker->line = ruby_sourceline;      } else {        tracker->source = strdup("__null__");        tracker->line = 0;      }      tracker->obj = ret;      st_insert(objs, (st_data_t)ret, (st_data_t)tracker);    } else {      fprintf(stderr, "Warning, unable to allocate a tracker. You are running dangerously low on RAM!/n");    }  }  return ret;}
开发者ID:dseev,项目名称:memprof,代码行数:30,


示例22: link_undef

static voidlink_undef(const char *name, long base, struct relocation_info *reloc){    static int u_no = 0;    struct undef *obj;    char *addr = (char*)(reloc->r_address + base);    obj = (struct undef*)xmalloc(sizeof(struct undef));    obj->name = strdup(name);    obj->reloc = *reloc;    obj->base = base;    switch (R_LENGTH(reloc)) {      case 0:		/* byte */	obj->u.c = *addr;	break;      case 1:		/* word */	obj->u.s = *(short*)addr;	break;      case 2:		/* long */	obj->u.l = *(long*)addr;	break;    }    if (reloc_tbl == NULL) {	reloc_tbl = st_init_numtable();    }    st_insert(reloc_tbl, u_no++, obj);}
开发者ID:JamieDelton,项目名称:rhodes,代码行数:27,


示例23: referInsert

int referInsert(TreeNode *t, ErrorObj errObj){	if (st_lookup(t->attr.name) == -1)	{		/* not yet in table, variable using without definition error */		switch(errObj)		{		case TYPE:			typeError(t, "Type not defined");			break;		case VAR:			typeError(t, "Variable not defined");			break;		case FUNC:			typeError(t, "Function not defined");			break;		default:			typeError(t, "Unknown not defined error");			break;		}		return -1;	}	else	{		/* already in table, so ignore location, 		add line number of use only */ 		st_insert(t->attr.name, NULL, t->lineno, 0);		return 0;	}}
开发者ID:Frank-Shaw,项目名称:Pascal-to-MIPS-Compiler,代码行数:35,


示例24: enc_alias_internal

static const char *enc_alias_internal(const char *alias, int idx){    alias = strdup(alias);    st_insert(enc_table.names, (st_data_t)alias, (st_data_t)idx);    return alias;}
开发者ID:217,项目名称:ruby,代码行数:7,


示例25: enc_register_at

static intenc_register_at(int index, const char *name, rb_encoding *encoding){    struct rb_encoding_entry *ent = &enc_table.list[index];    VALUE list;    if (!valid_encoding_name_p(name)) return -1;    if (!ent->name) {	ent->name = name = strdup(name);    }    else if (STRCASECMP(name, ent->name)) {	return -1;    }    if (!ent->enc) {	ent->enc = xmalloc(sizeof(rb_encoding));    }    if (encoding) {	*ent->enc = *encoding;    }    else {	memset(ent->enc, 0, sizeof(*ent->enc));    }    encoding = ent->enc;    encoding->name = name;    encoding->ruby_encoding_index = index;    st_insert(enc_table.names, (st_data_t)name, (st_data_t)index);    list = rb_encoding_list;    if (list && NIL_P(rb_ary_entry(list, index))) {	/* initialize encoding data */	rb_ary_store(list, index, enc_new(encoding));    }    return index;}
开发者ID:217,项目名称:ruby,代码行数:33,


示例26: dm_create_func_def_node

DmNode* dm_create_func_def_node(char* func_name, DmNode* param_list, DmNode* stmt_list,       DM_USHORT lineno){   _GLOBAL_TBL_ASSERT_;   DM_ULONG func_id;   DmNode* func_node;   if (st_lookup(g_name_id_tbl, func_name, (char**)&func_id)) {      //TODO      printf("function redefined:%s/n", func_name);      abort();   }   else {      DmNodeList* node_list = DM_MALLOC(sizeof(DmNodeList));      int bin_num = 2;      node_list->bin_num = bin_num;      node_list->node_bin = DM_CALLOC(bin_num, sizeof(DmNode*));      node_list->m_nd_func_param_list = param_list;      node_list->m_nd_func_stmt_list = stmt_list;      func_node = dm_create_node(nd_func_def, lineno);      func_node->m_nd_func_name = func_name;      func_node->m_nd_func_body = node_list;      st_insert(g_name_id_tbl, func_name, (char*)func_node);      /*st_insert(g_str_val_tbl, (char*)func_node, func_name);*/   }   return func_node; }
开发者ID:3man,项目名称:DaiM-prototype,代码行数:27,


示例27: insertIOFunc

static void insertIOFunc(void){   TreeNode *func;    TreeNode *typeSpec;    TreeNode *param;    TreeNode *compStmt;    func = newDeclNode(FuncK);    typeSpec = newTypeNode(FuncK);    typeSpec->attr.type = INT;    func->type = Integer;    compStmt = newStmtNode(CompK);    compStmt->child[0] = NULL;      // no local var    compStmt->child[1] = NULL;      // no stmt    func->lineno = 0;    func->attr.name = "input";    func->child[0] = typeSpec;    func->child[1] = NULL;          // no param    func->child[2] = compStmt;    st_insert("input", -1, addLocation(), func);    func = newDeclNode(FuncK);    typeSpec = newTypeNode(FuncK);    typeSpec->attr.type = VOID;    func->type = Void;    param = newParamNode(NonArrParamK);    param->attr.name = "arg";    param->child[0] = newTypeNode(FuncK);    param->child[0]->attr.type = INT;    compStmt = newStmtNode(CompK);    compStmt->child[0] = NULL;      // no local var    compStmt->child[1] = NULL;      // no stmt    func->lineno = 0;    func->attr.name = "output";    func->child[0] = typeSpec;    func->child[1] = param;    func->child[2] = compStmt;    st_insert("output", -1, addLocation(), func);}
开发者ID:isairz,项目名称:cminus,代码行数:47,


示例28: bddAnnotateMintermCount

/**Function********************************************************************  Synopsis    [Annotates every node in the BDD node with its minterm count.]  Description [Annotates every node in the BDD node with its minterm count.  In this function, every node and the minterm count represented by it are  stored in a hash table.]  SideEffects [Fills up 'table' with the pair <node,minterm_count>.]******************************************************************************/static doublebddAnnotateMintermCount(  DdManager * manager,  DdNode * node,  double  max,  st_table * table){    DdNode *N,*Nv,*Nnv;    register double min_v,min_nv;    register double min_N;    double *pmin;    double *dummy;    statLine(manager);    N = Cudd_Regular(node);    if (cuddIsConstant(N)) {	if (node == DD_ONE(manager)) {	    return(max);	} else {	    return(0.0);	}    }    if (st_lookup(table, node, &dummy)) {	return(*dummy);    }	      Nv = cuddT(N);    Nnv = cuddE(N);    if (N != node) {	Nv = Cudd_Not(Nv);	Nnv = Cudd_Not(Nnv);    }    /* Recur on the two branches. */    min_v  = bddAnnotateMintermCount(manager,Nv,max,table) / 2.0;    if (min_v == (double)CUDD_OUT_OF_MEM)	return ((double)CUDD_OUT_OF_MEM);    min_nv = bddAnnotateMintermCount(manager,Nnv,max,table) / 2.0;    if (min_nv == (double)CUDD_OUT_OF_MEM)	return ((double)CUDD_OUT_OF_MEM);    min_N  = min_v + min_nv;    pmin = ALLOC(double,1);    if (pmin == NULL) {	manager->errorCode = CUDD_MEMORY_OUT;	return((double)CUDD_OUT_OF_MEM);    }    *pmin = min_N;    if (st_insert(table,(char *)node, (char *)pmin) == ST_OUT_OF_MEM) {	FREE(pmin);	return((double)CUDD_OUT_OF_MEM);    }        return(min_N);} /* end of bddAnnotateMintermCount */
开发者ID:Oliii,项目名称:MTBDD,代码行数:70,


示例29: avro_schema_union_append

intavro_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,



注:本文中的st_insert函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ st_renderbuffer函数代码示例
C++ st_init_numtable函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。