"Upgrade" gtk_combo to 'E'.
[metze/wireshark/wip.git] / tools / checkAPIs.pl
1 #!/usr/bin/env perl
2
3 #
4 # Copyright 2006, Jeff Morriss <jeff.morriss[AT]ulticom.com>
5 #
6 # A simple tool to check source code for function calls that should not
7 # be called by Wireshark code and to perform certain other checks.
8 #
9 # Usage:
10 # checkAPIs.pl [-M] [-g group1] [-g group2] [-s summary-group1] [-s summary-group2] [--nocheck-value-string-array-null-termination] file1 file2 ...
11 #
12 # $Id$
13 #
14 # Wireshark - Network traffic analyzer
15 # By Gerald Combs <gerald@wireshark.org>
16 # Copyright 1998 Gerald Combs
17 #
18 # This program is free software; you can redistribute it and/or
19 # modify it under the terms of the GNU General Public License
20 # as published by the Free Software Foundation; either version 2
21 # of the License, or (at your option) any later version.
22 #
23 # This program is distributed in the hope that it will be useful,
24 # but WITHOUT ANY WARRANTY; without even the implied warranty of
25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26 # GNU General Public License for more details.
27 #
28 # You should have received a copy of the GNU General Public License
29 # along with this program; if not, write to the Free Software
30 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 #
32
33 use strict;
34 use Getopt::Long;
35
36 my %APIs = (
37         # API groups.
38         # Group name, e.g. 'prohibited'
39         # '<name>' => {
40         #   'count_errors'      => 1,                     # 1 if these are errors, 0 if warnings
41         #   'functions'         => [ 'f1', 'f2', ...],    # Function array
42         #   'function-counts'   => {'f1',0, 'f2',0, ...}, # Function Counts hash (initialized in the code)
43         # }
44         #
45         # APIs that MUST NOT be used in Wireshark
46         'prohibited' => { 'count_errors' => 1, 'functions' => [
47                 # Memory-unsafe APIs
48                 # Use something that won't overwrite the end of your buffer instead
49                 # of these:
50                 'gets',
51                 'sprintf',
52                 'g_sprintf',
53                 'vsprintf',
54                 'g_vsprintf',
55                 'strcpy',
56                 'strncpy',
57                 'strcat',
58                 'strncat',
59                 'cftime',
60                 'ascftime',
61                 ### non-portable APIs
62                 # use glib (g_*) versions instead of these:
63                 'ntohl',
64                 'ntohs',
65                 'htonl',
66                 'htons',
67                 'strdup',
68                 'strndup',
69                 # Windows doesn't have this; use g_ascii_strtoull() instead
70                 'strtoull',
71                 ### non-ANSI C
72                 # use memset, memcpy, memcmp instead of these:
73                 'bzero',
74                 'bcopy',
75                 'bcmp',
76                 # use ep_*, se_*, or g_* functions instead of these:
77                 # (One thing to be aware of is that space allocated with malloc()
78                 # may not be freeable--at least on Windows--with g_free() and
79                 # vice-versa.)
80                 'malloc',
81                 'calloc',
82                 'realloc',
83                 'valloc',
84                 'free',
85                 'cfree',
86                 # Locale-unsafe APIs
87                 # These may have unexpected behaviors in some locales (e.g.,
88                 # "I" isn't always the upper-case form of "i", and "i" isn't
89                 # always the lower-case form of "I").  Use the g_ascii_* version
90                 # instead.
91                 'strcasecmp',
92                 'strncasecmp',
93                 'g_strcasecmp',
94                 'g_strncasecmp',
95                 'g_strup',
96                 'g_strdown',
97                 'g_string_up',
98                 'g_string_down',
99                 # Use the ws_* version of these:
100                 # (Necessary because on Windows we use UTF8 for throughout the code
101                 # so we must tweak that to UTF16 before operating on the file.  Code
102                 # using these functions will work unless the file/path name contains
103                 # non-ASCII chars.)
104                 'open',
105                 'rename',
106                 'mkdir',
107                 'stat',
108                 'unlink',
109                 'remove',
110                 'fopen',
111                 'freopen',
112                 # Misc
113                 'tmpnam'        # use mkstemp
114                 ] },
115
116         # APIs that SHOULD NOT be used in Wireshark (any more)
117         'deprecated' => { 'count_errors' => 1, 'functions' => [
118                 'perror',                                       # Use strerror() and report messages in whatever
119                                                                 #  fashion is appropriate for the code in question.
120                 'ctime',                                        # Use abs_time_secs_to_str()
121                 'dissector_add',                                # Use dissector_add_uint()
122                 'dissector_change',                             # Use dissector_change_uint()
123                 'dissector_delete',                             # Use dissector_delete_uint()
124                 'dissector_get_port_handle',                    # Use dissector_get_uint_handle()
125                 'dissector_reset',                              # Use dissector_reset_uint()
126                 'dissector_try_port',                           # Use dissector_try_uint()
127                 'dissector_try_port_new',                       # Use dissector_try_uint_new()
128                 'next_tvb_add_port',                            # Use next_tvb_add_uint() (and a matching change
129                                                                 #  of NTVB_PORT -> NTVB_UINT)
130
131                 ### Deprecated GLib/GObject functions/macros
132                 # (The list is based upon the GLib 2.24.1 & GObject 2.24.1 documentation;
133                 #  Some of the entries are commented out since they are currently
134                 #  being used in Wireshark and since the replacement functionality
135                 #  is not available in all the GLib versions that Wireshark
136                 #  currently supports (ie: versions starting with GLib 2.4)).
137                 'G_ALLOC_AND_FREE',
138                 'G_ALLOC_ONLY',
139                 'g_allocator_free',                             # "use slice allocator" (avail since 2.10,2.14)
140                 'g_allocator_new',                              # "use slice allocator" (avail since 2.10,2.14)
141                 'g_async_queue_ref_unlocked',                   # g_async_queue_ref()   (OK since 2.8)
142                 'g_async_queue_unref_and_unlock',               # g_async_queue_unref() (OK since 2.8)
143                 'g_basename',
144                 'g_cache_value_foreach',                        # g_cache_key_foreach()
145                 'g_date_set_time',                              # g_date_set_time_t (avail since 2.10)
146                 'g_dirname',
147                 'G_GNUC_FUNCTION',
148                 'G_GNUC_PRETTY_FUNCTION',
149                 'g_hash_table_freeze',
150                 'g_hash_table_thaw',
151                 'G_HAVE_GINT64',
152                 'g_io_channel_close',
153                 'g_io_channel_read',
154                 'g_io_channel_seek',
155                 'g_io_channel_write',
156                 'g_list_pop_allocator',                         # "does nothing since 2.10"
157                 'g_list_push_allocator',                        # "does nothing since 2.10"
158                 'g_main_destroy',
159                 'g_main_is_running',
160                 'g_main_iteration',
161                 'g_main_new',
162                 'g_main_pending',
163                 'g_main_quit',
164                 'g_main_run',
165                 'g_main_set_poll_func',
166                 'g_node_pop_allocator',                         # "does nothing since 2.10"
167                 'g_node_push_allocator',                        # "does nothing since 2.10"
168                 'g_scanner_add_symbol',
169                 'g_scanner_remove_symbol',
170                 'g_scanner_foreach_symbol',
171                 'g_scanner_freeze_symbol_table',
172                 'g_scanner_thaw_symbol_table',
173                 'g_slist_pop_allocator',                        # "does nothing since 2.10"
174                 'g_slist_push_allocator',                       # "does nothing since 2.10"
175                 'g_string_sprintf',                             # use g_string_printf() instead
176                 'g_string_sprintfa',                            # use g_string_append_printf instead
177                 'g_tree_traverse',
178                 'g_value_set_boxed_take_ownership',
179                 'g_value_set_object_take_ownership',
180                 'g_value_set_param_take_ownership',
181                 'g_value_set_string_take_ownership',
182                 'G_WIN32_DLLMAIN_FOR_DLL_NAME',
183                 'g_win32_get_package_installation_directory',
184                 'g_win32_get_package_installation_subdirectory',
185 ##
186 ## Following Deprecated as of GLib 2.10; to be replaced only when Wireshark requires GLib 2.10 or later
187 ## Note: Only the commented out items are currently used by Wireshark
188 ### GMemChunks should used *only* with GLib < 2.10.
189 ###  There's an issue wherein GLib >= 2.10 g_mem_chunk_destroy doesn't actually free memory thus
190 ###   leading to memory leaks.
191 ###  So: either replace GMemChunk use with something else altogether
192 ###      or use GMemChunks for GLib < 2.10 and GSlice (or whatever) for newer GLibs.
193 ## 2.10         'g_mem_chunk_alloc',                            # "use slice allocator" (avail since 2.10)
194 ## 2.10         'g_mem_chunk_alloc0',                           # "use slice allocator" (avail since 2.10)
195                         'g_mem_chunk_clean',                            # "use slice allocator" (avail since 2.10)
196 ## 2.10         'g_mem_chunk_create',                           # "use slice allocator" (avail since 2.10)
197 ## 2.10         'g_mem_chunk_destroy',                          # "use slice allocator" (avail since 2.10)
198 ## 2.10         'g_mem_chunk_free',                                     # "use slice allocator" (avail since 2.10)
199                         'g_mem_chunk_info',                                     # "use slice allocator" (avail since 2.10)
200 ## 2.10         'g_mem_chunk_new',                                      # "use slice allocator" (avail since 2.10)
201                         'g_mem_chunk_print',                            # "use slice allocator" (avail since 2.10)
202                         'g_mem_chunk_reset',                            # "use slice allocator" (avail since 2.10)
203                         'g_blow_chunks',                                        # "use slice allocator" (avail since 2.10,2.14)
204 ## 2.10         'g_chunk_free',                                         # g_slice_free (avail since 2.10)
205 ## 2.10         'g_chunk_new',                                          # g_slice_new  (avail since 2.10)
206                         'g_chunk_new0',                                         # g_slice_new0 (avail since 2.10)
207 ###
208 ## Following Deprecated as of GLib 2.22;
209 ## Note: Not currently used by Wireshark
210                 'g_mapped_file_free',                           # [as of 2.22: use g_map_file_unref]
211                 ] },
212
213         # APIs that make the program exit. Dissectors shouldn't call these
214         'abort' => { 'count_errors' => 1, 'functions' => [
215                 'abort',
216                 'assert',
217                 'assert_perror',
218                 'exit',
219                 'g_assert',
220                 'g_error',
221                 ] },
222
223         # APIs that print to the terminal. Dissectors shouldn't call these
224         'termoutput' => { 'count_errors' => 0, 'functions' => [
225                 'printf',
226                 'g_warning',
227                 ] },
228
229         # Deprecated GTK APIs
230         #  which SHOULD NOT be used in Wireshark (any more).
231         #  (Filled in from 'E' entries in %deprecatedGtkFunctions below)
232         'deprecated-gtk' => { 'count_errors' => 1, 'functions' => [
233                 ] },
234
235         # Deprecated GTK APIs yet to be replaced
236         #  (Filled in from 'W' entries in %deprecatedGtkFunctions below)
237         'deprecated-gtk-todo' => { 'count_errors' => 0, 'functions' => [
238                 ] },
239
240 );
241
242 # Deprecated GTK+ functions/macros with (E)rror or (W)arning flag:
243 # (The list is based upon the GTK+ 2.20.1 documentation; Some of
244 #  the entries are commented out since they are currently
245 #  being used in Wireshark and since the replacement functionality
246 #  is not available in all the GTK+ versions that Wireshark
247 #  currently supports (ie: versions starting with GTK+ 2.4).
248 # E: There should be no current Wireshark use so Error if seen;
249 # W: Not all Wireshark use yet fixed so Warn if seen; (Change to E as fixed)
250 my %deprecatedGtkFunctions = (
251                 'gtk_about_dialog_get_name',                    'E',
252                 'gtk_about_dialog_set_name',                    'E',
253                 'gtk_accel_group_ref',                          'E',
254                 'gtk_accel_group_unref',                        'E',
255                 'gtk_action_block_activate_from',               'E', # since 2.16
256                 'gtk_action_connect_proxy',                     'E', # since 2.16: use gtk_activatable_set_related_action() (as of 2.16)
257                 'gtk_action_disconnect_proxy',                  'E', # since 2.16: use gtk_activatable_set_related_action() (as of 2.16)
258                 'gtk_action_unblock_activate_from',             'E', # since 2.16
259                 'gtk_binding_entry_add',                        'E',
260                 'gtk_binding_entry_add_signall',                'E',
261                 'gtk_binding_entry_clear',                      'E',
262                 'gtk_binding_parse_binding',                    'E',
263                 'gtk_box_pack_end_defaults',                    'E',
264                 'gtk_box_pack_start_defaults',                  'E',
265                 'gtk_button_box_get_child_ipadding',            'E',
266                 'gtk_button_box_get_child_size',                'E',
267                 'gtk_button_box_get_spacing',                   'E',
268                 'gtk_button_box_set_child_ipadding',            'E', # style properties child-internal-pad-x/-y
269                 'gtk_button_box_set_child_size',                'E', # style properties child-min-width/-height
270                 'gtk_button_box_set_spacing',                   'E', # gtk_box_set_spacing [==]
271                 'gtk_button_enter',                             'E', # since 2.20
272                 'gtk_button_leave',                             'E', # since 2.20
273                 'gtk_button_pressed',                           'E', # since 2.20
274                 'gtk_button_released',                          'E', # since 2.20
275                 'gtk_calendar_display_options',                 'E',
276                 'gtk_calendar_freeze',                          'E',
277                 'gtk_calendar_thaw',                            'E',
278                 'GTK_CELL_PIXMAP',                              'E', # GtkTreeView (& related) ...
279                 'GTK_CELL_PIXTEXT',                             'E',
280                 'gtk_cell_renderer_editing_canceled',           'E',
281                 'GTK_CELL_TEXT',                                'W',
282                 'GTK_CELL_WIDGET',                              'E',
283                 'GTK_CHECK_CAST',                               'E', # G_TYPE_CHECK_INSTANCE_CAST [==]
284                 'GTK_CHECK_CLASS_CAST',                         'E', # G_TYPE_CHECK_CLASS_CAST [==]
285                 'GTK_CHECK_CLASS_TYPE',                         'E', # G_TYPE_CHECK_CLASS_TYPE [==]
286                 'GTK_CHECK_GET_CLASS',                          'E', # G_TYPE_INSTANCE_GET_CLASS [==]
287                 'gtk_check_menu_item_set_show_toggle',          'E', # Does nothing; remove; [show_toggle is always TRUE]
288                 'gtk_check_menu_item_set_state',                'E',
289                 'GTK_CHECK_TYPE',                                               'E', # G_TYPE_CHECK_INSTANCE_TYPE [==]
290                 'GTK_CLASS_NAME',                                               'E',
291                 'GTK_CLASS_TYPE',                                               'E',
292                 'GTK_CLIST_ADD_MODE',                                   'E', # GtkTreeView (& related) ...
293                 'gtk_clist_append',                                             'W',
294                 'GTK_CLIST_AUTO_RESIZE_BLOCKED',                'E',
295                 'GTK_CLIST_AUTO_SORT',                                  'E',
296                 'gtk_clist_clear',                                              'W',
297                 'gtk_clist_column_title_active',                'E',
298                 'gtk_clist_column_title_passive',               'E',
299                 'gtk_clist_column_titles_active',               'E',
300                 'gtk_clist_column_titles_hide',                 'E',
301                 'gtk_clist_column_titles_passive',              'E',
302                 'gtk_clist_column_titles_show',                 'E',
303                 'gtk_clist_columns_autosize',                   'E',
304                 'GTK_CLIST_DRAW_DRAG_LINE',                             'E',
305                 'GTK_CLIST_DRAW_DRAG_RECT',                             'E',
306                 'gtk_clist_find_row_from_data',                 'E',
307                 'GTK_CLIST_FLAGS',                                              'E',
308                 'gtk_clist_freeze',                                             'E',
309                 'gtk_clist_get_cell_style',                             'E',
310                 'gtk_clist_get_cell_type',                              'E',
311                 'gtk_clist_get_column_title',                   'E',
312                 'gtk_clist_get_column_widget',                  'E',
313                 'gtk_clist_get_hadjustment',                    'E',
314                 'gtk_clist_get_pixmap',                                 'E',
315                 'gtk_clist_get_pixtext',                                'E',
316                 'gtk_clist_get_row_data',                               'E',
317                 'gtk_clist_get_row_style',                              'E',
318                 'gtk_clist_get_selectable',                             'E',
319                 'gtk_clist_get_selection_info',                 'E',
320                 'gtk_clist_get_text',                                   'E',
321                 'gtk_clist_get_vadjustment',                    'E',
322                 'GTK_CLIST_IN_DRAG',                                    'E',
323                 'gtk_clist_insert',                                             'E',
324                 'gtk_clist_moveto',                                             'E',
325                 'gtk_clist_new',                                                'E',
326                 'gtk_clist_new_with_titles',                    'E',
327                 'gtk_clist_optimal_column_width',               'E',
328                 'gtk_clist_prepend',                                    'E',
329                 'gtk_clist_remove',                                             'E',
330                 'GTK_CLIST_REORDERABLE',                                'E',
331                 'GTK_CLIST_ROW',                                                'E',
332                 'GTK_CLIST_ROW_HEIGHT_SET',                             'E',
333                 'gtk_clist_row_is_visible',                             'E',
334                 'gtk_clist_row_move',                                   'E',
335                 'gtk_clist_select_all',                                 'E',
336                 'gtk_clist_select_row',                                 'E',
337                 'gtk_clist_set_auto_sort',                              'E',
338                 'gtk_clist_set_background',                             'E',
339                 'gtk_clist_set_button_actions',                 'E',
340                 'gtk_clist_set_cell_style',                             'E',
341                 'gtk_clist_set_column_auto_resize',             'E',
342                 'gtk_clist_set_column_justification',   'E',
343                 'gtk_clist_set_column_max_width',               'E',
344                 'gtk_clist_set_column_min_width',               'E',
345                 'gtk_clist_set_column_resizeable',              'E',
346                 'gtk_clist_set_column_title',                   'E',
347                 'gtk_clist_set_column_visibility',              'E',
348                 'gtk_clist_set_column_widget',                  'E',
349                 'gtk_clist_set_column_width',                   'E',
350                 'gtk_clist_set_compare_func',                   'E',
351                 'GTK_CLIST_SET_FLAG',                                   'E',
352                 'gtk_clist_set_foreground',                             'E',
353                 'gtk_clist_set_hadjustment',                    'E',
354                 'gtk_clist_set_pixmap',                                 'E',
355                 'gtk_clist_set_pixtext',                                'E',
356                 'gtk_clist_set_reorderable',                    'E',
357                 'gtk_clist_set_row_data',                               'E',
358                 'gtk_clist_set_row_data_full',                  'E',
359                 'gtk_clist_set_row_height',                             'E',
360                 'gtk_clist_set_row_style',                              'E',
361                 'gtk_clist_set_selectable',                             'E',
362                 'gtk_clist_set_selection_mode',                 'E',
363                 'gtk_clist_set_shadow_type',                    'E',
364                 'gtk_clist_set_shift',                                  'E',
365                 'gtk_clist_set_sort_column',                    'E',
366                 'gtk_clist_set_sort_type',                              'E',
367                 'gtk_clist_set_text',                                   'E',
368                 'gtk_clist_set_use_drag_icons',                 'E',
369                 'gtk_clist_set_vadjustment',                    'E',
370                 'GTK_CLIST_SHOW_TITLES',                                'E',
371                 'gtk_clist_sort',                                               'E',
372                 'gtk_clist_swap_rows',                                  'E',
373                 'gtk_clist_thaw',                                               'E',
374                 'gtk_clist_undo_selection',                             'E',
375                 'gtk_clist_unselect_all',                               'E',
376                 'gtk_clist_unselect_row',                               'E',
377                 'GTK_CLIST_UNSET_FLAG',                                 'E',
378                 'GTK_CLIST_USE_DRAG_ICONS',                             'E',
379                 'gtk_color_selection_get_color',                'E',
380                 'gtk_color_selection_set_change_palette_hook',  'E',
381                 'gtk_color_selection_set_color',                        'E',
382                 'gtk_color_selection_set_update_policy',        'E',
383                 'gtk_combo_disable_activate',                   'E', # GtkComboBoxEntry ... (avail since 2.4/2.6/2.10/2.14)
384                 'gtk_combo_new',                                                'E',
385                 'gtk_combo_set_case_sensitive',                 'E',
386                 'gtk_combo_set_item_string',                    'E',
387                 'gtk_combo_set_popdown_strings',                'E',
388                 'gtk_combo_set_use_arrows',                             'E',
389                 'gtk_combo_set_use_arrows_always',              'E',
390                 'gtk_combo_set_value_in_list',                  'E',
391                 'gtk_container_border_width',                   'E', # gtk_container_set_border_width [==]
392                 'gtk_container_children',                               'E', # gtk_container_get_children [==]
393                 'gtk_container_foreach_full',                   'E',
394                 'gtk_ctree_collapse',                                   'E',
395                 'gtk_ctree_collapse_recursive',                 'E',
396                 'gtk_ctree_collapse_to_depth',                  'E',
397                 'gtk_ctree_expand',                                             'E',
398                 'gtk_ctree_expand_recursive',                   'E',
399                 'gtk_ctree_expand_to_depth',                    'E',
400                 'gtk_ctree_export_to_gnode',                    'E',
401                 'gtk_ctree_find',                                               'E',
402                 'gtk_ctree_find_all_by_row_data',               'E',
403                 'gtk_ctree_find_all_by_row_data_custom','E',
404                 'gtk_ctree_find_by_row_data',                   'E',
405                 'gtk_ctree_find_by_row_data_custom',    'E',
406                 'gtk_ctree_find_node_ptr',                              'E',
407                 'GTK_CTREE_FUNC',                                               'E',
408                 'gtk_ctree_get_node_info',                              'E',
409                 'gtk_ctree_insert_gnode',                               'E',
410                 'gtk_ctree_insert_node',                                'E',
411                 'gtk_ctree_is_ancestor',                                'E',
412                 'gtk_ctree_is_hot_spot',                                'E',
413                 'gtk_ctree_is_viewable',                                'E',
414                 'gtk_ctree_last',                                               'E',
415                 'gtk_ctree_move',                                               'E',
416                 'gtk_ctree_new',                                                'E',
417                 'gtk_ctree_new_with_titles',                    'E',
418                 'GTK_CTREE_NODE',                                               'E',
419                 'gtk_ctree_node_get_cell_style',                'E',
420                 'gtk_ctree_node_get_cell_type',                 'E',
421                 'gtk_ctree_node_get_pixmap',                    'E',
422                 'gtk_ctree_node_get_pixtext',                   'E',
423                 'gtk_ctree_node_get_row_data',                  'E',
424                 'gtk_ctree_node_get_row_style',                 'E',
425                 'gtk_ctree_node_get_selectable',                'E',
426                 'gtk_ctree_node_get_text',                              'E',
427                 'gtk_ctree_node_is_visible',                    'E',
428                 'gtk_ctree_node_moveto',                                'E',
429                 'GTK_CTREE_NODE_NEXT',                                  'E',
430                 'gtk_ctree_node_nth',                                   'E',
431                 'GTK_CTREE_NODE_PREV',                                  'E',
432                 'gtk_ctree_node_set_background',                'E',
433                 'gtk_ctree_node_set_cell_style',                'E',
434                 'gtk_ctree_node_set_foreground',                'E',
435                 'gtk_ctree_node_set_pixmap',                    'E',
436                 'gtk_ctree_node_set_pixtext',                   'E',
437                 'gtk_ctree_node_set_row_data',                  'E',
438                 'gtk_ctree_node_set_row_data_full',             'E',
439                 'gtk_ctree_node_set_row_style',                 'E',
440                 'gtk_ctree_node_set_selectable',                'E',
441                 'gtk_ctree_node_set_shift',                             'E',
442                 'gtk_ctree_node_set_text',                              'E',
443                 'gtk_ctree_post_recursive',                             'E',
444                 'gtk_ctree_post_recursive_to_depth',    'E',
445                 'gtk_ctree_pre_recursive',                              'E',
446                 'gtk_ctree_pre_recursive_to_depth',             'E',
447                 'gtk_ctree_real_select_recursive',              'E',
448                 'gtk_ctree_remove_node',                                'E',
449                 'GTK_CTREE_ROW',                                                'E',
450                 'gtk_ctree_select',                                             'E',
451                 'gtk_ctree_select_recursive',                   'E',
452                 'gtk_ctree_set_drag_compare_func',              'E',
453                 'gtk_ctree_set_expander_style',                 'E',
454                 'gtk_ctree_set_indent',                                 'E',
455                 'gtk_ctree_set_line_style',                             'E',
456                 'gtk_ctree_set_node_info',                              'E',
457                 'gtk_ctree_set_reorderable',                    'E',
458                 'gtk_ctree_set_show_stub',                              'E',
459                 'gtk_ctree_set_spacing',                                'E',
460                 'gtk_ctree_sort_node',                                  'E',
461                 'gtk_ctree_sort_recursive',                             'E',
462                 'gtk_ctree_toggle_expansion',                   'E',
463                 'gtk_ctree_toggle_expansion_recursive', 'E',
464                 'gtk_ctree_unselect',                                   'E',
465                 'gtk_ctree_unselect_recursive',                 'E',
466                 'gtk_curve_get_vector',                                 'E', # since 2.20
467                 'gtk_curve_new',                                                'E', # since 2.20
468                 'gtk_curve_reset',                                              'E', # since 2.20
469                 'gtk_curve_set_curve_type',                             'E', # since 2.20
470                 'gtk_curve_set_gamma',                                  'E', # since 2.20
471                 'gtk_curve_set_range',                                  'E', # since 2.20
472                 'gtk_curve_set_vector',                                 'E', # since 2.20
473                 'gtk_drag_set_default_icon',                    'E',
474                 'gtk_draw_arrow',                               'E',
475                 'gtk_draw_box',                                 'E',
476                 'gtk_draw_box_gap',                             'E',
477                 'gtk_draw_check',                               'E',
478                 'gtk_draw_diamond',                             'E',
479                 'gtk_draw_expander',                            'E',
480                 'gtk_draw_extension',                           'E',
481                 'gtk_draw_flat_box',                            'E',
482                 'gtk_draw_focus',                               'E',
483                 'gtk_draw_handle',                              'E',
484                 'gtk_draw_hline',                               'E',
485                 'gtk_draw_layout',                              'E',
486                 'gtk_draw_option',                              'E',
487                 'gtk_draw_polygon',                             'E',
488                 'gtk_draw_resize_grip',                 'E',
489                 'gtk_draw_shadow',                              'E',
490                 'gtk_draw_shadow_gap',                  'E',
491                 'gtk_draw_slider',                              'E',
492                 'gtk_draw_string',                              'E',
493                 'gtk_draw_tab',                                 'E',
494                 'gtk_draw_vline',                               'E',
495                 'gtk_drawing_area_size',                                'E', # >> g_object_set() [==] ?
496                                                                                                          #    gtk_widget_set_size_request() [==?]
497                 'gtk_entry_append_text',                                'E', # >> gtk_editable_insert_text() [==?]
498                 'gtk_entry_new_with_max_length',                'E', # gtk_entry_new(); gtk_entry_set_max_length()
499                 'gtk_entry_prepend_text',                               'E',
500                 'gtk_entry_select_region',                              'E',
501                 'gtk_entry_set_editable',                               'E', # >> gtk_editable_set_editable() [==?]
502                 'gtk_entry_set_position',                               'E',
503                 'gtk_exit',                                                             'E', # exit() [==]
504                 'gtk_file_chooser_button_new_with_backend',     'E',
505                 'gtk_file_chooser_dialog_new_with_backend',     'E',
506                 'gtk_file_chooser_widget_new_with_backend',     'E',
507                 'gtk_file_selection_complete',                          'E',
508                 'gtk_file_selection_get_filename',                      'E', # GtkFileChooser ...
509                 'gtk_file_selection_get_select_multiple',       'E',
510                 'gtk_file_selection_get_selections',            'E',
511                 'gtk_file_selection_hide_fileop_buttons',       'E',
512                 'gtk_file_selection_new',                                       'E',
513                 'gtk_file_selection_set_filename',                      'E',
514                 'gtk_file_selection_set_select_multiple',       'E',
515                 'gtk_file_selection_show_fileop_buttons',       'E',
516                 'gtk_fixed_get_has_window',                     'E', # gtk_widget_get_has_window() (available since 2.18)
517                 'gtk_fixed_set_has_window',                     'E', # gtk_widget_set_has_window() (available since 2.18)
518                 'gtk_font_selection_dialog_get_apply_button',   'E',
519                 'gtk_font_selection_dialog_get_font',           'E',
520                 'gtk_font_selection_get_font',                  'E', # gtk_font_selection_get_font_name() [!=]
521                 'GTK_FUNDAMENTAL_TYPE',                         'E',
522                 'gtk_gamma_curve_new',                          'E', # since 2.20
523                 'gtk_hbutton_box_get_layout_default',           'E',
524                 'gtk_hbutton_box_get_spacing_default',          'E',
525                 'gtk_hbutton_box_set_layout_default',           'E',
526                 'gtk_hbutton_box_set_spacing_default',          'E',
527                 'gtk_idle_add',                                 'E',
528                 'gtk_idle_add_full',                            'E',
529                 'gtk_idle_add_priority',                        'E',
530                 'gtk_idle_remove',                              'E',
531                 'gtk_idle_remove_by_data',                      'E',
532                 'gtk_image_get',                                'E',
533                 'gtk_image_set',                                'E',
534                 'gtk_input_add_full',                           'W', # >>> g_io_add_watch_full()
535                 'gtk_input_dialog_new',                         'E', # since 2.20
536                 'gtk_input_remove',                             'W', # >>> g_source_remove()
537                 'GTK_IS_ROOT_TREE',                             'E',
538                 'gtk_item_factories_path_delete',               'E', # GtkUIManager (avail since 2.4) ...
539                 'gtk_item_factory_add_foreign',                 'E',
540                 'gtk_item_factory_construct',                   'E',
541                 'gtk_item_factory_create_item',                 'W',
542                 'gtk_item_factory_create_items',                'E',
543                 'gtk_item_factory_create_items_ac',             'W',
544                 'gtk_item_factory_create_menu_entries',         'E',
545                 'gtk_item_factory_delete_entries',              'E',
546                 'gtk_item_factory_delete_entry',                'E',
547                 'gtk_item_factory_delete_item',                 'W',
548                 'gtk_item_factory_from_path',                   'E',
549                 'gtk_item_factory_from_widget',                 'W',
550                 'gtk_item_factory_get_item',                    'W',
551                 'gtk_item_factory_get_item_by_action',          'E',
552                 'gtk_item_factory_get_widget',                  'W',
553                 'gtk_item_factory_get_widget_by_action',        'E',
554                 'gtk_item_factory_new',                         'W',
555                 'gtk_item_factory_path_from_widget',            'E',
556                 'gtk_item_factory_popup',                       'E',
557                 'gtk_item_factory_popup_data',                  'E',
558                 'gtk_item_factory_popup_data_from_widget',      'E',
559                 'gtk_item_factory_popup_with_data',             'E',
560                 'gtk_item_factory_set_translate_func',          'E',
561                 'gtk_label_get',                                'E', # gtk_label_get_text() [!=]
562                 'gtk_label_parse_uline',                        'E',
563                 'gtk_label_set',                                'E', # gtk_label_set_text() [==]
564                 'gtk_layout_freeze',                            'E',
565                 'gtk_layout_thaw',                              'E',
566                 'gtk_list_append_items',                        'E',
567                 'gtk_list_child_position',                      'E',
568                 'gtk_list_clear_items',                         'E',
569                 'gtk_list_end_drag_selection',                  'E',
570                 'gtk_list_end_selection',                       'E',
571                 'gtk_list_extend_selection',                    'E',
572                 'gtk_list_insert_items',                        'E',
573                 'gtk_list_item_deselect',                       'E',
574                 'gtk_list_item_new',                            'E',
575                 'gtk_list_item_new_with_label',                 'E',
576                 'gtk_list_item_select',                         'E',
577                 'gtk_list_new',                                 'E',
578                 'gtk_list_prepend_items',                       'E',
579                 'gtk_list_remove_items',                        'E',
580                 'gtk_list_remove_items_no_unref',               'E',
581                 'gtk_list_scroll_horizontal',                   'E',
582                 'gtk_list_scroll_vertical',                     'E',
583                 'gtk_list_select_all',                          'E',
584                 'gtk_list_select_child',                        'E',
585                 'gtk_list_select_item',                         'E',
586                 'gtk_list_set_selection_mode',                  'E',
587                 'gtk_list_start_selection',                     'E',
588                 'gtk_list_toggle_add_mode',                     'E',
589                 'gtk_list_toggle_focus_row',                    'E',
590                 'gtk_list_toggle_row',                          'E',
591                 'gtk_list_undo_selection',                      'E',
592                 'gtk_list_unselect_all',                        'E',
593                 'gtk_list_unselect_child',                      'E',
594                 'gtk_list_unselect_item',                       'E',
595                 'gtk_menu_append',                              'E', # gtk_menu_shell_append() [==?]
596                 'gtk_menu_bar_append',                          'E',
597                 'gtk_menu_bar_insert',                          'E',
598                 'gtk_menu_bar_prepend',                         'E',
599                 'gtk_menu_insert',                              'E',
600                 'gtk_menu_item_remove_submenu',                 'E',
601                 'gtk_menu_item_right_justify',                  'E',
602                 'gtk_menu_prepend',                             'E', # gtk_menu_shell_prepend() [==?]
603                 'gtk_menu_tool_button_set_arrow_tooltip',       'E',
604                 'gtk_notebook_current_page',                    'E',
605                 'gtk_notebook_query_tab_label_packing',         'E', # since 2.20
606                 'gtk_notebook_get_group_id',                    'E',
607                 'gtk_notebook_set_group_id',                    'E',
608                 'gtk_notebook_set_homogeneous_tabs',            'E',
609                 'gtk_notebook_set_page',                        'E', # gtk_notebook_set_current_page() [==]
610                 'gtk_notebook_set_tab_border',                  'E',
611                 'gtk_notebook_set_tab_hborder',                 'E',
612                 'gtk_notebook_set_tab_label_packing',           'E', # since 2.20
613                 'gtk_notebook_set_tab_vborder',                 'E',
614                 'gtk_object_add_arg_type',                      'E',
615                 'gtk_object_data_force_id',                     'E',
616                 'gtk_object_data_try_key',                      'E',
617                 'GTK_OBJECT_FLOATING',                          'E',
618                 'gtk_object_get',                               'E',
619                 'gtk_object_get_data',                          'E',
620                 'gtk_object_get_data_by_id',                    'E',
621                 'gtk_object_get_user_data',                     'E',
622                 'gtk_object_new',                               'E',
623                 'gtk_object_ref',                               'E',
624                 'gtk_object_remove_data',                       'E',
625                 'gtk_object_remove_data_by_id',                 'E',
626                 'gtk_object_remove_no_notify',                  'E',
627                 'gtk_object_remove_no_notify_by_id',            'E',
628                 'gtk_object_set',                               'E',
629                 'gtk_object_set_data',                          'E',
630                 'gtk_object_set_data_by_id',                    'E',
631                 'gtk_object_set_data_by_id_full',               'E',
632                 'gtk_object_set_data_full',                     'E',
633                 'gtk_object_set_user_data',                     'E',
634                 'gtk_object_sink',                              'E',
635                 'GTK_OBJECT_TYPE',                              'E', # G_OBJECT_TYPE
636                 'GTK_OBJECT_TYPE_NAME',                         'E', # G_OBJECT_TYPE_NAME
637                 'gtk_object_unref',                             'E',
638                 'gtk_object_weakref',                           'E',
639                 'gtk_object_weakunref',                         'E',
640                 'gtk_old_editable_changed',                     'E',
641                 'gtk_old_editable_claim_selection',             'E',
642                 'gtk_option_menu_get_history',                  'E', # GtkComboBox ... (avail since 2.4/2.6/2.10/2.14)
643                 'gtk_option_menu_get_menu',                     'E',
644                 'gtk_option_menu_new',                          'E',
645                 'gtk_option_menu_remove_menu',                  'E',
646                 'gtk_option_menu_set_history',                  'E',
647                 'gtk_option_menu_set_menu',                     'E',
648                 'gtk_paint_string',                             'E',
649                 'gtk_paned_gutter_size',                        'E', # gtk_paned_set_gutter_size()
650                 'gtk_paned_set_gutter_size',                    'E', # "does nothing"
651                 'gtk_pixmap_get',                               'E', # GtkImage ...
652                 'gtk_pixmap_new',                               'E',
653                 'gtk_pixmap_set',                               'E',
654                 'gtk_pixmap_set_build_insensitive',             'E',
655                 'gtk_preview_draw_row',                         'E',
656                 'gtk_preview_get_cmap',                         'E',
657                 'gtk_preview_get_info',                         'E',
658                 'gtk_preview_get_visual',                       'E',
659                 'gtk_preview_new',                              'E',
660                 'gtk_preview_put',                              'E',
661                 'gtk_preview_reset',                            'E',
662                 'gtk_preview_set_color_cube',                   'E',
663                 'gtk_preview_set_dither',                       'E',
664                 'gtk_preview_set_expand',                       'E',
665                 'gtk_preview_set_gamma',                        'E',
666                 'gtk_preview_set_install_cmap',                 'E',
667                 'gtk_preview_set_reserved',                     'E',
668                 'gtk_preview_size',                             'E',
669                 'gtk_preview_uninit',                           'E',
670                 'gtk_progress_bar_new_with_adjustment',         'E',
671                 'gtk_progress_bar_set_activity_blocks',         'E',
672                 'gtk_progress_bar_set_activity_step',           'E',
673                 'gtk_progress_bar_set_bar_style',               'E',
674                 'gtk_progress_bar_set_discrete_blocks',         'E',
675                 'gtk_progress_bar_update',                      'E', # >>> "gtk_progress_set_value() or
676                                                                         #    gtk_progress_set_percentage()"
677                                                                         ##  Actually: GtkProgress is deprecated so the
678                                                                         ##  right answer appears to be to use
679                                                                         ##  gtk_progress_bar_set_fraction()
680                 'gtk_progress_configure',                       'E',
681                 'gtk_progress_get_current_percentage',          'E',
682                 'gtk_progress_get_current_text',                'E',
683                 'gtk_progress_get_percentage_from_value',       'E',
684                 'gtk_progress_get_text_from_value',             'E',
685                 'gtk_progress_get_value',                       'E',
686                 'gtk_progress_set_activity_mode',               'E',
687                 'gtk_progress_set_adjustment',                  'E',
688                 'gtk_progress_set_format_string',               'E',
689                 'gtk_progress_set_percentage',                  'E',
690                 'gtk_progress_set_show_text',                   'E',
691                 'gtk_progress_set_text_alignment',              'E',
692                 'gtk_progress_set_value',                       'E',
693                 'gtk_radio_button_group',                       'E', # gtk_radio_button_get_group() [==]
694                 'gtk_radio_menu_item_group',                    'E',
695                 'gtk_rc_add_class_style',                       'E',
696                 'gtk_rc_add_widget_class_style',                'E',
697                 'gtk_rc_add_widget_name_style',                 'E',
698                 'gtk_rc_style_ref',                             'E',
699                 'gtk_rc_style_unref',                           'E',
700                 'gtk_recent_chooser_get_show_numbers',          'E',
701                 'gtk_recent_chooser_set_show_numbers',          'E',
702                 'gtk_recent_manager_get_for_screen',            'E',
703                 'gtk_recent_manager_set_screen',                'E',
704                 'GTK_RETLOC_BOOL',                              'E',
705                 'GTK_RETLOC_BOXED',                             'E',
706                 'GTK_RETLOC_CHAR',                              'E',
707                 'GTK_RETLOC_DOUBLE',                            'E',
708                 'GTK_RETLOC_ENUM',                              'E',
709                 'GTK_RETLOC_FLAGS',                             'E',
710                 'GTK_RETLOC_FLOAT',                             'E',
711                 'GTK_RETLOC_INT',                               'E',
712                 'GTK_RETLOC_LONG',                              'E',
713                 'GTK_RETLOC_OBJECT',                            'E',
714                 'GTK_RETLOC_POINTER',                           'E',
715                 'GTK_RETLOC_STRING',                            'E',
716                 'GTK_RETLOC_UCHAR',                             'E',
717                 'GTK_RETLOC_UINT',                              'E',
718                 'GTK_RETLOC_ULONG',                             'E',
719                 'gtk_selection_clear',                          'E',
720                 'gtk_signal_connect',                           'E', # GSignal ...
721                 'gtk_signal_connect_after',                     'E',
722                 'gtk_signal_connect_full',                      'E',
723                 'gtk_signal_connect_object',                    'E',
724                 'gtk_signal_connect_object_after',              'E',
725                 'gtk_signal_connect_object_while_alive',        'E',
726                 'gtk_signal_connect_while_alive',               'E',
727                 'gtk_signal_default_marshaller',                'E',
728                 'gtk_signal_disconnect',                        'E',
729                 'gtk_signal_disconnect_by_data',                'E',
730                 'gtk_signal_disconnect_by_func',                'E',
731                 'gtk_signal_emit',                              'E',
732                 'gtk_signal_emit_by_name',                      'E',
733                 'gtk_signal_emit_stop',                         'E',
734                 'gtk_signal_emit_stop_by_name',                 'E',
735                 'gtk_signal_emitv',                             'E',
736                 'gtk_signal_emitv_by_name',                     'E',
737                 'GTK_SIGNAL_FUNC',                                              'E',
738                 'gtk_signal_handler_block',                             'E',
739                 'gtk_signal_handler_block_by_data',             'E',
740                 'gtk_signal_handler_block_by_func',             'E',
741                 'gtk_signal_handler_pending',                   'E',
742                 'gtk_signal_handler_pending_by_func',           'E',
743                 'gtk_signal_handler_unblock',                           'E',
744                 'gtk_signal_handler_unblock_by_data',           'E',
745                 'gtk_signal_handler_unblock_by_func',           'E',
746                 'gtk_signal_lookup',                                            'E',
747                 'gtk_signal_name',                                                      'E',
748                 'gtk_signal_new',                                                       'E',
749                 'gtk_signal_newv',                                                      'E',
750                 'GTK_SIGNAL_OFFSET',                                            'E',
751                 'gtk_socket_steal',                                                     'E',
752                 'gtk_spin_button_get_value_as_float',           'E', # gtk_spin_button_get_value() [==]
753                 'GTK_STRUCT_OFFSET',                                            'E',
754                 'gtk_style_apply_default_pixmap',                       'E',
755                 'gtk_style_get_font',                                           'E',
756                 'gtk_style_ref',                                                        'E',
757                 'gtk_style_set_font',                                           'E',
758                 'gtk_style_unref',                                                      'E', # g_object_unref() [==?]
759                 'gtk_text_backward_delete',                                     'E',
760                 'gtk_text_forward_delete',                                      'E',
761                 'gtk_text_freeze',                                                      'E',
762                 'gtk_text_get_length',                                          'E',
763                 'gtk_text_get_point',                                           'E',
764                 'GTK_TEXT_INDEX',                                                       'E',
765                 'gtk_text_insert',                                                      'E', # GtkTextView (GtkText "known to be buggy" !)
766                 'gtk_text_new',                                                         'E',
767                 'gtk_text_set_adjustments',                                     'E',
768                 'gtk_text_set_editable',                                        'E',
769                 'gtk_text_set_line_wrap',                                       'E',
770                 'gtk_text_set_point',                                           'E',
771                 'gtk_text_set_word_wrap',                                       'E',
772                 'gtk_text_thaw',                                                        'E',
773                 'gtk_timeout_add',                                                      'E', # g_timeout_add()
774                 'gtk_timeout_add_full',                                         'E',
775                 'gtk_timeout_remove',                                           'E', # g_source_remove()
776                 'gtk_tips_query_new',                                           'E',
777                 'gtk_tips_query_set_caller',                            'E',
778                 'gtk_tips_query_set_labels',                            'E',
779                 'gtk_tips_query_start_query',                           'E',
780                 'gtk_tips_query_stop_query',                            'E',
781                 'gtk_toggle_button_set_state',                          'E', # gtk_toggle_button_set_active [==]
782                 'gtk_toolbar_append_element',                           'E',
783                 'gtk_toolbar_append_item',                                      'E',
784                 'gtk_toolbar_append_space',                                     'E', # Use gtk_toolbar_insert() instead
785                 'gtk_toolbar_append_widget',                            'E', # ??
786                 'gtk_toolbar_get_tooltips',                                     'E',
787                 'gtk_toolbar_insert_element',                           'E',
788                 'gtk_toolbar_insert_item',                                      'E',
789                 'gtk_toolbar_insert_space',                                     'E',
790                 'gtk_toolbar_insert_stock',                                     'E',
791                 'gtk_toolbar_insert_widget',                            'E',
792                 'gtk_toolbar_prepend_element',                          'E',
793                 'gtk_toolbar_prepend_item',                                     'E',
794                 'gtk_toolbar_prepend_space',                            'E',
795                 'gtk_toolbar_prepend_widget',                           'E',
796                 'gtk_toolbar_remove_space',                                     'E',
797                 'gtk_toolbar_set_tooltips',                                     'E',
798                 'gtk_tree_append',                                                      'E',
799                 'gtk_tree_child_position',                                      'E',
800                 'gtk_tree_clear_items',                                         'E',
801                 'gtk_tree_insert',                                                      'E',
802                 'gtk_tree_item_collapse',                                       'E',
803                 'gtk_tree_item_deselect',                                       'E',
804                 'gtk_tree_item_expand',                                         'E',
805                 'gtk_tree_item_new',                                            'E',
806                 'gtk_tree_item_new_with_label',                         'E',
807                 'gtk_tree_item_remove_subtree',                         'E',
808                 'gtk_tree_item_select',                                         'E',
809                 'gtk_tree_item_set_subtree',                            'E',
810                 'GTK_TREE_ITEM_SUBTREE',                                        'E',
811                 'gtk_tree_model_get_iter_root',                         'E',
812                 'gtk_tree_new',                                                         'E',
813                 'gtk_tree_path_new_root',                                       'E',
814                 'gtk_tree_prepend',                                                     'E',
815                 'gtk_tree_remove_item',                                         'E',
816                 'gtk_tree_remove_items',                                        'E',
817                 'GTK_TREE_ROOT_TREE',                                           'E',
818                 'gtk_tree_select_child',                                        'E',
819                 'gtk_tree_select_item',                                         'E',
820                 'GTK_TREE_SELECTION_OLD',                                       'E',
821                 'gtk_tree_set_selection_mode',                          'E',
822                 'gtk_tree_set_view_lines',                                      'E',
823                 'gtk_tree_set_view_mode',                                       'E',
824                 'gtk_tree_unselect_child',                                      'E',
825                 'gtk_tree_unselect_item',                                       'E',
826                 'gtk_tree_view_tree_to_widget_coords',          'E',
827                 'gtk_tree_view_widget_to_tree_coords',          'E',
828                 'gtk_type_class',                                                       'E', # g_type_class_peek() or g_type_class_ref()
829                 'GTK_TYPE_CTREE_NODE',                                          'E',
830                 'gtk_type_enum_find_value',                                     'E',
831                 'gtk_type_enum_get_values',                                     'E',
832                 'gtk_type_flags_find_value',                            'E',
833                 'gtk_type_flags_get_values',                            'E',
834                 'gtk_type_from_name',                                           'E',
835                 'gtk_type_init',                                                        'E',
836                 'gtk_type_is_a',                                                        'E',
837                 'GTK_TYPE_IS_OBJECT',                                           'E',
838                 'gtk_type_name',                                                        'E',
839                 'gtk_type_new',                                                         'E',
840                 'gtk_type_parent',                              'E',
841                 'gtk_type_unique',                              'E',
842                 'GTK_VALUE_BOOL',                               'E',
843                 'GTK_VALUE_BOXED',                              'E',
844                 'GTK_VALUE_CHAR',                               'E',
845                 'GTK_VALUE_DOUBLE',                             'E',
846                 'GTK_VALUE_ENUM',                               'E',
847                 'GTK_VALUE_FLAGS',                              'E',
848                 'GTK_VALUE_FLOAT',                              'E',
849                 'GTK_VALUE_INT',                                'E',
850                 'GTK_VALUE_LONG',                               'E',
851                 'GTK_VALUE_OBJECT',                             'E',
852                 'GTK_VALUE_POINTER',                            'E',
853                 'GTK_VALUE_SIGNAL',                             'E',
854                 'GTK_VALUE_STRING',                             'E',
855                 'GTK_VALUE_UCHAR',                              'E',
856                 'GTK_VALUE_UINT',                               'E',
857                 'GTK_VALUE_ULONG',                              'E',
858                 'gtk_vbutton_box_get_layout_default',           'E',
859                 'gtk_vbutton_box_get_spacing_default',          'E',
860                 'gtk_vbutton_box_set_layout_default',           'E',
861                 'gtk_vbutton_box_set_spacing_default',          'E',
862                 'gtk_widget_draw',                                                      'E',    # gtk_widget_queue_draw_area():
863                                                                                                                         #  "in general a better choice if you want
864                                                                                                                         #  to draw a region of a widget."
865                 'gtk_widget_pop_visual',                                        'E',
866                 'gtk_widget_push_visual',                                       'E',
867                 'gtk_widget_queue_clear',                                       'E',
868                 'gtk_widget_queue_clear_area',                          'E',
869                 'gtk_widget_ref',                                                       'E', # g_object_ref() [==]
870                 'gtk_widget_restore_default_style',                     'E',
871                 'gtk_widget_set',                                                       'E', # g_object_set() [==]
872                 'gtk_widget_set_default_visual',                        'E',
873                 'gtk_widget_set_rc_style',                                      'E',
874                 'gtk_widget_set_uposition',                                     'E', # ?? (see GTK documentation)
875                 'gtk_widget_set_usize',                                         'E', # gtk_widget_set_size_request()
876                 'gtk_widget_set_visual',                                        'E',
877                 'gtk_widget_unref',                                                     'E',
878                 'gtk_window_position',                                          'E',
879                 'gtk_window_set_policy',                                        'E', # >>? gtk_window_set_resizable()
880 ##
881 ## Deprecated for GTK+ versions greater than 2.4
882 ## Note that entries marked with 'W' are currently being used by Wireshark
883 ## Those marked with 'E' are not being used by Wireshark
884 ##
885 ## Deprecated as of GTK+ 2.12 but to be replaced only when Wireshark requires GTK+ 2.12 or later
886 ##  (or: use conditional code based upon the GTK version).
887                 'gtk_tooltips_data_get',                                        'E', # new API: GtkToolTip (avail since 2.12) ...
888                 'gtk_tooltips_disable',                                         'E',
889                 'gtk_tooltips_enable',                                          'E',
890                 'gtk_tooltips_force_window',                            'E',
891                 'gtk_tooltips_get_info_from_tip_window',        'E',
892 ##              'gtk_tooltips_new',                                                     'W',
893                 'gtk_tooltips_set_delay',                                       'E',
894 ##              'gtk_tooltips_set_tip',                                         'W',
895 ##              'gtk_tool_item_set_tooltip',                            'W', # gtk_tool_item_set_tooltip_text() (avail since 2.12)
896 ##
897 ## Deprecated as of GTK+ 2.16 but to be replaced only when Wireshark requires GTK+ 2.16 or later
898 ##  (or: use conditional code based upon the GTK version).
899                 'gtk_scale_button_get_orientation',                     'E', # gtk_orientable_get_orientation()         (avail since 2.16)
900                 'gtk_scale_button_set_orientation',                     'E', # gtk_orientable_set_orientation()         (avail since 2.16)
901                 'gtk_toolbar_get_orientation',                          'E', # gtk_orientable_get_orientation()         (avail since 2.16)
902 ##              'gtk_toolbar_set_orientation',                          'W', # gtk_orientable_set_orientation()         (avail since 2.16)
903                 'gtk_status_icon_set_tooltip',                          'E', # gtk_status_icon_set_tooltip_text()       (avail since 2.16)
904                 'gtk_widget_get_action',                                        'E', # gtk_activatable_get_related_action()     (avail since 2.16)
905 ##
906 ## Deprecated as of GTK+ 2.18 but to be replaced only when Wireshark requires GTK+ 2.12 or later
907 ##  (or: use conditional code based upon the GTK version).
908                 'gtk_cell_view_get_cell_renderers',                     'E', # gtk_cell_layout_get_cells ()             (avail since 2.12)
909 ##              'gtk_tree_view_column_get_cell_renderers',      'W', # gtk_cell_layout_get_cells ()             (avail since 2.12)
910 ##
911 ## Deprecated as of GTK+ 2.20 but to be replaced only when Wireshark requires GTK+ 2.18 or later
912 ##  (or: use conditional code based upon the GTK version).
913                 'GTK_WIDGET_APP_PAINTABLE',                                     'E', # gtk_widget_get_app_paintable()           (avail since 2.18)
914                 'GTK_WIDGET_CAN_DEFAULT',                                       'E', # gtk_widget_getcan_default()              (avail since 2.18)
915                 'GTK_WIDGET_CAN_FOCUS',                                         'E', # gtk_widget_getcan_focus()                (avail since 2.18)
916                 'GTK_WIDGET_COMPOSITE_CHILD',                           'E', # gtk_widget_getcomposite_child()          (avail since 2.18)
917                 'GTK_WIDGET_DOUBLE_BUFFERED',                           'E', # gtk_widget_getdouble_buffered()          (avail since 2.18)
918                 'GTK_WIDGET_DRAWABLE',                                          'E', # gtk_widget_getdrawable()                 (avail since 2.18)
919                 'GTK_WIDGET_FLAGS',                                                     'E', # gtk_widget_getflags()                    (avail since 2.18)
920                 'GTK_WIDGET_HAS_DEFAULT',                                       'E', # gtk_widget_gethas_default()              (avail since 2.18)
921                 'GTK_WIDGET_HAS_FOCUS',                                         'E', # gtk_widget_gethas_focus()                (avail since 2.18)
922                 'GTK_WIDGET_HAS_GRAB',                                          'E', # gtk_widget_gethas_grab()                 (avail since 2.18)
923                 'GTK_WIDGET_IS_SENSITIVE',                                      'E', # gtk_widget_getis_sensitive()             (avail since 2.18)
924                 'GTK_WIDGET_MAPPED',                                            'E', # gtk_widget_getmapped()                   (avail since 2.18)
925                 'GTK_WIDGET_NO_WINDOW',                                         'W', # gtk_widget_getno_window()                (avail since 2.18)
926                 'GTK_WIDGET_PARENT_SENSITIVE',                          'E', # gtk_widget_getparent_sensitive()         (avail since 2.18)
927                 'GTK_WIDGET_RC_STYLE',                                          'E', # gtk_widget_getrc_style()                 (avail since 2.18)
928                 'GTK_WIDGET_REALIZED',                                          'W', # gtk_widget_getrealized()                 (avail since 2.18)
929                 'GTK_WIDGET_RECEIVES_DEFAULT',                          'E', # gtk_widget_getreceives_default()         (avail since 2.18)
930                 'GTK_WIDGET_SAVED_STATE',                                       'E', # gtk_widget_getsaved_state()              (avail since 2.18)
931                 'GTK_WIDGET_SENSITIVE',                                         'W', # gtk_widget_getsensitive()                (avail since 2.18)
932                 'GTK_WIDGET_STATE',                                                     'W', # gtk_widget_getstate()                    (avail since 2.18)
933                 'GTK_WIDGET_TOPLEVEL',                                          'E', # gtk_widget_gettoplevel()                 (avail since 2.18)
934                 'GTK_WIDGET_TYPE',                                                      'E', # gtk_widget_gettype()                     (avail since 2.18)
935                 'GTK_WIDGET_VISIBLE',                                           'W', # gtk_widget_getvisible()                  (avail since 2.18)
936 ## Deprecated as of GTK+ 2.22 but to be replaced only when Wireshark requires GTK+ 2.18 or later
937 ##  (or: use conditional code based upon the GTK version).
938                 'gtk_dialog_get_has_separator',                         'E', # This function will be removed in GTK+ 3
939                 'gtk_dialog_set_has_separator',                         'E', # This function will be removed in GTK+ 3
940                 'gtk_icon_view_get_orientation',                        'E', # gtk_icon_view_get_item_orientation()
941                 'gtk_icon_view_set_orientation',                        'E', # gtk_icon_view_set_item_orientation()
942                 'gtk_item_deselect',                                            'E', # gtk_menu_item_deselect()
943                 'gtk_item_select',                                                      'E', # gtk_menu_item_select()
944                 'gtk_item_toggle',                                                      'E', #
945                 'gtk_recent_manager_get_limit',                         'E', # Use GtkRecentChooser
946                 'gtk_recent_manager_set_limit',                         'E', #
947
948 );
949
950 @{$APIs{'deprecated-gtk'}->{'functions'}}      = grep {$deprecatedGtkFunctions{$_} eq 'E'} keys %deprecatedGtkFunctions;
951 @{$APIs{'deprecated-gtk-todo'}->{'functions'}} = grep {$deprecatedGtkFunctions{$_} eq 'W'} keys %deprecatedGtkFunctions;
952
953
954
955 # Given a ref to a hash containing "functions" and "functions_count" entries:
956 # Determine if the any of the list of APIs contained in the array referenced by "functions"
957 # exists in the file.
958 # For each API which appears in the file:
959 #     Push the API onto the provided list;
960 #     Add the number of times the API appears in the file to the total count
961 #      for the API (stored as the value of the API key in the hash referenced by "function_counts").
962
963 sub findAPIinFile($$$)
964 {
965         my ($groupHashRef, $fileContentsRef, $foundAPIsRef) = @_;
966
967         for my $api ( @{$groupHashRef->{functions}} )
968         {
969                 my $cnt = 0;
970                 while (${$fileContentsRef} =~ m/ \W $api \W* \( /gx)
971                 {
972                         $cnt += 1;
973                 }
974                 if ($cnt > 0) {
975                         push @{$foundAPIsRef}, $api;
976                         $groupHashRef->{function_counts}->{$api} += 1;
977                 }
978         }
979 }
980
981 # APIs which (generally) should not be called with an argument of tvb_get_ptr()
982 my @TvbPtrAPIs = (
983         # Use NULL for the value_ptr instead of tvb_get_ptr() (only if the
984         # given offset and length are equal) with these:
985         'proto_tree_add_bytes_format',
986         'proto_tree_add_bytes_format_value',
987         # Use the tvb_* version of these:
988         'ether_to_str',
989         'ip_to_str',
990         'ip6_to_str',
991         'fc_to_str',
992         'fcwwn_to_str',
993         # Use tvb_bytes_to_str[_punct] instead of:
994         'bytes_to_str',
995         'bytes_to_str_punct',
996 );
997
998 sub checkAPIsCalledWithTvbGetPtr($$$)
999 {
1000         my ($APIs, $fileContentsRef, $foundAPIsRef) = @_;
1001
1002         for my $api (@{$APIs}) {
1003                 my @items;
1004                 my $cnt = 0;
1005
1006                 @items = (${$fileContentsRef} =~ m/($api[^;]*;)/sg);
1007                 while (@items) {
1008                         my ($item) = @items;
1009                         shift @items;
1010                         if ($item =~ /tvb_get_ptr/xos) {
1011                                 $cnt += 1;
1012                         }
1013                 }
1014
1015                 if ($cnt > 0) {
1016                         push @{$foundAPIsRef}, $api;
1017                 }
1018         }
1019 }
1020
1021 # Verify that all declared ett_ variables are registered.
1022 # Don't bother trying to check usage (for now)...
1023 sub check_ett_registration($$)
1024 {
1025         my ($fileContentsRef, $filename) = @_;
1026         my @ett_declarations;
1027         my %ett_registrations;
1028         my @unRegisteredEtts;
1029
1030         # A pattern to match ett variable names.  Obviously this assumes that
1031         # they start with ett_
1032         my $EttVarName = qr{ (?: ett_[a-z0-9_]+ (?:\[[0-9]+\])? ) }xi;
1033
1034         # Remove macro lines
1035         my $fileContents = ${$fileContentsRef};
1036         $fileContents =~ s { ^\s*\#.*$} []xogm;
1037
1038         # Find all the ett_ variables declared in the file
1039         @ett_declarations = ($fileContents =~ m{
1040                 ^\s*static              # assume declarations are on their own line
1041                 \s+
1042                 g?int                   # could be int or gint
1043                 \s+
1044                 ($EttVarName)           # variable name
1045                 \s*=\s*
1046                 -1\s*;
1047         }xgiom);
1048
1049         if (!@ett_declarations) {
1050                 print "Found no etts in ".$filename."\n";
1051                 return;
1052         }
1053
1054         #print "Found these etts in ".$filename.": ".join(',', @ett_declarations)."\n\n";
1055
1056         # Find the array used for registering the etts
1057         # Save off the block of code containing just the variables
1058         my @reg_blocks;
1059         @reg_blocks = ($fileContents =~ m{
1060                 static
1061                 \s+
1062                 g?int
1063                 \s*\*\s*                # it's an array of pointers
1064                 [a-z0-9_]+              # array name; usually (always?) "ett"
1065                 \s*\[\s*\]\s*           # array brackets
1066                 =
1067                 \s*\{
1068                 ((?:\s*&\s*             # address of the following variable
1069                 $EttVarName             # variable name
1070                 \s*,?                   # the comma is optional (for the last entry)
1071                 \s*)+)                  # match one or more variable names
1072                 \}
1073                 \s*
1074                 ;
1075         }xgios);
1076         #print "Found this ett registration block in ".$filename.": ".join(',', @reg_blocks)."\n";
1077
1078         if (@reg_blocks == 0) {
1079                 print "Hmm, found ".@reg_blocks." ett registration blocks in ".$filename."\n";
1080                 # For now...
1081                 return;
1082         }
1083
1084         while (@reg_blocks) {
1085                 my ($block) = @reg_blocks;
1086                 shift @reg_blocks;
1087
1088                 # Convert the list returned by the match into a hash of the
1089                 # form ett_variable_name -> 1.  Then combine this new hash with
1090                 # the hash from the last registration block.
1091                 # (Of course) using hashes makes the lookups much faster.
1092                 %ett_registrations = map { $_ => 1 } ($block =~ m{
1093                         \s*&\s*                 # address of the following variable
1094                         ($EttVarName)           # variable name
1095                         \s*,?                   # the comma is optional (for the last entry)
1096                 }xgios, %ett_registrations);
1097         }
1098         #print "Found these ett registrations in ".$filename.": ";
1099         #while( my ($k, $v) = each %ett_registrations ) {
1100         #          print "$k\n";
1101         #}
1102
1103         # Find which declared etts are not registered.
1104         # XXX - using <@ett_declarations> and $_ instead of $ett_var makes this
1105         # MUCH slower...  Why?
1106         while (@ett_declarations) {
1107                 my ($ett_var) = @ett_declarations;
1108                 shift @ett_declarations;
1109
1110                 push(@unRegisteredEtts, $ett_var) if (!$ett_registrations{$ett_var});
1111         }
1112
1113         if (@unRegisteredEtts) {
1114                 print STDERR "Error: found these unregistered ett variables in ".$filename.": ".join(',', @unRegisteredEtts)."\n";
1115         }
1116
1117 }
1118
1119 # Given the file contents and a file name, check all of the hf entries for
1120 # various problems (such as those checked for in proto.c).
1121 sub check_hf_entries($$)
1122 {
1123         my ($fileContentsRef, $filename) = @_;
1124         my $errorCount = 0;
1125
1126         my @items;
1127         @items = (${$fileContentsRef} =~ m{
1128                                   \{
1129                                   \s*
1130                                   &\s*([A-Z0-9_\[\]-]+)         # &hf
1131                                   \s*,\s*
1132                                   \{\s*
1133                                   ("[A-Z0-9 '\./\(\)_:-]+")     # name
1134                                   \s*,\s*
1135                                   (NULL|"[A-Z0-9_\.-]*")        # abbrev
1136                                   \s*,\s*
1137                                   (FT_[A-Z0-9_]+)               # field type
1138                                   \s*,\s*
1139                                   ([A-Z0-9x\|_]+)               # display
1140                                   \s*,\s*
1141                                   ([A-Z0-9&_\(\)' -]+)          # convert
1142                                   \s*,\s*
1143                                   ([A-Z0-9_]+)                  # bitmask
1144                                   \s*,\s*
1145                                   (NULL|"[A-Z0-9 '\./\(\)\?_:-]+")      # blurb (NULL or a string)
1146                                   \s*,\s*
1147                                   HFILL                         # HFILL
1148         }xgios);
1149
1150         #print "Found @items items\n";
1151         while (@items) {
1152                 my ($hf, $name, $abbrev, $ft, $display, $convert, $bitmask, $blurb) = @items;
1153                 shift @items; shift @items; shift @items; shift @items; shift @items; shift @items; shift @items; shift @items;
1154
1155                 #print "name=$name, abbrev=$abbrev, ft=$ft, display=$display, convert=$convert, bitmask=$bitmask, blurb=$blurb\n";
1156
1157                 if ($abbrev eq '""' || $abbrev eq "NULL") {
1158                         print STDERR "Error: field $name does not have an abbreviation in $filename\n";
1159                         $errorCount++;
1160                 }
1161                 if ($name eq $abbrev) {
1162                         print STDERR "Error: the abbreviation for field $name matches the field name in $filename\n";
1163                         $errorCount++;
1164                 }
1165                 if (lc($name) eq lc($blurb)) {
1166                         print STDERR "Error: the blurb for field $name ($abbrev) matches the field name in $filename\n";
1167                         $errorCount++;
1168                 }
1169                 if ($name =~ m/"\s+/) {
1170                         print STDERR "Error: the name for field $name ($abbrev) has leading space in $filename\n";
1171                         $errorCount++;
1172                 }
1173                 if ($name =~ m/\s+"/) {
1174                         print STDERR "Error: the name for field $name ($abbrev) has trailing space in $filename\n";
1175                         $errorCount++;
1176                 }
1177                 if ($blurb =~ m/"\s+/) {
1178                         print STDERR "Error: the blurb for field $name ($abbrev) has leading space in $filename\n";
1179                         $errorCount++;
1180                 }
1181                 if ($blurb =~ m/\s+"/) {
1182                         print STDERR "Error: the blurb for field $name ($abbrev) has trailing space in $filename\n";
1183                         $errorCount++;
1184                 }
1185                 if ($abbrev =~ m/\s+/) {
1186                         print STDERR "Error: the abbreviation for field $name ($abbrev) has white space in $filename\n";
1187                         $errorCount++;
1188                 }
1189                 if ("\"".$hf ."\"" eq $name) {
1190                         print STDERR "Error: name is the hf_variable_name in field $name ($abbrev) in $filename\n";
1191                         $errorCount++;
1192                 }
1193                 if ("\"".$hf ."\"" eq $abbrev) {
1194                         print STDERR "Error: abbreviation is the hf_variable_name in field $name ($abbrev) in $filename\n";
1195                         $errorCount++;
1196                 }
1197         }
1198
1199         return $errorCount;
1200 }
1201
1202 # The below Regexp are based on those from:
1203 # http://aspn.activestate.com/ASPN/Cookbook/Rx/Recipe/59811
1204 # They are in the public domain.
1205
1206 # 1. A complicated regex which matches C-style comments.
1207 my $CComment = qr{ / [*] [^*]* [*]+ (?: [^/*] [^*]* [*]+ )* / }x;
1208
1209 # 1.a A regex that matches C++-style comments.
1210 #my $CppComment = qr{ // (.*?) \n }x;
1211
1212 # 2. A regex which matches double-quoted strings.
1213 #    ?s added so that strings containing a 'line continuation'
1214 #    ( \ followed by a new-line) will match.
1215 my $DoubleQuotedStr = qr{ (?: ["] (?s: \\. | [^\"\\])* ["]) }x;
1216
1217 # 3. A regex which matches single-quoted strings.
1218 my $SingleQuotedStr = qr{ (?: \' (?: \\. | [^\'\\])* [']) }x;
1219
1220 # 4. Now combine 1 through 3 to produce a regex which
1221 #    matches _either_ double or single quoted strings
1222 #    OR comments. We surround the comment-matching
1223 #    regex in capturing parenthesis to store the contents
1224 #    of the comment in $1.
1225 #    my $commentAndStringRegex = qr{(?:$DoubleQuotedStr|$SingleQuotedStr)|($CComment)|($CppComment)};
1226
1227 # 4. Wireshark is strictly a C program so don't take out C++ style comments
1228 #    since they shouldn't be there anyway...
1229 #    Also: capturing the comment isn't necessary.
1230 my $commentAndStringRegex = qr{ (?: $DoubleQuotedStr | $SingleQuotedStr | $CComment) }x;
1231
1232 #### Regex for use when searching for value-string definitions
1233 my $StaticRegex             = qr/ static \s+                                                            /xs;
1234 my $ConstRegex              = qr/ const  \s+                                                            /xs;
1235 my $Static_andor_ConstRegex = qr/ (?: $StaticRegex $ConstRegex | $StaticRegex | $ConstRegex)            /xs;
1236 my $ValueStringRegex        = qr/ $Static_andor_ConstRegex value_string \ + [^;*]+ = [^;]+ [{] [^;]+ ;  /xs;
1237
1238 #
1239 # MAIN
1240 #
1241 my $errorCount = 0;
1242 # The default list, which can be expanded.
1243 my @apiGroups = qw(prohibited deprecated);
1244 my @apiSummaryGroups = ();
1245 my $check_value_string_array_null_termination = 1;      # default: enabled
1246 my $machine_readable_output = 0;                        # default: disabled
1247 my $check_hf = 1;                                       # default: enabled
1248 my $debug_flag = 0;
1249
1250 my $result = GetOptions(
1251                         'group=s' => \@apiGroups,
1252                         'summary-group=s' => \@apiSummaryGroups,
1253                         'check-value-string-array-null-termination!' => \$check_value_string_array_null_termination,
1254                         'Machine-readable' => \$machine_readable_output,
1255                         'nohf' => \$check_hf,
1256                         'debug' => \$debug_flag
1257                         );
1258 if (!$result) {
1259         print "Usage: checkAPIs.pl [-M] [-g group1] [-g group2] ... [-s group1] [-s group2] ... [--nocheck-value-string-array-null-termination] file1 file2 ..\n";
1260         print "       -g <group>:  Check input files for use of APIs in <group> (in addition to the default groups)\n";
1261         print "       -s <group>:  Output summary (count) for each API in <group> (-g <group> also req'd)\n";
1262         print "       -M: Generate output for -g in 'machine-readable' format\n";
1263         print "\n";
1264         print "   Default Groups[-g]: ", join (", ", sort @apiGroups), "\n";
1265         print "   Available Groups:   ", join (", ", sort keys %APIs), "\n";
1266         exit(1);
1267 }
1268
1269 # Add a 'function_count' anonymous hash to each of the 'apiGroup' entries in the %APIs hash.
1270 for my $apiGroup (keys %APIs) {
1271         my @functions = @{$APIs{$apiGroup}{functions}};
1272
1273         $APIs{$apiGroup}->{function_counts}   = {};
1274         @{$APIs{$apiGroup}->{function_counts}}{@functions} = ();  # Add fcn names as keys to the anonymous hash
1275 }
1276
1277
1278 # Read through the files; do various checks
1279 while ($_ = $ARGV[0])
1280 {
1281         shift;
1282         my $filename = $_;
1283         my $fileContents = '';
1284         my @foundAPIs = ();
1285         my $line;
1286
1287         die "No such file: \"$filename\"" if (! -e $filename);
1288
1289         # delete leading './'
1290         $filename =~ s{ ^ \. / } {}xo;
1291
1292         # Read in the file (ouch, but it's easier that way)
1293         open(FC, $filename) || die("Couldn't open $filename");
1294         $line = 1;
1295         while (<FC>) {
1296                 $fileContents .= $_;
1297                 if ($_ =~ m{ [\x80-\xFF] }xo) {
1298                         print STDERR "Error: Found non-ASCII characters on line " .$line. " of " .$filename."\n";
1299                         $errorCount++;
1300                 }
1301                 $line++;
1302         }
1303         close(FC);
1304
1305         if ($fileContents =~ m{ %ll }xo)
1306         {
1307                 # use G_GINT64_MODIFIER instead of ll
1308                 print STDERR "Error: Found %ll in " .$filename."\n";
1309                 $errorCount++;
1310         }
1311         if ($fileContents =~ m{ %hh }xo)
1312         {
1313                 # %hh is C99 and Windows doesn't like it:
1314                 # http://connect.microsoft.com/VisualStudio/feedback/details/416843/sscanf-cannot-not-handle-hhd-format
1315                 # Need to use temporary variables instead.
1316                 print STDERR "Error: Found %hh in " .$filename."\n";
1317                 $errorCount++;
1318         }
1319
1320         if (! ($fileContents =~ m{ \$Id .* \$ }xo))
1321         {
1322                 print STDERR "Warning: ".$filename." does not have an SVN Id tag.\n";
1323         }
1324
1325         # optionally check the hf entries
1326         if ($check_hf) {
1327                 $errorCount += check_hf_entries(\$fileContents, $filename);
1328         }
1329
1330         # Remove all the C-comments and strings
1331         $fileContents =~ s {$commentAndStringRegex} []xog;
1332
1333         #check_ett_registration(\$fileContents, $filename);
1334
1335         if ($fileContents =~ m{ // }xo)
1336         {
1337                 print STDERR "Error: Found C++ style comments in " .$filename."\n";
1338                 $errorCount++;
1339         }
1340
1341         #checkAPIsCalledWithTvbGetPtr(\@TvbPtrAPIs, \$fileContents, \@foundAPIs);
1342
1343         #if (@foundAPIs) {
1344         #       print STDERR "Found APIs with embedded tvb_get_ptr() calls in ".$filename.": ".join(',', @foundAPIs)."\n"
1345         #}
1346
1347         # Brute force check for value_string arrays which are missing {0, NULL} as the final (terminating) array entry
1348         if ($check_value_string_array_null_termination) {
1349                 #  Assumption: definition is of form (pseudo-Regex):
1350                 #    " (static const|static|const) value_string .+ = { .+ ;" (possibly over multiple lines)
1351                 while ($fileContents =~ / ( $ValueStringRegex ) /xsog) {
1352                         # value_string array definition found; check if NULL terminated
1353                         my $vs = my $vsx = $1;
1354                         if ($debug_flag) {
1355                                 $vsx =~ / ( .+ value_string [^=]+ ) = /xo;
1356                                 printf STDERR "==> %-35.35s: %s\n", $filename, $1;
1357                                 printf STDERR "%s\n", $vs;
1358                         }
1359                         $vs =~ s{ \s } {}xg;
1360                         # README.developer says
1361                         #  "Don't put a comma after the last tuple of an initializer of an array"
1362                         # However: since this usage is present in some number of cases, we'll allow for now
1363                         if ($vs !~ / , NULL [}] ,? [}] ; $/xo) {
1364                                 $vsx =~ /( value_string [^=]+ ) = /xo;
1365                                 printf STDERR "Error: %-35.35s: {0, NULL} is required as the last value_string array entry: %s\n", $filename, $1;
1366                                 $errorCount++;
1367                         }
1368                         if ($vs !~ / (static)? const value_string /xo)  {
1369                                 $vsx =~ /( value_string [^=]+ ) = /xo;
1370                                 printf STDERR "Error: %-35.35s: Missing 'const': %s\n", $filename, $1;
1371                                 $errorCount++;
1372                         }
1373                 }
1374         }
1375
1376         # Check and count APIs
1377         for my $apiGroup (@apiGroups) {
1378                 my $pfx = "Warning";
1379                 @foundAPIs = ();
1380
1381                 findAPIinFile($APIs{$apiGroup}, \$fileContents, \@foundAPIs);
1382
1383                 if ($APIs{$apiGroup}->{count_errors}) {
1384                         # the use of "prohibited" APIs is an error, increment the error count
1385                         $errorCount += @foundAPIs;
1386                         $pfx = "Error";
1387                 }
1388
1389                 if (@foundAPIs && ! $machine_readable_output) {
1390                         print STDERR $pfx . ": Found " . $apiGroup . " APIs in ".$filename.": ".join(',', @foundAPIs)."\n";
1391                 }
1392                 if (@foundAPIs && $machine_readable_output) {
1393                         for my $api (@foundAPIs) {
1394                                 printf STDERR "%-8.8s %-20.20s %-30.30s %-45.45s\n", $pfx, $apiGroup, $filename, $api;
1395                         }
1396                 }
1397         }
1398 }
1399
1400 # Summary: Print Use Counts of each API in each requested summary group
1401
1402 for my $apiGroup (@apiSummaryGroups) {
1403         printf "\n\nUse Counts\n";
1404         for my $api (sort {"\L$a" cmp "\L$b"} (keys %{$APIs{$apiGroup}->{function_counts}}   )) {
1405                 printf "%-20.20s %5d  %-40.40s\n", $apiGroup . ':', $APIs{$apiGroup}{function_counts}{$api}, $api;
1406         }
1407 }
1408
1409 exit($errorCount);
1410