145
|
1 ------------------------------------------------------------------------------
|
|
2 -- --
|
|
3 -- GNAT COMPILER COMPONENTS --
|
|
4 -- --
|
|
5 -- R E P I N F O - I N P U T --
|
|
6 -- --
|
|
7 -- S p e c --
|
|
8 -- --
|
|
9 -- Copyright (C) 2018-2019, Free Software Foundation, Inc. --
|
|
10 -- --
|
|
11 -- GNAT is free software; you can redistribute it and/or modify it under --
|
|
12 -- terms of the GNU General Public License as published by the Free Soft- --
|
|
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
|
|
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
|
|
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
|
|
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
|
|
17 -- --
|
|
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
|
|
19 -- additional permissions described in the GCC Runtime Library Exception, --
|
|
20 -- version 3.1, as published by the Free Software Foundation. --
|
|
21 -- --
|
|
22 -- You should have received a copy of the GNU General Public License and --
|
|
23 -- a copy of the GCC Runtime Library Exception along with this program; --
|
|
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
|
|
25 -- <http://www.gnu.org/licenses/>. --
|
|
26 -- --
|
|
27 -- GNAT was originally developed by the GNAT team at New York University. --
|
|
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
|
|
29 -- --
|
|
30 ------------------------------------------------------------------------------
|
|
31
|
|
32 -- This package provides an alternate way of populating the internal tables
|
|
33 -- of Repinfo from a JSON input rather than the binary blob of the tree file.
|
|
34 -- Note that this is an additive mechanism, i.e. nothing is destroyed in the
|
|
35 -- internal state of the unit when it is used.
|
|
36
|
|
37 -- The first step is to feed the unit with a JSON stream of a specified format
|
|
38 -- (see the spec of Repinfo for its description) by means of Read_JSON_Stream.
|
|
39 -- Then, for each entity whose representation information is present in the
|
|
40 -- JSON stream, the appropriate Get_JSON_* routines can be invoked to override
|
|
41 -- the eponymous fields of the entity in the tree.
|
|
42
|
|
43 package Repinfo.Input is
|
|
44
|
|
45 function Get_JSON_Esize (Name : String) return Node_Ref_Or_Val;
|
|
46 -- Returns the Esize value of the entity specified by Name, which is not
|
|
47 -- the component of a record type, or else No_Uint if no representation
|
|
48 -- information was supplied for the entity. Name is the full qualified name
|
|
49 -- of the entity in lower case letters.
|
|
50
|
|
51 function Get_JSON_RM_Size (Name : String) return Node_Ref_Or_Val;
|
|
52 -- Likewise for the RM_Size
|
|
53
|
|
54 function Get_JSON_Component_Size (Name : String) return Node_Ref_Or_Val;
|
|
55 -- Likewise for the Component_Size of an array type
|
|
56
|
|
57 function Get_JSON_Component_Bit_Offset
|
|
58 (Name : String;
|
|
59 Record_Name : String) return Node_Ref_Or_Val;
|
|
60 -- Returns the Component_Bit_Offset of the component specified by Name,
|
|
61 -- which is declared in the record type specified by Record_Name, or else
|
|
62 -- No_Uint if no representation information was supplied for the component.
|
|
63 -- Name is the unqualified name of the component whereas Record_Name is the
|
|
64 -- full qualified name of the record type, both in lower case letters.
|
|
65
|
|
66 function Get_JSON_Esize
|
|
67 (Name : String;
|
|
68 Record_Name : String) return Node_Ref_Or_Val;
|
|
69 -- Likewise for the Esize
|
|
70
|
|
71 Invalid_JSON_Stream : exception;
|
|
72 -- Raised if a format error is detected in the JSON stream
|
|
73
|
|
74 procedure Read_JSON_Stream (Text : Text_Buffer; File_Name : String);
|
|
75 -- Reads a JSON stream and populates internal tables from it. File_Name is
|
|
76 -- only used in error messages issued by the JSON parser.
|
|
77
|
|
78 end Repinfo.Input;
|