aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sinput-c.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2010-06-22 15:26:32 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2010-06-22 15:26:32 +0200
commit9e9df9da7b83a6591d43c5298958dd20db3c6e73 (patch)
treeca47323ccb53d850a727cc7979b3e8dece6d51fc /gcc/ada/sinput-c.adb
parentfa5aa8353877421229443a04c4d9711fb2dd4aa5 (diff)
downloadgcc-9e9df9da7b83a6591d43c5298958dd20db3c6e73.zip
gcc-9e9df9da7b83a6591d43c5298958dd20db3c6e73.tar.gz
gcc-9e9df9da7b83a6591d43c5298958dd20db3c6e73.tar.bz2
[multiple changes]
2010-06-22 Arnaud Charlet <charlet@adacore.com> * fmap.adb, opt.ads, osint.adb, osint.ads, output.ads, scng.adb, sinput-c.adb, switch-m.ads, tree_io.ads: Use simpler form of Warnings Off/On. 2010-06-22 Thomas Quinot <quinot@adacore.com> * einfo.ads: Minor reformatting. 2010-06-22 Javier Miranda <miranda@adacore.com> * exp_disp.adb (Expand_Interface_Thunk): Do not generate thunk of eliminated primitives. (Make_DT): Avoid referencing eliminated primitives. (Register_Primitive): Do not register eliminated primitives in the dispatch table. Required to add this functionality when the program is compiled without static dispatch tables (-gnatd.t) From-SVN: r161183
Diffstat (limited to 'gcc/ada/sinput-c.adb')
-rw-r--r--gcc/ada/sinput-c.adb7
1 files changed, 3 insertions, 4 deletions
diff --git a/gcc/ada/sinput-c.adb b/gcc/ada/sinput-c.adb
index 3c7a882..aebdcac 100644
--- a/gcc/ada/sinput-c.adb
+++ b/gcc/ada/sinput-c.adb
@@ -23,16 +23,15 @@
-- --
------------------------------------------------------------------------------
--- This unit is used by gnatcoll
-pragma Warnings (Off, "*is an internal GNAT unit");
-pragma Warnings (Off, "*use * instead");
-
with Opt; use Opt;
with System; use System;
with Ada.Unchecked_Conversion;
+pragma Warnings (Off);
+-- This package is used also by gnatcoll
with System.OS_Lib; use System.OS_Lib;
+pragma Warnings (On);
package body Sinput.C is
iquefilenames'>uniquefilenames Unnamed repository; edit this file 'description' to name the repository.root
aboutsummaryrefslogtreecommitdiff
path: root/docs/refman/generatorprint.py
blob: d805296030bde200430777acc4b07dd586970c73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Copyright 2021 The Meson development team

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

#     http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from .generatorbase import GeneratorBase
from .model import ReferenceManual, Object, Function, DataTypeInfo, Type, ObjectType

from mesonbuild import mlog
import typing as T

def my_nested() -> T.ContextManager[None]:
    prefix = '|' * mlog.get_log_depth()
    return mlog.nested(prefix)

class GeneratorPrint(GeneratorBase):
    def _types_to_string(self, typ: Type) -> str:
        def _data_type_to_str(dt: DataTypeInfo) -> str:
            if dt.holds:
                return f'{dt.data_type.name}[{self._types_to_string(dt.holds)}]'
            return dt.data_type.name
        return ' | '.join([_data_type_to_str(x) for x in typ.resolved])

    def _generate_function(self, func: Function) -> None:
        mlog.log()
        mlog.log('Function', mlog.bold(func.name))
        with my_nested():
            desc = func.description
            if '\n' in desc:
                desc = desc[:desc.index('\n')]
            mlog.log('Description:', mlog.bold(desc))
            mlog.log('Return type:', mlog.bold(self._types_to_string(func.returns)))
            mlog.log('Pos args:   ', mlog.bold(str([x.name for x in func.posargs])))
            mlog.log('Opt args:   ', mlog.bold(str([x.name for x in func.optargs])))
            mlog.log('Varargs:    ', mlog.bold(func.varargs.name if func.varargs is not None else 'null'))
            mlog.log('Kwargs:     ', mlog.bold(str(list(func.kwargs.keys()))))

    def _generate_object(self, obj: Object) -> None:
        tags = []
        tags += [{
            ObjectType.ELEMENTARY: mlog.yellow('[elementary]'),
            ObjectType.BUILTIN: mlog.green('[builtin]'),
            ObjectType.MODULE: mlog.blue('[module]'),
            ObjectType.RETURNED: mlog.cyan('[returned]'),
        }[obj.obj_type]]
        if obj.is_container:
            tags += [mlog.red('[container]')]
        mlog.log()
        mlog.log('Object', mlog.bold(obj.name), *tags)
        with my_nested():
            desc = obj.description
            if '\n' in desc:
                desc = desc[:desc.index('\n')]
            mlog.log('Description:', mlog.bold(desc))
            mlog.log('Returned by:', mlog.bold(str([x.name for x in obj.returned_by])))
            mlog.log('Methods:')
            with my_nested():
                for m in obj.methods:
                    self._generate_function(m)

    def generate(self) -> None:
        mlog.log('\n\n', mlog.bold('=== Functions ==='), '\n')
        for f in self.functions:
            self._generate_function(f)
        mlog.log('\n\n', mlog.bold('=== Elementary ==='), '\n')
        for obj in self.elementary:
            self._generate_object(obj)
        mlog.log('\n\n', mlog.bold('=== Builtins ==='), '\n')
        for obj in self.builtins:
            self._generate_object(obj)
        mlog.log('\n\n', mlog.bold('=== Returned objects ==='), '\n')
        for obj in self.returned:
            self._generate_object(obj)
        mlog.log('\n\n', mlog.bold('=== Modules ==='), '\n')
        for obj in self.modules:
            self._generate_object(obj)
            for mod_obj in self.extract_returned_by_module(obj):
                self._generate_object(mod_obj)