1 /* This file is part of the program psim.
3 Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
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.
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.
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.
25 #ifndef STATIC_INLINE_CAP
26 #define STATIC_INLINE_CAP STATIC_INLINE
31 typedef struct _cap_mapping cap_mapping;
40 cap_mapping *mappings;
44 cap_create(const char *key)
52 cap_mapping *current_mapping = map->mappings;
53 while (current_mapping != NULL) {
54 cap_mapping *tbd = current_mapping;
55 current_mapping = tbd->next;
59 map->mappings = (cap_mapping*)0;
66 cap_mapping *current_map = db->mappings;
67 while (current_map != NULL) {
68 if (current_map->external == external)
69 return current_map->internal;
70 current_map = current_map->next;
79 cap_mapping *current_map = db->mappings;
80 while (current_map != NULL) {
81 if (current_map->internal == internal)
82 return current_map->external;
83 current_map = current_map->next;
85 current_map = ZALLOC(cap_mapping);
86 current_map->next = db->mappings;
87 current_map->internal = internal;
89 current_map->external = db->nr_mappings;
90 db->mappings = current_map;
91 return current_map->external;