当前位置: 首页>>代码示例>>C++>>正文


C++ PUSH_TAG函数代码示例

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


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

示例1: ruby_init

void
ruby_init(void)
{
    int state;

    if (ruby_initialized)
	return;
    ruby_initialized = 1;

#ifdef __MACOS__
    rb_origenviron = 0;
#else
    rb_origenviron = environ;
#endif

#if WITH_OBJC
    char *s;
   
    s = getenv("MACRUBY_DEBUG");
    ruby_dlog_enabled = !(s == NULL || *s == '0');
    s = getenv("MACRUBY_DEBUG_FILE");
    if (s == NULL) {
	ruby_dlog_file = stderr;
    }
    else {
	ruby_dlog_file = fopen(s, "w");
	if (ruby_dlog_file == NULL) {
	    fprintf(stderr, "cannot open macruby debug file `%s'",
		    strerror(errno));
	    ruby_dlog_file = stderr;
	}
    }
#endif

    Init_stack((void *)&state);
    Init_PreGC();
    Init_BareVM();
    Init_heap();

    PUSH_TAG();
    if ((state = EXEC_TAG()) == 0) {
	rb_call_inits();

#ifdef __MACOS__
	_macruby_init();
#elif defined(__VMS)
	_vmsruby_init();
#endif

	ruby_prog_init();
	ALLOW_INTS;
    }
    POP_TAG();

    if (state) {
	error_print();
	exit(EXIT_FAILURE);
    }
    GET_VM()->running = 1;
}
开发者ID:yangjuchan,项目名称:homework,代码行数:60,代码来源:eval.c

示例2: rb_method_call

VALUE
rb_method_call(int argc, VALUE *argv, VALUE method)
{
    VALUE result = Qnil;	/* OK */
    struct METHOD *data;
    int state;
    volatile int safe = -1;

    Data_Get_Struct(method, struct METHOD, data);
    if (data->recv == Qundef) {
	rb_raise(rb_eTypeError, "can't call unbound method; bind first");
    }
    PUSH_TAG(PROT_NONE);
    if (OBJ_TAINTED(method)) {
	safe = rb_safe_level();
	if (rb_safe_level() < 4) {
	    rb_set_safe_level_force(4);
	}
    }
    if ((state = EXEC_TAG()) == 0) {
	PASS_PASSED_BLOCK();
	result = th_call0(GET_THREAD(),
			  data->klass, data->recv, data->id, data->oid,
			  argc, argv, data->body, 0);
    }
    POP_TAG();
    if (safe >= 0)
	rb_set_safe_level_force(safe);
    if (state)
	JUMP_TAG(state);
    return result;
}
开发者ID:RWB01,项目名称:Code-Translator,代码行数:32,代码来源:proc.c

示例3: rb_method_call

VALUE
rb_method_call(int argc, VALUE *argv, VALUE method)
{
    VALUE result = Qnil;	/* OK */
    struct METHOD *data;
    int state;
    volatile int safe = -1;

    Data_Get_Struct(method, struct METHOD, data);
    if (data->recv == Qundef) {
	rb_raise(rb_eTypeError, "can't call unbound method; bind first");
    }
    PUSH_TAG();
    if (OBJ_TAINTED(method)) {
	safe = rb_safe_level();
	if (rb_safe_level() < 4) {
	    rb_set_safe_level_force(4);
	}
    }
    if ((state = EXEC_TAG()) == 0) {
	rb_thread_t *th = GET_THREAD();
	VALUE rb_vm_call(rb_thread_t * th, VALUE klass, VALUE recv, VALUE id, ID oid,
			 int argc, const VALUE *argv, const NODE *body, int nosuper);

	PASS_PASSED_BLOCK_TH(th);
	result = rb_vm_call(th, data->oclass, data->recv, data->id, data->oid,
			    argc, argv, data->body, 0);
    }
    POP_TAG();
    if (safe >= 0)
	rb_set_safe_level_force(safe);
    if (state)
	JUMP_TAG(state);
    return result;
}
开发者ID:srirammca53,项目名称:update_status,代码行数:35,代码来源:proc.c

