Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: tools/dom/scripts/databasebuilder.py

Issue 1022483002: Added more diag info (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed typo Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 import copy 6 import copy
7 import database 7 import database
8 import logging 8 import logging
9 import monitored 9 import monitored
10 import multiprocessing 10 import multiprocessing
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 # Report all dictionaries and their usage. 810 # Report all dictionaries and their usage.
811 self._output_examination() 811 self._output_examination()
812 # Report all interface marked with NoInterfaceObject and their usage. 812 # Report all interface marked with NoInterfaceObject and their usage.
813 self._output_examination(check_dictionaries=False) 813 self._output_examination(check_dictionaries=False)
814 814
815 print '\nKey:' 815 print '\nKey:'
816 print ' (READ-ONLY) - read-only attribute has relationship' 816 print ' (READ-ONLY) - read-only attribute has relationship'
817 print ' (GET/SET) - attribute has relationship' 817 print ' (GET/SET) - attribute has relationship'
818 print ' RETURN - operation\'s returned value has relationship' 818 print ' RETURN - operation\'s returned value has relationship'
819 print ' (ARGUMENT) - operation\'s argument(s) has relationship' 819 print ' (ARGUMENT) - operation\'s argument(s) has relationship'
820 print ''
821 print ' (New) - After dictionary name if constructor(s) exist'
822 print ' (Ops,Props,New) after a NoInterfaceObject name is defined as:'
823 print ' Ops - number of operations for a NoInterfaceObject'
824 print ' Props - number of properties for a NoInterfaceObject'
825 print ' New - T(#) number constructors for a NoInterfaceObject'
826 print ' F no constructors for a NoInterfaceObject'
827 print ' e.g., an interface 5 operations, 3 properties and 2'
828 print ' constructors would display (5,3,T(2))'
820 829
821 print '\n\nExamination Complete\n' 830 print '\n\nExamination Complete\n'
822 831
823 def _output_examination(self, check_dictionaries=True): 832 def _output_examination(self, check_dictionaries=True):
824 # Output diagnostics. First columns is Dictionary or NoInterfaceObject e.g., 833 # Output diagnostics. First columns is Dictionary or NoInterfaceObject e.g.,
825 # | Dictionary | Used In Interface | Usage Operation/Attribute | 834 # | Dictionary | Used In Interface | Usage Operation/Attribute |
826 print '\n\n' 835 print '\n\n'
827 title_bar = ['Dictionary', 'Used In Interface', 'Usage Operation/Attribute'] if check_dictionaries \ 836 title_bar = ['Dictionary', 'Used In Interface', 'Usage Operation/Attribute'] if check_dictionaries \
828 else ['NoInterfaceObject', 'Used In Interface', 'Usage Operation /Attribute'] 837 else ['NoInterfaceObject (Ops,Props,New)', 'Used In Interface', 'Usage Operation/Attribute']
829 self._tabulate_title(title_bar) 838 self._tabulate_title(title_bar)
830 diags = self._diag_dictionaries if check_dictionaries else self._diag_no_int erfaces 839 diags = self._diag_dictionaries if check_dictionaries else self._diag_no_int erfaces
831 for diag in diags: 840 for diag in diags:
832 self._tabluate([diag['dictionary' if check_dictionaries else 'no_interface _object'].id, '', '']) 841 if not(check_dictionaries):
842 interface = diag['no_interface_object']
843 ops_count = len(interface.operations)
844 properties_count = len(interface.attributes)
845 any_constructors = 'Constructor' in interface.ext_attrs
846 constructors = 'T(%s)' % len(interface.ext_attrs['Constructor']) if any_ constructors else 'F'
847 interface_detail = '%s (%s,%s,%s)' % \
848 (diag['no_interface_object'].id,
849 ops_count,
850 properties_count,
851 constructors)
852 self._tabulate([interface_detail, '', ''])
853 else:
854 dictionary = diag['dictionary']
855 any_constructors = 'Constructor' in dictionary.ext_attrs
856 self._tabulate(['%s%s' % (dictionary.id, ' (New)' if any_constructors el se ''), '', ''])
833 for usage in diag['usages']: 857 for usage in diag['usages']:
834 detail = '' 858 detail = ''
835 if 'attribute' in usage: 859 if 'attribute' in usage:
836 attribute_type = 'READ-ONLY' if not usage['argument'] else 'GET/SET' 860 attribute_type = 'READ-ONLY' if not usage['argument'] else 'GET/SET'
837 detail = '(%s) %s' % (attribute_type, usage['attribute']) 861 detail = '(%s) %s' % (attribute_type, usage['attribute'])
838 elif 'operation' in usage: 862 elif 'operation' in usage:
839 detail = '%s %s%s' % ('RETURN' if usage['result'] else '', 863 detail = '%s %s%s' % ('RETURN' if usage['result'] else '',
840 usage['operation'], 864 usage['operation'],
841 '(ARGUMENT)' if usage['argument'] else '') 865 '(ARGUMENT)' if usage['argument'] else '')
842 self._tabluate([None, usage['interface'], detail]) 866 self._tabulate([None, usage['interface'], detail])
843 self._tabulate_break() 867 self._tabulate_break()
844 868
845 # operation_or_attribute either IDLOperation or IDLAttribute if None then 869 # operation_or_attribute either IDLOperation or IDLAttribute if None then
846 # its a constructor (IDLExtAttrFunctionValue). 870 # its a constructor (IDLExtAttrFunctionValue).
847 def _mark_usage(self, interface, operation_or_attribute = None, check_dictiona ries=True): 871 def _mark_usage(self, interface, operation_or_attribute = None, check_dictiona ries=True):
848 for diag in self._diag_dictionaries if check_dictionaries else self._diag_no _interfaces: 872 for diag in self._diag_dictionaries if check_dictionaries else self._diag_no _interfaces:
849 for usage in diag['usages']: 873 for usage in diag['usages']:
850 if not usage['interface']: 874 if not usage['interface']:
851 usage['interface'] = interface.id 875 usage['interface'] = interface.id
852 if isinstance(operation_or_attribute, IDLOperation): 876 if isinstance(operation_or_attribute, IDLOperation):
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 self._no_interfaces_used_types = []; 984 self._no_interfaces_used_types = [];
961 map(self._no_interface_used, node.all(IDLType)) 985 map(self._no_interface_used, node.all(IDLType))
962 self._remember_usage(node, check_dictionaries=False) 986 self._remember_usage(node, check_dictionaries=False)
963 987
964 # Maximum width of each column. 988 # Maximum width of each column.
965 def _TABULATE_WIDTH(self): 989 def _TABULATE_WIDTH(self):
966 return 45 990 return 45
967 991
968 def _tabulate_title(self, row_title): 992 def _tabulate_title(self, row_title):
969 title_separator = "=" * self._TABULATE_WIDTH() 993 title_separator = "=" * self._TABULATE_WIDTH()
970 self._tabluate([title_separator, title_separator, title_separator]) 994 self._tabulate([title_separator, title_separator, title_separator])
971 self._tabluate(row_title) 995 self._tabulate(row_title)
972 self._tabluate([title_separator, title_separator, title_separator]) 996 self._tabulate([title_separator, title_separator, title_separator])
973 997
974 def _tabulate_break(self): 998 def _tabulate_break(self):
975 break_separator = "-" * self._TABULATE_WIDTH() 999 break_separator = "-" * self._TABULATE_WIDTH()
976 self._tabluate([break_separator, break_separator, break_separator]) 1000 self._tabulate([break_separator, break_separator, break_separator])
977 1001
978 def _tabluate(self, columns): 1002 def _tabulate(self, columns):
979 """Tabulate a list of columns for a row. Each item in columns is a column 1003 """Tabulate a list of columns for a row. Each item in columns is a column
980 value each column will be padded up to _TABULATE_WIDTH. Each 1004 value each column will be padded up to _TABULATE_WIDTH. Each
981 column starts/ends with a vertical bar '|' the format a row: 1005 column starts/ends with a vertical bar '|' the format a row:
982 1006
983 | columns[0] | columns[1] | columns[2] | ... | 1007 | columns[0] | columns[1] | columns[2] | ... |
984 """ 1008 """
985 if len(columns) > 0: 1009 if len(columns) > 0:
986 for column in columns: 1010 for column in columns:
987 value = '' if not column else column 1011 value = '' if not column else column
988 sys.stdout.write('|{0:^{1}}'.format(value, self._TABULATE_WIDTH())) 1012 sys.stdout.write('|{0:^{1}}'.format(value, self._TABULATE_WIDTH()))
989 else: 1013 else:
990 sys.stdout.write('|{0:^{1}}'.format('', self._TABULATE_WIDTH())) 1014 sys.stdout.write('|{0:^{1}}'.format('', self._TABULATE_WIDTH()))
991 1015
992 sys.stdout.write('|\n') 1016 sys.stdout.write('|\n')
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698