aboutsummaryrefslogtreecommitdiffstats
path: root/lib/lufa/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lufa/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.h')
0 files changed, 0 insertions, 0 deletions
'#n87'>87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436
--  Meta description of Elocations.
--  Copyright (C) 2017-2021 Tristan Gingold
--
--  This program is free software: you can redistribute it and/or modify
--  it under the terms of the GNU General Public License as published by
--  the Free Software Foundation, either version 2 of the License, or
--  (at your option) any later version.
--
--  This program is distributed in the hope that it will be useful,
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--  GNU General Public License for more details.
--
--  You should have received a copy of the GNU General Public License
--  along with this program.  If not, see <gnu.org/licenses>.

with Vhdl.Elocations; use Vhdl.Elocations;

package body Vhdl.Elocations_Meta is
   function Get_Field_Image (F : Fields_Enum) return String is
   begin
      case F is
         when Field_Start_Location =>
            return "start_location";
         when Field_Right_Paren_Location =>
            return "right_paren_location";
         when Field_End_Location =>
            return "end_location";
         when Field_Is_Location =>
            return "is_location";
         when Field_Begin_Location =>
            return "begin_location";
         when Field_Then_Location =>
            return "then_location";
         when Field_Use_Location =>
            return "use_location";
         when Field_Loop_Location =>
            return "loop_location";
         when Field_Generate_Location =>
            return "generate_location";
         when Field_Generic_Location =>
            return "generic_location";
         when Field_Port_Location =>
            return "port_location";
         when Field_Generic_Map_Location =>
            return "generic_map_location";
         when Field_Port_Map_Location =>
            return "port_map_location";
         when Field_Arrow_Location =>
            return "arrow_location";
         when Field_Colon_Location =>
            return "colon_location";
         when Field_Assign_Location =>
            return "assign_location";
      end case;
   end Get_Field_Image;

   type Field_Type is (Type_Location_Type);

   function Fields_Type (F : Fields_Enum) return Field_Type
   is
      pragma Unreferenced (F);
   begin
      return Type_Location_Type;
   end Fields_Type;

   pragma Warnings (Off, """others"" choice is redundant");

   function Get_Location_Type
      (N : Iir; F : Fields_Enum) return Location_Type is
   begin
      pragma Assert (Fields_Type (F) = Type_Location_Type);
      case F is
         when Field_Start_Location =>
            return Get_Start_Location (N);
         when Field_Right_Paren_Location =>
            return Get_Right_Paren_Location (N);
         when Field_End_Location =>
            return Get_End_Location (N);
         when Field_Is_Location =>
            return Get_Is_Location (N);
         when Field_Begin_Location =>
            return Get_Begin_Location (N);
         when Field_Then_Location =>
            return Get_Then_Location (N);
         when Field_Use_Location =>
            return Get_Use_Location (N);
         when Field_Loop_Location =>
            return Get_Loop_Location (N);
         when Field_Generate_Location =>
            return Get_Generate_Location (N);
         when Field_Generic_Location =>
            return Get_Generic_Location (N);
         when Field_Port_Location =>
            return Get_Port_Location (N);
         when Field_Generic_Map_Location =>
            return Get_Generic_Map_Location (N);
         when Field_Port_Map_Location =>
            return Get_Port_Map_Location (N);
         when Field_Arrow_Location =>
            return Get_Arrow_Location (N);
         when Field_Colon_Location =>
            return Get_Colon_Location (N);
         when Field_Assign_Location =>
            return Get_Assign_Location (N);
         when others =>
            raise Internal_Error;
      end case;
   end Get_Location_Type;

   procedure Set_Location_Type
      (N : Iir; F : Fields_Enum; V: Location_Type) is
   begin
      pragma Assert (Fields_Type (F) = Type_Location_Type);
      case F is
         when Field_Start_Location =>
            Set_Start_Location (N, V);
         when Field_Right_Paren_Location =>
            Set_Right_Paren_Location (N, V);
         when Field_End_Location =>
            Set_End_Location (N, V);
         when Field_Is_Location =>
            Set_Is_Location (N, V);
         when Field_Begin_Location =>
            Set_Begin_Location (N, V);
         when Field_Then_Location =>
            Set_Then_Location (N, V);
         when Field_Use_Location =>
            Set_Use_Location (N, V);
         when Field_Loop_Location =>
            Set_Loop_Location (N, V);
         when Field_Generate_Location =>
            Set_Generate_Location (N, V);
         when Field_Generic_Location =>
            Set_Generic_Location (N, V);
         when Field_Port_Location =>
            Set_Port_Location (N, V);
         when Field_Generic_Map_Location =>
            Set_Generic_Map_Location (N, V);
         when Field_Port_Map_Location =>
            Set_Port_Map_Location (N, V);
         when Field_Arrow_Location =>
            Set_Arrow_Location (N, V);
         when Field_Colon_Location =>
            Set_Colon_Location (N, V);
         when Field_Assign_Location =>
            Set_Assign_Location (N, V);
         when others =>
            raise Internal_Error;
      end case;
   end Set_Location_Type;

   function Has_Start_Location (K : Iir_Kind) return Boolean is
   begin
      case K is
         when Iir_Kind_Library_Clause
           | Iir_Kind_Attribute_Specification
           | Iir_Kind_Protected_Type_Declaration
           | Iir_Kind_Protected_Type_Body
           | Iir_Kind_Entity_Declaration
           | Iir_Kind_Configuration_Declaration
           | Iir_Kind_Context_Declaration
           | Iir_Kind_Package_Declaration
           | Iir_Kind_Package_Instantiation_Declaration
           | Iir_Kind_Package_Body
           | Iir_Kind_Architecture_Body
           | Iir_Kind_Type_Declaration
           | Iir_Kind_Anonymous_Type_Declaration
           | Iir_Kind_Subtype_Declaration
           | Iir_Kind_Component_Declaration
           | Iir_Kind_Attribute_Declaration
           | Iir_Kind_Group_Template_Declaration
           | Iir_Kind_Group_Declaration
           | Iir_Kind_Function_Declaration
           | Iir_Kind_Procedure_Declaration
           | Iir_Kind_Function_Body
           | Iir_Kind_Procedure_Body
           | Iir_Kind_Object_Alias_Declaration
           | Iir_Kind_File_Declaration
           | Iir_Kind_Signal_Declaration
           | Iir_Kind_Variable_Declaration
           | Iir_Kind_Constant_Declaration
           | Iir_Kind_Iterator_Declaration
           | Iir_Kind_Interface_Constant_Declaration
           | Iir_Kind_Interface_Variable_Declaration
           | Iir_Kind_Interface_Signal_Declaration
           | Iir_Kind_Interface_File_Declaration
           | Iir_Kind_Interface_Quantity_Declaration
           | Iir_Kind_Interface_Terminal_Declaration
           | Iir_Kind_Interface_Type_Declaration
           | Iir_Kind_Interface_Package_Declaration
           | Iir_Kind_Sensitized_Process_Statement
           | Iir_Kind_Process_Statement
           | Iir_Kind_Concurrent_Simple_Signal_Assignment
           | Iir_Kind_Concurrent_Conditional_Signal_Assignment
           | Iir_Kind_Concurrent_Selected_Signal_Assignment
           | Iir_Kind_If_Generate_Statement
           | Iir_Kind_For_Generate_Statement
           | Iir_Kind_Generate_Statement_Body
           | Iir_Kind_If_Generate_Else_Clause
           | Iir_Kind_Simultaneous_Procedural_Statement
           | Iir_Kind_Simultaneous_If_Statement
           | Iir_Kind_Simultaneous_Elsif
           | Iir_Kind_For_Loop_Statement
           | Iir_Kind_While_Loop_Statement
           | Iir_Kind_If_Statement
           | Iir_Kind_Elsif =>
            return True;
         when others =>
            return False;
      end case;
   end Has_Start_Location;

   function Has_Right_Paren_Location (K : Iir_Kind) return Boolean is
   begin
      return K = Iir_Kind_Parenthesis_Expression;
   end Has_Right_Paren_Location;

   function Has_End_Location (K : Iir_Kind) return Boolean is
   begin
      case K is
         when Iir_Kind_Protected_Type_Declaration
           | Iir_Kind_Record_Type_Definition
           | Iir_Kind_Protected_Type_Body
           | Iir_Kind_Record_Nature_Definition
           | Iir_Kind_Entity_Declaration
           | Iir_Kind_Configuration_Declaration
           | Iir_Kind_Context_Declaration
           | Iir_Kind_Package_Declaration
           | Iir_Kind_Package_Instantiation_Declaration
           | Iir_Kind_Package_Body
           | Iir_Kind_Architecture_Body
           | Iir_Kind_Component_Declaration
           | Iir_Kind_Function_Body
           | Iir_Kind_Procedure_Body
           | Iir_Kind_Sensitized_Process_Statement
           | Iir_Kind_Process_Statement
           | Iir_Kind_Block_Statement
           | Iir_Kind_If_Generate_Statement
           | Iir_Kind_For_Generate_Statement
           | Iir_Kind_Generate_Statement_Body
           | Iir_Kind_If_Generate_Else_Clause
           | Iir_Kind_Simultaneous_Procedural_Statement
           | Iir_Kind_Simultaneous_Case_Statement
           | Iir_Kind_Simultaneous_If_Statement
           | Iir_Kind_Simultaneous_Elsif
           | Iir_Kind_For_Loop_Statement
           | Iir_Kind_While_Loop_Statement
           | Iir_Kind_Case_Statement
           | Iir_Kind_If_Statement
           | Iir_Kind_Elsif =>
            return True;