示例4: rb_require_safe

VALUE
rb_require_safe(VALUE fname, int safe)
{
    volatile VALUE result = Qnil;
    rb_thread_t *th = GET_THREAD();
    volatile VALUE errinfo = th->errinfo;
    int state;
    struct {
	int safe;
    } volatile saved;
    char *volatile ftptr = 0;

    PUSH_TAG();
    saved.safe = rb_safe_level();
    if ((state = EXEC_TAG()) == 0) {
	VALUE path;
	long handle;
	int found;

	rb_set_safe_level_force(safe);
	FilePathValue(fname);
	rb_set_safe_level_force(0);
	found = search_required(fname, &path, safe);
	if (found) {
	    if (!path || !(ftptr = load_lock(RSTRING_PTR(path)))) {
		result = Qfalse;
	    }
	    else {
		switch (found) {
		  case 'r':
		    rb_load_internal(path, 0);
		    break;

		  case 's':
		    handle = (long)rb_vm_call_cfunc(rb_vm_top_self(), load_ext,
						    path, 0, path);
		    rb_ary_push(ruby_dln_librefs, LONG2NUM(handle));
		    break;
		}
		rb_provide_feature(path);
		result = Qtrue;
	    }
	}
    }
    POP_TAG();
    load_unlock(ftptr, !state);

    rb_set_safe_level_force(saved.safe);
    if (state) {
	JUMP_TAG(state);
    }

    if (NIL_P(result)) {
	load_failed(fname);
    }

    th->errinfo = errinfo;

    return result;
}
开发者ID:Subv,项目名称:Ruby-Impl,代码行数:60,代码来源:load.c

示例5: ruby_setup

/* Initializes the Ruby VM and builtin libraries.
 * @retval 0 if succeeded.
 * @retval non-zero an error occurred.
 */
int
ruby_setup(void)
{
    static int initialized = 0;
    int state;

    if (initialized)
	return 0;
    initialized = 1;

    ruby_init_stack((void *)&state);
    Init_BareVM();
    Init_heap();
    Init_vm_objects();

    PUSH_TAG();
    if ((state = EXEC_TAG()) == 0) {
	rb_call_inits();
	ruby_prog_init();
	GET_VM()->running = 1;
    }
    POP_TAG();

    return state;
}
开发者ID:betacraft,项目名称:ruby-vernac,代码行数:29,代码来源:eval.c

示例6: rb_f_catch

static VALUE
rb_f_catch(int argc, VALUE *argv)
{
    VALUE tag;
    int state;
    VALUE val = Qnil;		/* OK */
    rb_thread_t *th = GET_THREAD();
    rb_control_frame_t *saved_cfp = th->cfp;

    if (argc == 0) {
	tag = rb_obj_alloc(rb_cObject);
    }
    else {
	rb_scan_args(argc, argv, "01", &tag);
    }
    PUSH_TAG();

    th->tag->tag = tag;

    if ((state = EXEC_TAG()) == 0) {
	val = rb_yield_0(1, &tag);
    }
    else if (state == TAG_THROW && RNODE(th->errinfo)->u1.value == tag) {
	th->cfp = saved_cfp;
	val = th->tag->retval;
	th->errinfo = Qnil;
	state = 0;
    }
    POP_TAG();
    if (state)
	JUMP_TAG(state);

    return val;
}
开发者ID:3runo5ouza,项目名称:rhodes,代码行数:34,代码来源:vm_eval.c

示例7: ruby_finalize_0

static void
ruby_finalize_0(void)
{
    PUSH_TAG();
    if (EXEC_TAG() == 0) {
	rb_trap_exit();
    }
    POP_TAG();
    rb_exec_end_proc();
    rb_clear_trace_func();
}
开发者ID:betacraft,项目名称:ruby-vernac,代码行数:11,代码来源:eval.c

示例8: ruby_cleanup

/** Destructs the VM.
 *
 * Runs the VM finalization processes as well as ruby_finalize(), and frees
 * resources used by the VM.
 *
 * @param ex Default value to the return value.
 * @return If an error occurred returns a non-zero. If otherwise, returns the
 *         given ex.
 * @note This function does not raise any exception.
 */
