filename | src/tools/gendec.h |
changeset | 979:2cc7b486ea6c |
prev | 969:3f178ca1398c |
author | nkeynes |
date | Mon Feb 13 12:26:01 2012 +1000 (12 years ago) |
permissions | -rw-r--r-- |
last change | Add GTK_LIBS to ldadd for testlxpaths, as GLIB_LIBS isn't defined for GTK builds... |
view | annotate | diff | log | raw |
1 /**
2 * $Id$
3 *
4 * mem is responsible for creating and maintaining the overall system memory
5 * map, as visible from the SH4 processor. (Note the ARM has a different map)
6 *
7 * Copyright (c) 2005 Nathan Keynes.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 */
20 #ifndef lxdream_gendec_H
21 #define lxdream_gendec_H 1
23 #include <stdint.h>
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
29 #define MAX_OPERAND_NAME 8
30 #define MAX_OPERANDS 4
31 #define MAX_OPERATION_FORMAT 64
32 #define MAX_RULES 512
34 #define USE_NONE 0
35 #define USE_READ 1
36 #define USE_WRITE 2
37 #define USE_READWRITE 3
39 struct operand {
40 int bit_count;
41 int bit_shift;
42 int left_shift;
43 int is_signed;
44 int use_mode;
45 char name[MAX_OPERAND_NAME+1];
46 };
48 struct rule {
49 uint32_t bits;
50 uint32_t mask;
51 int bit_count;
52 int operand_count;
53 int flags_use_mode;
54 struct operand operands[MAX_OPERANDS];
55 char format[MAX_OPERATION_FORMAT+1];
56 };
58 struct ruleset {
59 uint32_t rule_count;
60 struct rule *rules[MAX_RULES];
61 };
63 struct ruleset *parse_ruleset_file( FILE *f );
64 void dump_ruleset( struct ruleset *rules, FILE *f );
65 void dump_rulesubset( struct ruleset *rules, int ruleidx[], int rule_count, FILE *f );
67 struct action {
68 const char *filename;
69 int lineno;
70 const char *text;
71 };
73 typedef struct actionfile *actionfile_t;
75 typedef struct actiontoken {
76 enum { NONE, TEXT, ACTIONS, END, ERROR } symbol;
77 const char *filename;
78 int lineno;
79 char *text;
80 struct action actions[MAX_RULES];
81 } *actiontoken_t;
83 actionfile_t action_file_open( const char *filename, struct ruleset *rules );
85 actiontoken_t action_file_next( actionfile_t af );
87 void action_file_close( actionfile_t af );
89 #ifdef __cplusplus
90 }
91 #endif
93 #endif /* !lxdream_gendec_H */
.