コード例 #1
0
ファイル: update.c プロジェクト: ayumin/ruby
static VALUE
test_st_update(VALUE self, VALUE key)
{
    if (st_update(RHASH_TBL(self), (st_data_t)key, update_func, 0))
	return Qtrue;
    else
	return Qfalse;
}
コード例 #2
0
ファイル: load.c プロジェクト: scorpion007/ruby
RUBY_FUNC_EXPORTED void
ruby_init_ext(const char *name, void (*init)(void))
{
    st_table *loading_tbl = get_loading_table();

    if (rb_provided(name))
	return;
    st_update(loading_tbl, (st_data_t)name, register_init_ext, (st_data_t)init);
}
コード例 #3
0
ファイル: load.c プロジェクト: scorpion007/ruby
static void
load_unlock(const char *ftptr, int done)
{
    if (ftptr) {
	st_data_t key = (st_data_t)ftptr;
	st_table *loading_tbl = get_loading_table();

	st_update(loading_tbl, key, release_thread_shield, done);
    }
}
コード例 #4
0
ファイル: yasm.c プロジェクト: kasikci/processor-trace
static int yasm_advance_next_line(struct yasm *y)
{
	enum { slen = 1024 };
	char s[slen];
	char filename[max_filename_len];
	int errcode;
	int asm_line, asm_inc;

	if (bug_on(!y))
		return -err_internal;


	for (;;) {
		errcode = fl_getline(y->fl, s, slen, y->lstfile,
				     y->lst_curr_line);
		/* always advance in lst file.  */
		y->lst_curr_line += 1;

		if (errcode < 0)
			break;

		/* if the current lst file line is a line directive, set
		 * state information to this file, line and increment
		 * and continue.
		 */
		if (sscanf(s, "%*d %%line %d+%d %1023s", &asm_line, &asm_inc,
			   filename) == 3) {
			st_set_file(y->st_asm, filename, asm_line, asm_inc);
			continue;
		}

		/* if line number or increment in the previous line
		 * directive is <= 0, the current lst line has no
		 * corresponding line in the source file.
		 */
		if (y->st_asm->n <= 0 || y->st_asm->inc <= 0)
			continue;

		/* finally the current line in the lst file can be
		 * correlated to the source file, so we retrieve the
		 * line from it and update the state.
		 */
		errcode = fl_getline(y->fl, s, slen, y->st_asm->filename,
				     y->st_asm->n-1);
		st_update(y->st_asm, s);
		break;
	}

	return errcode;
}
コード例 #5
0
void fp_Tree::mine() {

	// storing original data
	int t = item_stack.top();
	list<int> t_branch = stree.branch;
	list<int> t_base_count = stree.base_count;
	vector<int> t_count = stree.count;

	// mine each items in the ST(i) by recursion
	for(int i = t-1 ; i >= 0 ; --i) {
		if(stree.count[i] >= freq) {
			item_stack.push(i);
			output(stree.count[i]);
			st_update(i);
			if(exist_node()) mine();
			item_stack.pop();

			// restoring
			stree.branch = t_branch;
			stree.base_count = t_base_count;	
			stree.count = t_count;
		}
	}
}
コード例 #6
0
ファイル: stackprof.c プロジェクト: ThomasSevestre/stackprof
void
st_numtable_increment(st_table *table, st_data_t key, size_t increment)
{
    st_update(table, key, numtable_increment_callback, (st_data_t)increment);
}