int
ruby_cleanup(volatile int ex)
{
    int state;
    volatile VALUE errs[2];
    rb_thread_t *th = GET_THREAD();
    int nerr;

    rb_threadptr_interrupt(th);
    rb_threadptr_check_signal(th);
    PUSH_TAG();
    if ((state = EXEC_TAG()) == 0) {
	SAVE_ROOT_JMPBUF(th, { RUBY_VM_CHECK_INTS(th); });
开发者ID:betacraft,项目名称:ruby-vernac,代码行数:23,代码来源:eval.c

示例9: rb_eval_cmd

VALUE
rb_eval_cmd(VALUE cmd, VALUE arg, int level)
{
    int state;
    VALUE val = Qnil;		/* OK */
    volatile int safe = rb_safe_level();

    if (OBJ_TAINTED(cmd)) {
	level = 4;
    }

    if (TYPE(cmd) != T_STRING) {
	PUSH_TAG();
	rb_set_safe_level_force(level);
	if ((state = EXEC_TAG()) == 0) {
	    val = rb_funcall2(cmd, rb_intern("call"), RARRAY_LEN(arg),
			      RARRAY_PTR(arg));
	}
	POP_TAG();

	rb_set_safe_level_force(safe);

	if (state)
	  JUMP_TAG(state);
	return val;
    }

    PUSH_TAG();
    if ((state = EXEC_TAG()) == 0) {
	val = eval_string(rb_vm_top_self(), cmd, Qnil, 0, 0);
    }
    POP_TAG();

    rb_set_safe_level_force(safe);
    if (state) rb_vm_jump_tag_but_local_jump(state, val);
    return val;
}
开发者ID:3runo5ouza,项目名称:rhodes,代码行数:37,代码来源:vm_eval.c

示例10: rb_load_protect

void
rb_load_protect(VALUE fname, int wrap, int *state)
{
    int status;
    volatile VALUE path = 0;

    PUSH_TAG();
    if ((status = EXEC_TAG()) == 0) {
	path = file_to_load(fname);
    }
    POP_TAG();
    if (!status) status = rb_load_internal0(GET_THREAD(), path, wrap);
    if (state)
	*state = status;
}
开发者ID:scorpion007,项目名称:ruby,代码行数:15,代码来源:load.c

示例11: ruby_options

/*! Processes command line arguments and compiles the Ruby source to execute.
 *
 * This function does:
 * \li Processes the given command line flags and arguments for ruby(1)
 * \li compiles the source code from the given argument, -e or stdin, and
 * \li returns the compiled source as an opaque pointer to an internal data structure
 *
 * @return an opaque pointer to the compiled source or an internal special value.
 * @sa ruby_executable_node().
 */
void *
ruby_options(int argc, char **argv)
{
    int state;
    void *volatile iseq = 0;

    ruby_init_stack((void *)&iseq);
    PUSH_TAG();
    if ((state = EXEC_TAG()) == 0) {
	SAVE_ROOT_JMPBUF(GET_THREAD(), iseq = ruby_process_options(argc, argv));
    }
    else {
	rb_clear_trace_func();
	state = error_handle(state);
	iseq = (void *)INT2FIX(state);
    }
    POP_TAG();
    return iseq;
}
开发者ID:betacraft,项目名称:ruby-vernac,代码行数:29,代码来源:eval.c

示例12: ruby_init

void
ruby_init(void)
{
    static int initialized = 0;
    int state;

    if (initialized)
	return;
    initialized = 1;

#ifdef __MACOS__
    rb_origenviron = 0;
#else
    rb_origenviron = environ;
#endif

    Init_stack((void *)&state);
    Init_BareVM();
    Init_heap();

    PUSH_TAG();
    if ((state = EXEC_TAG()) == 0) {
	rb_call_inits();

#ifdef __MACOS__
	_macruby_init();
#elif defined(__VMS)
	_vmsruby_init();
#endif

	ruby_prog_init();
	ALLOW_INTS;
    }
    POP_TAG();

    if (state) {
	error_print();
	exit(EXIT_FAILURE);
    }
    GET_VM()->running = 1;
}
开发者ID:genki,项目名称:ruby,代码行数:41,代码来源:eval.c

示例13: rb_require_internal

/*
 * returns
 *  0: if already loaded (false)
 *  1: successfully loaded (true)
 * <0: not found (LoadError)
 * >1: exception
 */
int
rb_require_internal(VALUE fname, int safe)
{
    volatile int result = -1;
    rb_thread_t *th = GET_THREAD();
    volatile VALUE errinfo = th->errinfo;
    int state;
    struct {
	int safe;
    } volatile saved;
    char *volatile ftptr = 0;

    if (RUBY_DTRACE_REQUIRE_ENTRY_ENABLED()) {
	RUBY_DTRACE_REQUIRE_ENTRY(StringValuePtr(fname),
				  rb_sourcefile(),
				  rb_sourceline());
    }

    PUSH_TAG();
    saved.safe = rb_safe_level();
    if ((state = EXEC_TAG()) == 0) {
	VALUE path;
	long handle;
	int found;

	rb_set_safe_level_force(safe);
	FilePathValue(fname);
	rb_set_safe_level_force(0);

	if (RUBY_DTRACE_FIND_REQUIRE_ENTRY_ENABLED()) {
	    RUBY_DTRACE_FIND_REQUIRE_ENTRY(StringValuePtr(fname),
					   rb_sourcefile(),
					   rb_sourceline());
	}

	path = rb_str_encode_ospath(fname);
	found = search_required(path, &path, safe);

	if (RUBY_DTRACE_FIND_REQUIRE_RETURN_ENABLED()) {
	    RUBY_DTRACE_FIND_REQUIRE_RETURN(StringValuePtr(fname),
					    rb_sourcefile(),
					    rb_sourceline());
	}
	if (found) {
	    if (!path || !(ftptr = load_lock(RSTRING_PTR(path)))) {
		result = 0;
	    }
	    else if (!*ftptr) {
		rb_provide_feature(path);
		result = 1;
	    }
	    else {
		switch (found) {
		  case 'r':
		    rb_load_internal(path, 0);
		    break;

		  case 's':
		    handle = (long)rb_vm_call_cfunc(rb_vm_top_self(), load_ext,
						    path, 0, path);
		    rb_ary_push(ruby_dln_librefs, LONG2NUM(handle));
		    break;
		}
		rb_provide_feature(path);
		result = 1;
	    }
	}
    }
    POP_TAG();
    load_unlock(ftptr, !state);

    rb_set_safe_level_force(saved.safe);
    if (state) {
	/* never TAG_RETURN */
	return state;
    }

    th->errinfo = errinfo;

    if (RUBY_DTRACE_REQUIRE_RETURN_ENABLED()) {
	RUBY_DTRACE_REQUIRE_RETURN(StringValuePtr(fname),
				  rb_sourcefile(),
				  rb_sourceline());
    }

    return result;
}
开发者ID:k-term,项目名称:lesson,代码行数:94,代码来源:load.c

示例14: rb_load_internal0

static inline void
rb_load_internal0(rb_thread_t *th, VALUE fname, int wrap)
{
    int state;
    volatile VALUE wrapper = th->top_wrapper;
    volatile VALUE self = th->top_self;
    volatile int loaded = FALSE;
    volatile int mild_compile_error;
#if !defined __GNUC__
    rb_thread_t *volatile th0 = th;
#endif

    th->errinfo = Qnil; /* ensure */

    if (!wrap) {
	th->top_wrapper = 0;
    }
    else {
	/* load in anonymous module as toplevel */
	th->top_self = rb_obj_clone(rb_vm_top_self());
	th->top_wrapper = rb_module_new();
	rb_extend_object(th->top_self, th->top_wrapper);
    }

    mild_compile_error = th->mild_compile_error;
    PUSH_TAG();
    state = EXEC_TAG();
    if (state == 0) {
	NODE *node;
	VALUE iseq;

	th->mild_compile_error++;
	node = (NODE *)rb_load_file_str(fname);
	loaded = TRUE;
	iseq = rb_iseq_new_top(node, rb_str_new2("<top (required)>"), fname, rb_realpath_internal(Qnil, fname, 1), Qfalse);
	th->mild_compile_error--;
	rb_iseq_eval(iseq);
    }
    POP_TAG();

#if !defined __GNUC__
    th = th0;
    fname = RB_GC_GUARD(fname);
#endif
    th->mild_compile_error = mild_compile_error;
    th->top_self = self;
    th->top_wrapper = wrapper;

    if (!loaded && !FIXNUM_P(th->errinfo)) {
	/* an error on loading don't include INT2FIX(TAG_FATAL) see r35625 */
	rb_exc_raise(th->errinfo);
    }
    if (state) {
	rb_vm_jump_tag_but_local_jump(state);
    }

    if (!NIL_P(th->errinfo)) {
	/* exception during load */
	rb_exc_raise(th->errinfo);
    }
}
开发者ID:betacraft,项目名称:ruby-vernac,代码行数:61,代码来源:load.c

示例15: ruby_init


//.........这里部分代码省略.........
    rb_cFalseClass = 0;
    rb_cEncoding = 0;
    rb_cEnumerator = 0;
    rb_cFile = 0;
    rb_cFixnum = 0;
    rb_cFloat = 0;
    rb_cHash = 0;
    rb_cInteger = 0;
    rb_cIO = 0;
    rb_cMatch = 0;
    rb_cMethod = 0;
    rb_cModule = 0;
    rb_cNameErrorMesg = 0;
    rb_cNilClass = 0;
    rb_cNumeric = 0;
    rb_cProc = 0;
    rb_cRandom = 0;
    rb_cRange = 0;
    rb_cRational = 0;
    rb_cComplex = 0;
    rb_cRegexp = 0;
    rb_cStat = 0;
    rb_cString = 0;
    rb_cStruct = 0;
    rb_cSymbol = 0;
    rb_cThread = 0;
    rb_cTime = 0;
    rb_cTrueClass = 0;
    rb_cUnboundMethod = 0;
    
    rb_eException = 0;
    rb_eStandardError = 0;
    rb_eSystemExit = 0;
    rb_eInterrupt = 0;
    rb_eSignal = 0;
    rb_eFatal = 0;
    rb_eArgError = 0;
    rb_eEOFError = 0;
    rb_eIndexError = 0;
    rb_eStopIteration = 0;
    rb_eKeyError = 0;
    rb_eRangeError = 0;
    rb_eIOError = 0;
    rb_eRuntimeError = 0;
    rb_eSecurityError = 0;
    rb_eSystemCallError = 0;
    rb_eThreadError = 0;
    rb_eTypeError = 0;
    rb_eZeroDivError = 0;
    rb_eNotImpError = 0;
    rb_eNoMemError = 0;
    rb_eNoMethodError = 0;
    rb_eFloatDomainError = 0;
    rb_eLocalJumpError = 0;
    rb_eSysStackError = 0;
    rb_eRegexpError = 0;
    rb_eEncodingError = 0;
    rb_eEncCompatError = 0;
    
    rb_eScriptError = 0;
    rb_eNameError = 0;
    rb_eSyntaxError = 0;
    rb_eLoadError = 0;
    
    rb_eMathDomainError = 0;
    
    ruby_current_vm = 0;
    
    rb_cISeq = 0;
    rb_cRubyVM = 0;
    rb_cEnv = 0;
    rb_mRubyVMFrozenCore = 0;

    //RHO
    
    
    //RHO
    //if (initialized)
	//return;
    //RHO
    
    initialized = 1;

    ruby_init_stack((void *)&state);
    Init_BareVM();
    Init_heap();

    PUSH_TAG();
    if ((state = EXEC_TAG()) == 0) {
	rb_call_inits();
	ruby_prog_init();
    }
    POP_TAG();

    if (state) {
	error_print();
	exit(EXIT_FAILURE);
    }
    GET_VM()->running = 1;
}
开发者ID:4nkh,项目名称:rhodes,代码行数:101,代码来源:eval.c


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