1 /* SPIM S20 MIPS simulator.
2    X interface to SPIM
3 
4    Copyright (c) 1990-2010, James R. Larus.
5    All rights reserved.
6 
7    Redistribution and use in source and binary forms, with or without modification,
8    are permitted provided that the following conditions are met:
9 
10    Redistributions of source code must retain the above copyright notice,
11    this list of conditions and the following disclaimer.
12 
13    Redistributions in binary form must reproduce the above copyright notice,
14    this list of conditions and the following disclaimer in the documentation and/or
15    other materials provided with the distribution.
16 
17    Neither the name of the James R. Larus nor the names of its contributors may be
18    used to endorse or promote products derived from this software without specific
19    prior written permission.
20 
21    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24    ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27    GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30    OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32 
33 
34 #define IO_BUFFSIZE 	10000
35 
36 #define TEXTHEIGHT \
37 	(text_font->max_bounds.ascent + text_font->max_bounds.descent)
38 
39 #define TEXTWIDTH \
40 	(text_font->max_bounds.width)
41 
42 
43 
44 /* Exported functions (also see spim.h): */
45 
46 void clear_console_display ();
47 void execute_program (mem_addr pc, int steps, int display, int cont_bkpt);
48 void popup_console (Widget w, XtPointer client_data, XtPointer call_data);
49 void read_file (char *name);
50 void redisplay_data ();
51 void redisplay_text ();
52 void start_program (mem_addr addr);
53 
54 
55 /* Exported variables: */
56 
57 extern XtAppContext app_con;
58 extern Widget message, console;
59 extern XtAppContext app_context;
60 extern XFontStruct *text_font;
61 extern Dimension button_width;
62 extern int load_exception_handler;
63 extern char *load_file;
64 extern Pixmap mark;
65