xref: /netbsd-src/external/gpl3/gdb/dist/sim/ppc/table.h (revision e39ef1d61eee3ccba837ee281f1e098c864487aa)
1 /*  This file is part of the program psim.
2 
3     Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
4 
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9 
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14 
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 
19     */
20 
21 
22 /* load a table into memory */
23 
24 typedef struct _table table;
25 
26 typedef struct _table_model_entry table_model_entry;
27 struct _table_model_entry {
28   table_model_entry *next;
29   int line_nr;
30   int nr_fields;
31   char *fields[0];	/* User defined */
32 };
33 
34 typedef struct _table_entry table_entry;
35 struct _table_entry {
36   int line_nr;
37   int nr_fields;
38   char *file_name;
39   table_model_entry *model_first;
40   table_model_entry *model_last;
41   char *annex;
42   char *fields[0];	 /* User defined */
43 };
44 
45 /* List of directories to search when opening a pushed file.  Current
46    directory is always searched first */
47 typedef struct _table_include table_include;
48 struct _table_include {
49   char *dir;
50   table_include *next;
51 };
52 
53 extern table *table_open
54 (const char *file_name,
55  int max_nr_fields,
56  int max_nr_model_fields);
57 
58 extern table_entry *table_entry_read
59 (table *file);
60 
61 /* Push the the state of the current file and open FILE_NAME.  When
62    the end of FILE_NAME is reached, return to the pushed file */
63 
64 extern void table_push
65 (table *file,
66  table_include *search,
67  const char *file_name,
68  int nr_fields,
69  int nr_model_fields);
70 
71 extern void dump_table_entry
72 (table_entry *entry,
73  int indent);
74 
75 extern void table_entry_print_cpp_line_nr
76 (lf *file,
77  table_entry *entry);
78