1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- R E P I N F O - I N P U T --
9 -- Copyright (C) 2018-2020, Free Software Foundation, Inc. --
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. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 ------------------------------------------------------------------------------
26 -- This package provides an alternate way of populating the internal tables
27 -- of Repinfo from a JSON input rather than the binary blob of the tree file.
28 -- Note that this is an additive mechanism, i.e. nothing is destroyed in the
29 -- internal state of the unit when it is used.
31 -- The first step is to feed the unit with a JSON stream of a specified format
32 -- (see the spec of Repinfo for its description) by means of Read_JSON_Stream.
33 -- Then, for each entity whose representation information is present in the
34 -- JSON stream, the appropriate Get_JSON_* routines can be invoked to override
35 -- the eponymous fields of the entity in the tree.
37 package Repinfo
.Input
is
39 function Get_JSON_Esize
(Name
: String) return Node_Ref_Or_Val
;
40 -- Returns the Esize value of the entity specified by Name, which is not
41 -- the component of a record type, or else No_Uint if no representation
42 -- information was supplied for the entity. Name is the full qualified name
43 -- of the entity in lower case letters.
45 function Get_JSON_RM_Size
(Name
: String) return Node_Ref_Or_Val
;
46 -- Likewise for the RM_Size
48 function Get_JSON_Component_Size
(Name
: String) return Node_Ref_Or_Val
;
49 -- Likewise for the Component_Size of an array type
51 function Get_JSON_Component_Bit_Offset
53 Record_Name
: String) return Node_Ref_Or_Val
;
54 -- Returns the Component_Bit_Offset of the component specified by Name,
55 -- which is declared in the record type specified by Record_Name, or else
56 -- No_Uint if no representation information was supplied for the component.
57 -- Name is the unqualified name of the component whereas Record_Name is the
58 -- full qualified name of the record type, both in lower case letters.
60 function Get_JSON_Esize
62 Record_Name
: String) return Node_Ref_Or_Val
;
63 -- Likewise for the Esize
65 Invalid_JSON_Stream
: exception;
66 -- Raised if a format error is detected in the JSON stream
68 procedure Read_JSON_Stream
(Text
: Text_Buffer
; File_Name
: String);
69 -- Reads a JSON stream and populates internal tables from it. File_Name is
70 -- only used in error messages issued by the JSON parser.