1 /*
2  *      breakpoint.c
3  *
4  *      Copyright 2010 Alexander Petukhov <devel(at)apetukhov.ru>
5  *
6  *      This program is free software; you can redistribute it and/or modify
7  *      it under the terms of the GNU General Public License as published by
8  *      the Free Software Foundation; either version 2 of the License, or
9  *      (at your option) any later version.
10  *
11  *      This program is distributed in the hope that it will be useful,
12  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *      GNU General Public License for more details.
15  *
16  *      You should have received a copy of the GNU General Public License
17  *      along with this program; if not, write to the Free Software
18  *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  *      MA 02110-1301, USA.
20  */
21 
22 /*
23  * 		Functions for creating new breakpoints.
24  */
25 
26 #include <gtk/gtk.h>
27 #include <memory.h>
28 #include "breakpoint.h"
29 
30 /*
31  * create new empty breakpoint
32  */
break_new(void)33 breakpoint* break_new(void)
34 {
35 	breakpoint* bp = (breakpoint*)g_malloc(sizeof(breakpoint));
36 	memset(bp, 0 , sizeof(breakpoint));
37 
38 	return bp;
39 }
40 
41 /*
42  * create new breakpoint with parameters
43  * arguments:
44  * 		file - breakpoints filename
45  * 		line - breakpoints line
46  * 		condition - breakpoints line
47  * 		enabled - is new breakpoint enabled
48  * 		hitscount - breakpoints hitscount
49 */
break_new_full(const char * file,int line,const char * condition,int enabled,int hitscount)50 breakpoint* break_new_full(const char* file, int line, const char* condition, int enabled, int hitscount)
51 {
52 	breakpoint* bp = break_new();
53 	strncpy(bp->file, file, G_N_ELEMENTS(bp->file) - 1);
54 	bp->line = line;
55 	if (condition)
56 		strncpy(bp->condition, condition, G_N_ELEMENTS(bp->condition) - 1);
57 	bp->enabled = enabled;
58 	bp->hitscount = hitscount;
59 
60 	return bp;
61 }
62 
63 
64