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