Added DM_REPOSITION.
[wine/multimedia.git] / debugger / display.c
blob2bf402ec47a77a14c54415cacf2f4a61c7efec7e
1 /*
2 * File display.c - display handling for Wine internal debugger.
4 * Copyright (C) 1997, Eric Youngdale.
6 */
8 #include <stdlib.h>
9 #include <string.h>
10 #include <limits.h>
11 #include <sys/types.h>
13 #include "debugger.h"
15 #include <stdarg.h>
17 #define MAX_DISPLAY 25
19 struct display
21 struct expr * exp;
22 int count;
23 char format;
26 static struct display displaypoints[MAX_DISPLAY];
28 int
29 DEBUG_AddDisplay(struct expr * exp, int count, char format)
31 int i;
34 * First find a slot where we can store this display.
36 for(i=0; i < MAX_DISPLAY; i++ )
38 if( displaypoints[i].exp == NULL )
40 displaypoints[i].exp = DEBUG_CloneExpr(exp);
41 displaypoints[i].count = count;
42 displaypoints[i].format = format;
43 break;
47 return TRUE;
50 int
51 DEBUG_InfoDisplay(void)
53 int i;
56 * First find a slot where we can store this display.
58 for(i=0; i < MAX_DISPLAY; i++ )
60 if( displaypoints[i].exp != NULL )
62 DEBUG_Printf(DBG_CHN_MESG, "%d : ", i+1);
63 DEBUG_DisplayExpr(displaypoints[i].exp);
64 DEBUG_Printf(DBG_CHN_MESG, "\n");
68 return TRUE;
71 int
72 DEBUG_DoDisplay(void)
74 DBG_VALUE value;
75 int i;
78 * First find a slot where we can store this display.
80 for(i=0; i < MAX_DISPLAY; i++ )
82 if( displaypoints[i].exp != NULL )
84 value = DEBUG_EvalExpr(displaypoints[i].exp);
85 if( value.type == NULL )
87 DEBUG_Printf(DBG_CHN_MESG, "Unable to evaluate expression ");
88 DEBUG_DisplayExpr(displaypoints[i].exp);
89 DEBUG_Printf(DBG_CHN_MESG, "\nDisabling...\n");
90 DEBUG_DelDisplay(i);
92 else
94 DEBUG_Printf(DBG_CHN_MESG, "%d : ", i + 1);
95 DEBUG_DisplayExpr(displaypoints[i].exp);
96 DEBUG_Printf(DBG_CHN_MESG, " = ");
97 if( displaypoints[i].format == 'i' )
99 DEBUG_ExamineMemory( &value,
100 displaypoints[i].count,
101 displaypoints[i].format);
103 else
105 DEBUG_Print( &value,
106 displaypoints[i].count,
107 displaypoints[i].format, 0);
113 return TRUE;
117 DEBUG_DelDisplay(int displaynum)
119 int i;
121 if( displaynum >= MAX_DISPLAY || displaynum == 0 || displaynum < -1 )
123 DEBUG_Printf(DBG_CHN_MESG, "Invalid display number\n");
124 return TRUE;
126 if( displaynum == -1 )
128 for(i=0; i < MAX_DISPLAY; i++ )
130 if( displaypoints[i].exp != NULL )
132 DEBUG_FreeExpr(displaypoints[i].exp);
133 displaypoints[i].exp = NULL;
137 else if( displaypoints[displaynum - 1].exp != NULL )
139 DEBUG_FreeExpr(displaypoints[displaynum - 1].exp);
140 displaypoints[displaynum - 1].exp = NULL;
142 return TRUE;