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


C++ print_stack函数代码示例

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


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

示例1: xr_strlen

void CScriptEngine::process_file_if_exists	(LPCSTR file_name, bool warn_if_not_exist)
{
	u32						string_length = xr_strlen(file_name);
	if (!warn_if_not_exist && no_file_exists(file_name,string_length))
		return;

	string256				S,S1;
	if (m_reload_modules || (*file_name && !namespace_loaded(file_name))) {
		FS.update_path		(S,"$game_scripts$",strconcat(S1,file_name,".script"));
		if (!warn_if_not_exist && !FS.exist(S)) {
#ifdef DEBUG
#	ifndef XRSE_FACTORY_EXPORTS
			if (psAI_Flags.test(aiNilObjectAccess))
#	endif
			{
				print_stack			();
				Msg					("* trying to access variable %s, which doesn't exist, or to load script %s, which doesn't exist too",file_name,S1);
				m_stack_is_ready	= true;
			}
#endif
			add_no_file		(file_name,string_length);
			return;
		}
#ifndef MASTER_GOLD
		Msg					("* loading script %s",S1);
#endif // MASTER_GOLD
		m_reload_modules	= false;
		load_file_into_namespace(S,*file_name ? file_name : "_G");
	}
}
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:30,代码来源:script_engine.cpp

示例2: do_it

void do_it(FILE *p,int *btm,int cap)
{
	int *top;
	int count = 0;
	top = NULL;
	int mode = read(p);
	while(mode != 0)
	{
		if(mode == 1)
		{
			if(count >= cap)
			printf("STACK OWERFOLW\n");
			else
			{
				int ins = read(p);
				top = push(top,ins,btm);
				count++;
			}
		}
		if(mode == 2)
		{
			top = pop(top,btm);
			count--;
		}
		if(mode == 3)
		peek(top);
		if(mode == 4)
		print_stack(top,btm);
		mode = read(p);
	}
}
开发者ID:Surya361,项目名称:ds-lab,代码行数:31,代码来源:stack.c

示例3: main

int main()
{
	head=NULL;
	int data,choice=1;
	while(choice)
	{
		printf("\t\tMENU\n1:Push\n2:Pop\n3:Print\n0:Exit\f");
		scanf("%d",&choice);
		switch(choice)
		{
			case 1:
				printf("Enter the number : ");
				scanf("%d",&data);
				push(data);
				break;
			case 2:
				pop();
				break;
			case 3:
				print_stack(head);
				break;
			case 0:
				return 0;
			default:
				printf("Wrong Input . Please enter again.....\n");
				break;
		}
	}
	return 0;
}
开发者ID:abhisheknith,项目名称:Code,代码行数:30,代码来源:stack_using_linked_list.c

示例4: print_stacks

static void print_stacks(void)
{
	struct key_t key = {}, next_key;
	__u64 value;
	__u32 stackid = 0, next_id;
	int fd = map_fd[0], stack_map = map_fd[1];

	sys_read_seen = sys_write_seen = false;
	while (bpf_map_get_next_key(fd, &key, &next_key) == 0) {
		bpf_map_lookup_elem(fd, &next_key, &value);
		print_stack(&next_key, value);
		bpf_map_delete_elem(fd, &next_key);
		key = next_key;
	}

	if (!sys_read_seen || !sys_write_seen) {
		printf("BUG kernel stack doesn't contain sys_read() and sys_write()\n");
		int_exit(0);
	}

	/* clear stack map */
	while (bpf_map_get_next_key(stack_map, &stackid, &next_id) == 0) {
		bpf_map_delete_elem(stack_map, &next_id);
		stackid = next_id;
	}
}
开发者ID:AshishNamdev,项目名称:linux,代码行数:26,代码来源:trace_event_user.c

示例5: popd

int popd(){
  print_stack(root);
  printf("\n");
  char * new_dir = stack_pop(root);
  root = root->next;
  return cd(new_dir);
}
开发者ID:StephenHamilton,项目名称:Comp310-assignment-1,代码行数:7,代码来源:simple.c

示例6: walk

void walk(int point, struct stack_t* stk, struct ALGraph* _alg)
{
	int idx = -1;
	struct point_t* next_point = NULL;

	struct ALGraph* alg = NULL;
	alg = (struct ALGraph*)malloc(sizeof(struct ALGraph));
	init_ALGraph(alg);
	cpy_ALGraph(alg, _alg);

	//fprintf(stdout, "\n--------------------\n");

	//print_ALGraph(alg);

	stack_push(stk, point);

	//print_stack(stk);

	/*是否全部走完*/
	if (if_walk_through(alg))
	{
		print_stack(stk);

		return;
	}
	
	idx = find_point(alg, point);

	if (-1 == idx)
	{
		fprintf(stderr, "find_point THIS CAN NOT HAPPEN!\n");
		exit(-1);
	}

	next_point = alg->point_array[idx].next;

	while (next_point != NULL)
	{
		idx = find_edge(alg, point, next_point->val);

		if (-1 == idx)
		{
			fprintf(stderr, "find_edge THIS CAN NOT HAPPEN!\n");
			exit(-1);
		}

		if (!alg->edge_array[idx].walk)
		{
			alg->edge_array[idx].walk = 1;

			walk(next_point->val, stk, alg);
			stack_pop(stk);
			alg->edge_array[idx].walk = 0;
		}

		next_point = next_point->next;
	}

	return;
}
开发者ID:Botrix,项目名称:mycode,代码行数:60,代码来源:euler.c

