⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 u.c

📁 一个很不错的程序切片工具,希望大家来讨论以下,对测试人员很有帮助
💻 C
📖 第 1 页 / 共 3 页
字号:
		abandon_slice?" (partial)":""		);	strcpy (r->message?state->stext:state->ptext,label);	sprintf (label,"Primary: %s   Secondary: %s",		state->ptext,state->stext);	XtVaSetValues (state->slice_label,		XtNlabel,label,		NULL);	state->is_running = 0;	update_progress (-1);}void dodicecall (x,state,primary_set,secondary_set)	proc_state_ptr state;	bit_set	*primary_set,*secondary_set;	Widget	x;{	int		i;	int		f;	char	buff[400];	SliceClearAll(state->slicewin);	for (f = 0; f < n_files; f++){		i = -1;		while ((i = get_next_member(primary_set[f],i)) >= 0){			if (!is_bit_on (secondary_set[f],i)){				SliceSet (state->slicewin,				files[f].stmts[i].froml+line_map[f],				files[f].stmts[i].fromc,				files[f].stmts[i].tol+line_map[f],				files[f].stmts[i].toc,0);			}		}	}	SliceRedraw (state->slicewin);}void dicecallsp (x,state,r)	proc_state_ptr state;	Widget	x;	XtPointer	r;{	char	buff[400];		sprintf (buff,"%s diced by %s",state->stext,state->ptext);	XtVaSetValues (state->display_label,		XtNlabel, buff,		NULL);	dodicecall (x,state,secondary_set,primary_set);}void dicecall (x,state,r)	proc_state_ptr state;	Widget	x;	XtPointer	r;{	char	buff[400];		sprintf (buff,"%s diced by %s",state->ptext,state->stext);	XtVaSetValues (state->display_label,		XtNlabel, buff,		NULL);	dodicecall (x,state,primary_set,secondary_set);}void bbcall (x,state,r)	proc_state_ptr state;	Widget	x;	XtPointer	r;{	int		i;	int		f;	char	buff[400];	SliceClearAll(state->slicewin);	for (f = 0; f < n_files; f++){		i = -1;		while ((i = get_next_member(primary_set[f],i)) >= 0){			if (is_bit_on (secondary_set[f],i)){				SliceSet (state->slicewin,				files[f].stmts[i].froml+line_map[f],				files[f].stmts[i].fromc,				files[f].stmts[i].tol+line_map[f],				files[f].stmts[i].toc,0);			}		}	}	sprintf (buff,"Intersection of %s & %s",state->ptext,state->stext);	XtVaSetValues (state->display_label,		XtNlabel, buff,		NULL);	SliceRedraw (state->slicewin);}void unioncall (x,state,r)	proc_state_ptr state;	Widget	x;	XtPointer	r;{	int		i;	int		f;	char	buff[400];	SliceClearAll(state->slicewin);	for (f = 0; f < n_files; f++){		i = -1;		while ((i = get_next_member(primary_set[f],i)) >= 0){			SliceSet (state->slicewin,			files[f].stmts[i].froml+line_map[f],			files[f].stmts[i].fromc,			files[f].stmts[i].tol+line_map[f],			files[f].stmts[i].toc,0);		}		i = -1;		while ((i = get_next_member(secondary_set[f],i)) >= 0){			SliceSet (state->slicewin,			files[f].stmts[i].froml+line_map[f],			files[f].stmts[i].fromc,			files[f].stmts[i].tol+line_map[f],			files[f].stmts[i].toc,0);		}	}	sprintf (buff,"Union of %s & %s",state->ptext,state->stext);	XtVaSetValues (state->display_label,		XtNlabel, buff,		NULL);	SliceRedraw (state->slicewin);}void clear_sliceB (w,state,y)	Widget	w;	proc_state_ptr state;	caddr_t	y;{	char    buff[2000];	sprintf (buff,"/usr/bin/rm -f %sY",state->root_file);	clear_history();	system (buff);}void clearB (w,state,y)	Widget	w;	proc_state_ptr state;	caddr_t	y;{	char	buff[2000];	if(SliceTrace)printf ("clear button pressed\n");	sprintf (buff,"Source text for: %sc",state->root_file);	XtVaSetValues (state->display_label,XtNlabel,buff,NULL);	SliceClearAll(state->slicewin);}popup_selection(a,state,c)	Widget		a;	proc_state_ptr      state;	XtPointer	c;{	Position		x,y;	Widget		p;	char		**list;	int			i;	p = XtParent(XtParent(state->history_list));	/*	XtTranslateCoords(top,		(Position) 30,		(Position) 60,		&x,&y);	XtVaSetValues (p,		XtNx,	(XtArgVal) x,		XtNy,	(XtArgVal) y,		NULL);		*/	state->is_primary = (0 == strcmp (XtName(a),"Primary"));	list = get_slice_list();	XawListChange (state->history_list,list,0,0,True);	adjust_popup_list (state->history_list);	XtPopup (p,XtGrabExclusive);}proc_pop(a,p,c)	Widget		a,p;	XtPointer	c;{	Position		x,y;	XtTranslateCoords(top,		(Position) 30,		(Position) 60,		&x,&y);	/*	XtVaSetValues (p,		XtNx,	(XtArgVal) x,		XtNy,	(XtArgVal) y,		NULL);		*/	XtPopup (p,XtGrabExclusive);}tree_pop (w,state,p)	Widget	w;	XtPointer	p;	proc_state_ptr		state;{		state->reason = tree;	proc_pop (w,state->proc_popup,NULL);}show_pop (w,state,p)	Widget	w;	XtPointer	p;	proc_state_ptr		state;{		state->reason = show;	proc_pop (w,state->proc_popup,NULL);}var_select(a,state,list)	Widget		a;	proc_state_ptr		state;	XawListReturnStruct	*list;{	Widget	parent;	char	buff[1000];	int		ix;	char	**addr,**base;	parent = XtParent(a);	while (!XtIsTransientShell(parent))parent = XtParent(parent);	XtPopdown (parent);	if (list->list_index == 0){		return;	}	if (state->pid){		state->slice_var_index = list->list_index; 	}	else {		ix = global_ids[state->header][list->list_index - 1];		state->slice_var_index = ix;	}	update_label(state);}slice_select(a,state,list)	Widget		a;	proc_state_ptr		state;	XawListReturnStruct	*list;{	Widget	parent;	char	label[2000];	parent = XtParent(a);	while (!XtIsTransientShell(parent))parent = XtParent(parent);	XtPopdown (parent);	if (list->list_index == 0) return;	if (state->is_primary) slice_set = primary_set;	else slice_set = secondary_set;	load_slice (state->slicewin,list->list_index-1,n_files,slice_set,		line_map);	XtVaSetValues (state->display_label,XtNlabel,		list->string,NULL);	strcpy (state->is_primary?state->ptext:state->stext,list->string);	sprintf (label,"Primary: %s   Secondary: %s",		state->ptext,state->stext);	XtVaSetValues (state->slice_label,XtNlabel,label,NULL);	update_progress (-1);}head_select(a,state,list)	Widget		a;	proc_state_ptr		state;	XawListReturnStruct	*list;{	Widget	parent;	char	buff[1000];	int		ix;	parent = XtParent(a);	while (!XtIsTransientShell(parent))parent = XtParent(parent);	XtPopdown (parent);	if (list->list_index == 0) return;	XtUnmanageChild(state->var_list);	XawListChange (state->var_list,global_vars[list->list_index],		0,0,True);	state->pid = 0;	state->slice_var_index = 0;	state->header = list->list_index;	update_label(state);	adjust_popup_list (state->var_list);	XtManageChild(state->var_list);	proc_pop (NULL,state->var_popup,NULL);}mark_call_tree (w,proc)	Widget	w;	int	proc;{	int		i,p,f;		if ((proc < 1) || (proc > n_procs)) return;	for (i = 0; i < n_files; i++)		clear_bit_set (slice_set[i]);    slice_tree (slice_set,proc,active);	p = -1;	while ((p= get_next_member(active,p)) >= 0){		f = procs[p].file_id;				i = -1;		while ((i = get_next_member(slice_set[f],i)) >= 0){			SliceSet (w,				files[f].stmts[i].froml+line_map[f],				files[f].stmts[i].fromc,				files[f].stmts[i].tol+line_map[f],				files[f].stmts[i].toc,0);		}	}	SliceRedraw (w);}proc_select(a,state,list)	Widget		a;	proc_state_ptr		state;	XawListReturnStruct	*list;{	Widget	parent;	char	buff[1000];	int		ix,i,f;	parent = XtParent(a);	while (!XtIsTransientShell(parent))parent = XtParent(parent);	XtPopdown (parent);	if (list->list_index == 0) return;	state->proc = list->string;	current_proc = list->list_index;	state->pid = proc_ids[list->list_index];	state->slice_var_index = 0;	SliceClearAll(state->slicewin);	f = procs[state->pid].file_id;	i = procs[state->pid].entry;	SliceSet (state->slicewin,		files[f].stmts[i].froml+line_map[f],		files[f].stmts[i].fromc,		files[f].stmts[i].tol+line_map[f],		files[f].stmts[i].toc,0);	i = procs[state->pid].exit;	SliceSet (state->slicewin,		files[f].stmts[i].froml+line_map[f],		files[f].stmts[i].fromc,		files[f].stmts[i].tol+line_map[f],		files[f].stmts[i].toc,1);	update_label(state);	if (state->reason != select_action){		if (state->reason == tree)			mark_call_tree (state->slicewin,state->pid);		state->reason = select_action;		return;	}	XtUnmanageChild(state->var_list);	XawListChange (state->var_list,local_vars[list->list_index],			0,0,True);	adjust_popup_list (state->var_list);	XtManageChild(state->var_list);	proc_pop (NULL,state->var_popup,NULL);	/*	if (list->list_index == n_procs)	else {		XawListChange (state->var_list,procs[list->list_index].locals,			0,0,True);		stmt = stmt_index[procs[current_proc].proc_at];		SliceSetTop (state->slicewin,			(float)stmt->start_line/((float)n_lines));	}	adjust_popup_list (state->var_list);	*/}	char	*fall[] = {		/* don't move the first entry (iconPixmap) */		"*iconPixmap:	slice.icon",		"*title: Unravel Version 2.2+ Program Slicer",		"*procpop.title: Procedures",		"*headpop.title: Files",		"*varpop.title: Variables",		"*selectpop.title: Slices",		"u.geometry: 600x450+10+10",		"*procpop.geometry: +10+10",		"*selectpop.geometry: +20+10",		"*headpop.geometry: +30+10",		"*varpop.geometry: +40+10",		"*font:	lucidasanstypewriter-bold-12",		"*slicewin*altFont:	lucidasanstypewriter-bold-12",		"*slicewin*font:	lucidasanstypewriter-bold-12",		"*slicewin*sideBackground:	LightBlue1",		"*slicewin*sideForeground:	Blue1",		"*slicewin*altBackground:	blue",		"*slicewin*altForeground:	yellow",		"*background: seashell3",		"*foreground: blue",		"*shapeStyle: oval",		"*Label*borderWidth: 1",		"*criterion.borderWidth: 3",		"*info.borderWidth: 3",		"*progress.borderWidth: 0",		"*Command*borderWidth: 2",		"*MenuButton*borderWidth: 2",		"*procpop.width: 500",		"*varpop.width: 500",		"*quit.accelerators: #override\\n \			<KeyPress>q: set() highlight() notify()",		"*Help.accelerators:  \			<KeyPress>h: set() highlight() notify() unset()\\n\			<KeyPress>?: set() highlight() notify() unset()",		NULL};	XtAppContext	ac;void continue_events(proc,change)	int		proc,change;{	XEvent	e;	static	pass = 0;	static int		n = 0;	if (pass%100 == 0){		n = update_progress (n);	}	pass++;	if (XtAppPending(ac)){		XtAppNextEvent(ac,&e);		XtDispatchEvent(&e);	}}void active_hook();main(argc, argv)    int argc;    char **argv;{	Widget		create_widgets();	int			fd,openok;	char		icon_res[2000];	char		*suffix,file_name_base[2000];	MultiSliceFiles  f[100];	int					i;	int			t_lines = 0;	char		*root;	static XrmOptionDescRec opt[] = {		{"-runningfg", "*runningFG", XrmoptionSepArg,NULL},		{"-runningbg", "*runningBG", XrmoptionSepArg,NULL}};	printf ("unravel version %s\n","2.2+");	sprintf (icon_res,"*iconPixmap: %s/slice.icon",HOME);	fall[0] = icon_res;	top = XtAppInitialize (&ac,"Unravel",opt,XtNumber(opt),&argc,argv,		fall,NULL,0);	root = get_file (argc,argv);	slicewin = create_widgets(top,root);	/*	printf ("\nn files %d\n",n_files);	*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -