paul@28 | 1 | /* |
paul@28 | 2 | * Type representations for interfaces. |
paul@28 | 3 | * |
paul@207 | 4 | * Copyright (C) 2019, 2022 Paul Boddie <paul@boddie.org.uk> |
paul@28 | 5 | * |
paul@28 | 6 | * This program is free software; you can redistribute it and/or |
paul@28 | 7 | * modify it under the terms of the GNU General Public License as |
paul@28 | 8 | * published by the Free Software Foundation; either version 2 of |
paul@28 | 9 | * the License, or (at your option) any later version. |
paul@28 | 10 | * |
paul@28 | 11 | * This program is distributed in the hope that it will be useful, |
paul@28 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@28 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@28 | 14 | * GNU General Public License for more details. |
paul@28 | 15 | * |
paul@28 | 16 | * You should have received a copy of the GNU General Public License |
paul@28 | 17 | * along with this program; if not, write to the Free Software |
paul@28 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@28 | 19 | * Boston, MA 02110-1301, USA |
paul@28 | 20 | */ |
paul@28 | 21 | |
paul@6 | 22 | #pragma once |
paul@6 | 23 | |
paul@100 | 24 | /* General capability type. */ |
paul@100 | 25 | |
paul@207 | 26 | #define L4_CAP_TYPE "l4_cap_idx_t" |
paul@100 | 27 | |
paul@100 | 28 | /* A flexpage type that can hold extra information (such as the "hot spot"). */ |
paul@100 | 29 | |
paul@207 | 30 | #define L4_FPAGE_TYPE "l4_snd_fpage_t" |
paul@100 | 31 | |
paul@207 | 32 | /* IPC opcode type. */ |
paul@100 | 33 | |
paul@209 | 34 | #define L4_OPCODE_TYPE "l4_umword_t" |
paul@100 | 35 | |
paul@12 | 36 | /* Specifier values. */ |
paul@12 | 37 | |
paul@12 | 38 | enum specifier |
paul@12 | 39 | { |
paul@12 | 40 | IN_PARAMETER = 1, |
paul@12 | 41 | OUT_PARAMETER = 2, |
paul@12 | 42 | INOUT_PARAMETER = 3, |
paul@57 | 43 | ANY_PARAMETER = 3, |
paul@12 | 44 | }; |
paul@12 | 45 | |
paul@57 | 46 | /* Data class of a parameter. */ |
paul@30 | 47 | |
paul@57 | 48 | enum parameter_class |
paul@30 | 49 | { |
paul@57 | 50 | WORD_CLASS = 1, |
paul@57 | 51 | CAP_ITEM = 2, |
paul@57 | 52 | FPAGE_ITEM = 4, |
paul@57 | 53 | ITEM_CLASS = 6, /* all item values combined */ |
paul@57 | 54 | ANY_CLASS = 7, /* WORD_CLASS | ITEM_CLASS */ |
paul@30 | 55 | }; |
paul@30 | 56 | |
paul@61 | 57 | /* Component roles. */ |
paul@61 | 58 | |
paul@61 | 59 | enum component_role |
paul@61 | 60 | { |
paul@61 | 61 | CLIENT_ROLE, |
paul@61 | 62 | SERVER_ROLE, |
paul@61 | 63 | }; |
paul@61 | 64 | |
paul@129 | 65 | /* Function roles. */ |
paul@129 | 66 | |
paul@129 | 67 | enum function_role |
paul@129 | 68 | { |
paul@129 | 69 | COMPLETION_ROLE, |
paul@129 | 70 | GENERAL_FUNCTION_ROLE, |
paul@129 | 71 | }; |
paul@129 | 72 | |
paul@100 | 73 | /* Role of a parameter in output. */ |
paul@100 | 74 | |
paul@100 | 75 | enum parameter_role |
paul@100 | 76 | { |
paul@100 | 77 | SIGNATURE_ROLE, |
paul@100 | 78 | STRUCTURE_ROLE, |
paul@125 | 79 | INVOCATION_ROLE, |
paul@100 | 80 | }; |
paul@100 | 81 | |
paul@110 | 82 | /* Role of a name or signature. */ |
paul@110 | 83 | |
paul@110 | 84 | enum signature_role |
paul@110 | 85 | { |
paul@117 | 86 | ACCESS_ROLE = 1, |
paul@117 | 87 | DECLARATION_ROLE = 2, |
paul@117 | 88 | DEFINITION_ROLE = 4, |
paul@117 | 89 | MEMBER_ROLE = 8, |
paul@117 | 90 | MEMBER_DECLARATION_ROLE = 10, /* DECLARATION_ROLE | MEMBER_ROLE */ |
paul@110 | 91 | }; |
paul@110 | 92 | |
paul@72 | 93 | /* Output language. */ |
paul@72 | 94 | |
paul@72 | 95 | enum language |
paul@72 | 96 | { |
paul@72 | 97 | C_LANGUAGE, |
paul@72 | 98 | CPP_LANGUAGE, |
paul@72 | 99 | }; |
paul@72 | 100 | |
paul@214 | 101 | /* Import declarations. */ |
paul@214 | 102 | |
paul@214 | 103 | struct import |
paul@214 | 104 | { |
paul@214 | 105 | char *filename; |
paul@214 | 106 | struct interface *iface; |
paul@214 | 107 | struct import *tail; |
paul@214 | 108 | }; |
paul@214 | 109 | |
paul@21 | 110 | /* Include declarations. */ |
paul@21 | 111 | |
paul@51 | 112 | struct include |
paul@21 | 113 | { |
paul@21 | 114 | char *filename; |
paul@214 | 115 | struct interface *iface; |
paul@51 | 116 | struct include *tail; |
paul@21 | 117 | }; |
paul@21 | 118 | |
paul@25 | 119 | /* An identifier with a link to other identifiers. */ |
paul@18 | 120 | |
paul@51 | 121 | struct identifier |
paul@18 | 122 | { |
paul@18 | 123 | char *identifier; |
paul@51 | 124 | struct identifier *tail; |
paul@18 | 125 | }; |
paul@18 | 126 | |
paul@51 | 127 | /* A single parameter description linking to other parameters. */ |
paul@6 | 128 | |
paul@6 | 129 | struct parameter |
paul@6 | 130 | { |
paul@57 | 131 | enum specifier specifier; |
paul@57 | 132 | enum parameter_class cls; |
paul@51 | 133 | struct identifier *identifiers; |
paul@51 | 134 | struct parameter *tail; |
paul@6 | 135 | }; |
paul@6 | 136 | |
paul@51 | 137 | /* A single signature description linking to other signatures. */ |
paul@9 | 138 | |
paul@7 | 139 | struct signature |
paul@7 | 140 | { |
paul@7 | 141 | char *qualifier; |
paul@7 | 142 | char *operation; |
paul@51 | 143 | struct parameter *parameters; |
paul@51 | 144 | struct attribute *attributes; |
paul@51 | 145 | struct signature *tail; |
paul@7 | 146 | }; |
paul@9 | 147 | |
paul@51 | 148 | /* A single attribute description linking to other attributes. */ |
paul@25 | 149 | |
paul@25 | 150 | struct attribute |
paul@25 | 151 | { |
paul@25 | 152 | char *attribute; |
paul@51 | 153 | struct identifier *identifiers; |
paul@51 | 154 | struct attribute *tail; |
paul@25 | 155 | }; |
paul@25 | 156 | |
paul@214 | 157 | /* A reference to an interface linking to other references. */ |
paul@214 | 158 | |
paul@214 | 159 | struct interface_ref |
paul@214 | 160 | { |
paul@214 | 161 | char *name; |
paul@214 | 162 | struct interface *iface; |
paul@214 | 163 | struct interface_ref *tail; |
paul@214 | 164 | }; |
paul@214 | 165 | |
paul@51 | 166 | /* A single interface description linking to other interfaces. */ |
paul@9 | 167 | |
paul@9 | 168 | struct interface |
paul@9 | 169 | { |
paul@9 | 170 | char *name; |
paul@214 | 171 | const char *output_dirname, *output_basename; |
paul@214 | 172 | struct interface_ref *bases; |
paul@51 | 173 | struct signature *signatures; |
paul@51 | 174 | struct attribute *attributes; |
paul@214 | 175 | struct import *imports; |
paul@51 | 176 | struct include *includes; |
paul@33 | 177 | struct interface *tail; |
paul@9 | 178 | }; |