示例7: change_times

void change_times(Time& t1, Time t2) {
    
    label_stack((uintptr_t *)&t1, "t1");
    label_stack((uintptr_t *)&t2, "t2");
    std::cout << "Before calling - IN change_times" << std::endl;
    print_stack();
    
    t1.setHour(15);
    t1.setMinute(20);
    t1.setSecond(21);
    
    t2.setMinute(50);
    
    std::cout << "after calling - IN change_times " << std::endl;
    print_stack();
    
}
开发者ID:yuanb10,项目名称:csci1200,代码行数:17,代码来源:Time_test.cpp

示例8: print_stack

	void Logger::fatal(const char* fmt, ...){
		print_stack();
		va_list vl;
		va_start(vl, fmt);
		logv(Logger::FATAL, fmt, vl);
		va_end(vl);
		abort();
	}
开发者ID:AllenWangxiao,项目名称:winner,代码行数:8,代码来源:Logger.cpp

示例9: print_stack

void print_stack(struct NODE *temp)
{
        if(temp==NULL)
                return;
        print_stack(temp->next);
        printf("%d-->",temp->data);
        return;
}
开发者ID:abhisheknith,项目名称:Code,代码行数:8,代码来源:stack_using_linked_list.c

示例10: print_trace

void print_trace(state_t *st) {
    fprintf(stderr, "DEBUG:\nStack:\n");
    print_stack(st);
    fprintf(stderr, "Global vars:\n");
    print_vars(st->vars, 1);
    fprintf(stderr, "Local vars:\n");
    print_vars(st->frame->vars, 0);
    fprintf(stderr, "\n");
}
开发者ID:seanlynch,项目名称:itty,代码行数:9,代码来源:itty.c

示例11: test_1

static duk_ret_t test_1(duk_context *ctx) {
	printf("test_1\n");
	prep(ctx);

	/* extend with undefined */
	duk_set_top(ctx, 5);
	print_stack(ctx);

	/* chop, using a negative top value */
	duk_set_top(ctx, -3);   /* = duk_set_top(ctx, 2) */
	print_stack(ctx);

	/* to empty */
	duk_set_top(ctx, 0);
	print_stack(ctx);

	return 0;
}
开发者ID:OakLabsInc,项目名称:duktape,代码行数:18,代码来源:test-get-set-top.c

示例12: print_stack

void print_stack(StackNode * node){
  if(node != NULL){
    printf("%s",node->item);
    if(node->next != NULL){
      printf(" ");
      print_stack(node->next);
    }
  }
}
开发者ID:StephenHamilton,项目名称:Comp310-assignment-1,代码行数:9,代码来源:simple.c

示例13: print_stack

void print_stack(){//print the stack out
  if(isEmptyStack()){
    return;//get out if we are at the end
  }else{
    int temp = pop();//temp to hold value
    printf("%d\n", temp);//display val
    print_stack();//recur
    push(temp);//add value back when we get returned here
  }
}
开发者ID:grpatter,项目名称:iu_cs_jegm,代码行数:10,代码来源:linkedCalculator.c

示例14: sa

void		sa(t_stack *stack, int x)
{
	int		tmp;

	tmp = stack->a_end->data;
	stack->a_end->data = stack->a_end->prev->data;
	stack->a_end->prev->data = tmp;
	++stack->n_moves;
	if (x && !stack->no_command)
		s_list_push(&stack->moves, s_list_new(ft_strdup("sa")));
	if (stack->status && x)
	{
		print_stack(&stack->a_begin, stack->number_in_a, 'a', stack->color);
		print_stack(&stack->b_begin, stack->number_in_b, 'b', stack->color);
		if (!stack->no_command)
			print_command(stack);
		write(1, "\n", 1);
	}
}
开发者ID:Lexouu77,项目名称:42Projects,代码行数:19,代码来源:sa.c

示例15: terminate_handler

static void terminate_handler() 
{
	fprintf(stderr, "Caught unhandled exception\n");
	print_stack();
	#ifdef __GNUG__
	__gnu_cxx::__verbose_terminate_handler();
	#else
	std::abort();
	#endif
}
开发者ID:ftk,项目名称:niceamx,代码行数:10,代码来源:backtrace.cpp


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