Store print dlg structure in a property instead of DWL_USER.
[wine.git] / debugger / display.c
blob3219e4eb7a4a411c3e65271ee3d3995d15b42610
1 /*
2 * File display.c - display handling for Wine internal debugger.
4 * Copyright (C) 1997, Eric Youngdale.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library 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 GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include <stdlib.h>
22 #include <string.h>
23 #include <limits.h>
24 #include <sys/types.h>
26 #include "debugger.h"
28 #include <stdarg.h>
30 #define MAX_DISPLAY 25
32 struct display
34 struct expr * exp;
35 int count;
36 char format;
39 static struct display displaypoints[MAX_DISPLAY];
41 int
42 DEBUG_AddDisplay(struct expr * exp, int count, char format)
44 int i;
47 * First find a slot where we can store this display.
49 for(i=0; i < MAX_DISPLAY; i++ )
51 if( displaypoints[i].exp == NULL )
53 displaypoints[i].exp = DEBUG_CloneExpr(exp);
54 displaypoints[i].count = count;
55 displaypoints[i].format = format;
56 break;
60 return TRUE;
63 int
64 DEBUG_InfoDisplay(void)
66 int i;
69 * First find a slot where we can store this display.
71 for(i=0; i < MAX_DISPLAY; i++ )
73 if( displaypoints[i].exp != NULL )
75 DEBUG_Printf(DBG_CHN_MESG, "%d : ", i+1);
76 DEBUG_DisplayExpr(displaypoints[i].exp);
77 DEBUG_Printf(DBG_CHN_MESG, "\n");
81 return TRUE;
84 int
85 DEBUG_DoDisplay(void)
87 DBG_VALUE value;
88 int i;
91 * First find a slot where we can store this display.
93 for(i=0; i < MAX_DISPLAY; i++ )
95 if( displaypoints[i].exp != NULL )
97 value = DEBUG_EvalExpr(displaypoints[i].exp);
98 if( value.type == NULL )
100 DEBUG_Printf(DBG_CHN_MESG, "Unable to evaluate expression ");
101 DEBUG_DisplayExpr(displaypoints[i].exp);
102 DEBUG_Printf(DBG_CHN_MESG, "\nDisabling...\n");
103 DEBUG_DelDisplay(i);
105 else
107 DEBUG_Printf(DBG_CHN_MESG, "%d : ", i + 1);
108 DEBUG_DisplayExpr(displaypoints[i].exp);
109 DEBUG_Printf(DBG_CHN_MESG, " = ");
110 if( displaypoints[i].format == 'i' )
112 DEBUG_ExamineMemory( &value,
113 displaypoints[i].count,
114 displaypoints[i].format);
116 else
118 DEBUG_Print( &value,
119 displaypoints[i].count,
120 displaypoints[i].format, 0);
126 return TRUE;
130 DEBUG_DelDisplay(int displaynum)
132 int i;
134 if( displaynum >= MAX_DISPLAY || displaynum == 0 || displaynum < -1 )
136 DEBUG_Printf(DBG_CHN_MESG, "Invalid display number\n");
137 return TRUE;
139 if( displaynum == -1 )
141 for(i=0; i < MAX_DISPLAY; i++ )
143 if( displaypoints[i].exp != NULL )
145 DEBUG_FreeExpr(displaypoints[i].exp);
146 displaypoints[i].exp = NULL;
150 else if( displaypoints[displaynum - 1].exp != NULL )
152 DEBUG_FreeExpr(displaypoints[displaynum - 1].exp);
153 displaypoints[displaynum - 1].exp = NULL;
155 return TRUE;