ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/mon/src/mon.h
Revision: 1.2
Committed: 1999-10-04T21:16:02Z (25 years, 1 month ago) by cebix
Content type: text/plain
Branch: MAIN
Changes since 1.1: +21 -22 lines
Log Message:
- GPL'ified sources
- added provisions for autoconf stuff

File Contents

# User Rev Content
1 cebix 1.1 /*
2 cebix 1.2 * mon.h - mon main program
3 cebix 1.1 *
4 cebix 1.2 * mon (C) 1997-1999 Christian Bauer, Marc Hellwig
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 cebix 1.1 */
20    
21 cebix 1.2 #ifndef MON_H
22     #define MON_H
23 cebix 1.1
24    
25 cebix 1.2 /*
26     * Initialization, deinitialization and invocation
27     */
28 cebix 1.1
29     void mon_init(void);
30     void mon_exit(void);
31     void mon(int argc, char **argv);
32    
33    
34     /*
35     * Definitions for adding commands to mon
36     */
37    
38     // Maximum input length
39     const int INPUT_LENGTH = 256;
40    
41     // Input tokens
42     enum Token {
43     T_NULL, // Invalid token
44     T_END, // End of line
45     T_NUMBER, // Hexadecimal/decimal number (uint32)
46     T_STRING, // String enclosed in ""
47     T_NAME, // Variable name
48     T_DOT, // '.'
49     T_COLON, // ':'
50     T_COMMA, // ','
51     T_LPAREN, // '('
52     T_RPAREN, // ')'
53     T_PLUS, // '+'
54     T_MINUS, // '-'
55     T_MUL, // '*'
56     T_DIV, // '/'
57     T_MOD, // '%'
58     T_AND, // '&'
59     T_OR, // '|'
60     T_EOR, // '^'
61     T_SHIFTL, // '<<'
62     T_SHIFTR, // '>>'
63     T_NOT, // '~'
64     T_ASSIGN // '='
65     };
66    
67     // Scanner variables
68     extern enum Token mon_token; // Last token read
69     extern uint32 mon_number; // Contains the number if mon_token==T_NUMBER
70     extern char mon_string[INPUT_LENGTH]; // Contains the string if mon_token==T_STRING
71     extern char mon_name[INPUT_LENGTH]; // Contains the variable name if mon_token==T_NAME
72    
73     // Streams for input, output and error messages
74     extern FILE *monin, *monout, *monerr;
75    
76     // Current address, value of '.' in expressions
77     extern uint32 mon_dot_address;
78    
79     extern bool mon_use_real_mem; // Flag: mon is using real memory
80     extern uint32 mon_mem_size; // Size of mon buffer (if mon_use_real_mem = false)
81    
82     // Add command to mon
83     extern void mon_add_command(const char *name, void (*func)(void), const char *help_text);
84    
85     // Functions for commands
86     extern void mon_error(const char *s); // Print error message
87     extern enum Token mon_get_token(void); // Get next token
88     extern bool mon_expression(uint32 *number); // Parse expression
89     extern bool mon_aborted(void); // Check if Ctrl-C was pressed
90     extern uint32 mon_read_byte(uint32 adr); // Memory access
91     extern void mon_write_byte(uint32 adr, uint32 b);
92     extern uint32 mon_read_half(uint32 adr);
93     extern void mon_write_half(uint32 adr, uint32 w);
94     extern uint32 mon_read_word(uint32 adr);
95     extern void mon_write_word(uint32 adr, uint32 l);
96    
97     #endif