-- Common types. -- Copyright (C) 2002 - 2015 Tristan Gingold -- -- GHDL 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, or (at your option) any later -- version. -- -- GHDL 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 GHDL; see the file COPYING. If not, write to the Free -- Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. with Interfaces; with System; with Ada.Unchecked_Conversion; package Types is pragma Preelaborate (Types); -- A tri state type. type Tri_State_Type is (Unknown, False, True); -- 32 bits integer. type Int32 is range -2**31 .. 2**31 - 1; for Int32'Size use 32; subtype Nat32 is Int32 range 0 .. Int32'Last; subtype Pos32 is Nat32 range 1 .. Nat32'Last; subtype Nat8 is Nat32 range 0 .. 255; type Uns32 is new Interfaces.Unsigned_32; type Uns64 is new Interfaces.Unsigned_64; type Fp64 is new Interfaces.IEEE_Float_64; -- iir_int32 is aimed at containing integer literal values. type Iir_Int32 is new Interfaces.Integer_32; -- iir_int64 is aimed at containing units values. type Iir_Int64 is new Interfaces.Integer_64; -- iir_fp64 is aimed at containing floating point values. subtype Iir_Fp64 is Fp64; -- iir_index32 is aimed at containing an array index. type Iir_Index32 is new Nat32; -- Useful types. type String_Acc is access String; type String_Cst is access constant String; type String_Acc_Array is array (Natural range <>) of String_Acc; -- Fat strings, for compatibility with C. type Thin_String_Ptr is access String (Positive); pragma Convention (C, Thin_String_Ptr); function To_Thin_String_Ptr is new Ada.Unchecked_Conversion (System.Address, Thin_String_Ptr); -- The name table is defined in Name_Table package. This is an hash table -- that associate a uniq Name_Id to a string. Name_Id are allocated in -- increasing numbers, so it is possible to create a parallel table -- indexed on Name_Id to associate additional data to the names. type Name_Id is new Nat32; -- Null entry in the name table. -- It is sure that this entry is never allocated. Null_Identifier: constant Name_Id := 0; -- A String8_Id represents a string stored in a dedicated table. Contrary -- to Name_Id, String8 aren't uniq: two different String8_Id can correspond -- to a same String. The purpose of an integer number for string is to -- have a 32 bit type to represent a string (contrary to pointers that -- could be 32 or 64 b