gtk_entry_append_text no longer used by Wireshark: Mark as deprecated-gtk ('W" =...
[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                 'vsprintf',
53                 'strcpy',
54                 'strncpy',
55                 'strcat',
56                 'strncat',
57                 'cftime',
58                 'ascftime',
59                 ### non-portable APIs
60                 # use glib (g_*) versions instead of these:
61                 'ntohl',
62                 'ntohs',
63                 'htonl',
64                 'htons',
65                 'strdup',
66                 'strndup',
67                 ### non-ANSI C
68                 # use memset, memcpy, memcmp instead of these:
69                 'bzero',
70                 'bcopy',
71                 'bcmp',
72                 # use ep_*, se_*, or g_* functions instead of these:
73                 # (One thing to be aware of is that space allocated with malloc()
74                 # may not be freeable--at least on Windows--with g_free() and
75                 # vice-versa.)
76                 'malloc',
77                 'calloc',
78                 'realloc',
79                 'valloc',
80                 'free',
81                 'cfree',
82                 # Locale-unsafe APIs
83                 # These may have unexpected behaviors in some locales (e.g.,
84                 # "I" isn't always the upper-case form of "i", and "i" isn't
85                 # always the lower-case form of "I").  Use the g_ascii_* version
86                 # instead.
87                 'strcasecmp',
88                 'strncasecmp',
89                 'g_strcasecmp',
90                 'g_strncasecmp',
91                 'g_strup',
92                 'g_strdown',
93                 'g_string_up',
94                 'g_string_down',
95                 # Use the ws_* version of these:
96                 # (Necessary because on Windows we use UTF8 for throughout the code
97                 # so we must tweak that to UTF16 before operating on the file.  Code
98                 # using these functions will work unless the file/path name contains
99                 # non-ASCII chars.)
100                 'open',
101                 'rename',
102                 'mkdir',
103                 'stat',
104                 'unlink',
105                 'remove',
106                 'fopen',
107                 'freopen',
108                 # Misc
109                 'tmpnam'            # use mkstemp
110                 ] },
111
112         # APIs that SHOULD NOT be used in Wireshark (any more)
113         'deprecated' => { 'count_errors' => 1, 'functions' => [
114                 'perror',                            # Use strerror() and report messages in whatever
115                                                      #  fashion is appropriate for the code in question.
116                 'ctime',                             # Use abs_time_secs_to_str()
117                 ### Deprecated glib functions
118                 # (The list is based upon the GLib 2.22.3 documentation; Some of 
119                 #  the entries are are commented out since they are currently 
120                 #  being used in Wireshark and since the replacement functionality
121                 #  is not available in all the GLib versions that Wireshark
122                 #  currently supports (ie: versions starting with GLib 2.4).
123                 'g_async_queue_ref_unlocked',        # g_async_queue_ref()   (OK since 2.8)
124                 'g_async_queue_unref_and_unlock',    # g_async_queue_unref() (OK since 2.8)
125                 'g_basename',
126                 'g_cache_value_foreach',             # g_cache_key_foreach() 
127                 'g_date_set_time',                   # g_date_set_time_t (avail since 2.10)
128                 'g_dirname',
129                 'g_hash_table_freeze',
130                 'g_hash_table_thaw',
131                 'g_io_channel_close',
132                 'g_io_channel_read',
133                 'g_io_channel_seek',
134                 'g_io_channel_write',
135                 'g_main_destroy',
136                 'g_main_is_running',
137                 'g_main_iteration',
138                 'g_main_new',
139                 'g_main_pending',
140                 'g_main_quit',
141                 'g_main_run',
142                 'g_main_set_poll_func',
143                 'g_scanner_add_symbol',
144                 'g_scanner_remove_symbol',
145                 'g_scanner_foreach_symbol',
146                 'g_scanner_freeze_symbol_table',
147                 'g_scanner_thaw_symbol_table',
148                 'g_string_sprintf',                  # use g_string_printf() instead
149                 'g_string_sprintfa',                 # use g_string_append_printf instead
150                 'g_tree_traverse',
151                 'G_WIN32_DLLMAIN_FOR_DLL_NAME',
152                 'g_win32_get_package_installation_directory',
153                 'g_win32_get_package_installation_subdirectory',
154 ##
155 ## Following Deprecated as of GLib 2.10; to be replaced only when Wireshark requires GLib 2.10 or later
156 ## Note: Only the commented out items are currently used by Wireshark
157                 'g_allocator_free',                  # "use slice allocator" (avail since 2.10,2.14)
158                 'g_allocator_new',                   # "use slice allocator" (avail since 2.10,2.14)
159                 'g_list_pop_allocator',              # "does nothing since 2.10"
160                 'g_list_push_allocator',             # "does nothing since 2.10"
161 ### GMemChunks should used *only* with GLib < 2.10.
162 ###  There's an issue wherein GLib >= 2.10 g_mem_chunk_destroy doesn't actually free memory thus 
163 ###   leading to memory leaks.
164 ###  So: either replace GMemChunk use with something else altogether
165 ###      or use GMemChunks for GLib < 2.10 and GSlice (or whatever) for newer GLibs.
166 ## 2.10         'g_mem_chunk_alloc',                 # "use slice allocator" (avail since 2.10)
167 ## 2.10         'g_mem_chunk_alloc0',                # "use slice allocator" (avail since 2.10)
168                 'g_mem_chunk_clean',                 # "use slice allocator" (avail since 2.10)
169 ## 2.10         'g_mem_chunk_create',                # "use slice allocator" (avail since 2.10)
170 ## 2.10         'g_mem_chunk_destroy',               # "use slice allocator" (avail since 2.10)
171 ## 2.10         'g_mem_chunk_free',                  # "use slice allocator" (avail since 2.10)
172                 'g_mem_chunk_info',                  # "use slice allocator" (avail since 2.10)
173 ## 2.10         'g_mem_chunk_new',                   # "use slice allocator" (avail since 2.10)
174                 'g_mem_chunk_print',                 # "use slice allocator" (avail since 2.10)
175                 'g_mem_chunk_reset',                 # "use slice allocator" (avail since 2.10)
176                 'g_blow_chunks',                     # "use slice allocator" (avail since 2.10,2.14)
177 ## 2.10         'g_chunk_free',                      # g_slice_free (avail since 2.10)
178 ## 2.10         'g_chunk_new',                       # g_slice_new  (avail since 2.10)
179                 'g_chunk_new0',                      # g_slice_new0 (avail since 2.10)
180 ###
181                 'g_node_pop_allocator',              # "does nothing since 2.10"
182                 'g_node_push_allocator',             # "does nothing since 2.10"
183                 'g_slist_pop_allocator',             # "does nothing since 2.10"
184                 'g_slist_push_allocator',            # "does nothing since 2.10"
185 ## Following Deprecated as of GLib 2.22;
186 ## Note: Not currently used by Wireshark
187                 'g_mapped_file_free',                # [as of 2.22: use g_map_file_unref]
188                 ] },
189
190         # APIs that make the program exit. Dissectors shouldn't call these
191         'abort' => { 'count_errors' => 1, 'functions' => [
192                 'abort',
193                 'assert',
194                 'assert_perror',
195                 'exit',
196                 'g_assert',
197                 'g_error',
198                 ] },
199
200         # APIs that print to the terminal. Dissectors shouldn't call these
201         'termoutput' => { 'count_errors' => 0, 'functions' => [
202                 'printf',  
203                 ] },
204
205         # Deprecated GTK APIs
206         #  which SHOULD NOT be used in Wireshark (any more).
207         #  (Filled in from 'E' entries in %deprecatedGtkFunctions below)
208         'deprecated-gtk' => { 'count_errors' => 1, 'functions' => [
209                 ] },
210
211         # Deprecated GTK APIs yet to be replaced
212         #  (Filled in from 'W' entries in %deprecatedGtkFunctions below)
213         'deprecated-gtk-todo' => { 'count_errors' => 0, 'functions' => [
214                 ] },
215
216 );
217
218 # Deprecated GTK functions with (E)rror or (W)arning flag:
219 # (The list is based upon the GTK+ 2.18.5 documentation; Some of 
220 #  the entries are are commented out since they are currently 
221 #  being used in Wireshark and since the replacement functionality
222 #  is not available in all the GTK+ versions that Wireshark
223 #  currently supports (ie: versions starting with GTK+ 2.4).
224 # E: There should be no current Wireshark use so Error if seen;
225 # W: Not all Wireshark use yet fixed so Warn if seen; (Change to E as fixed)
226 my %deprecatedGtkFunctions = (
227                 'gtk_about_dialog_get_name',                   'E',
228                 'gtk_about_dialog_set_name',                   'E',
229                 'gtk_accel_group_ref',                         'E',
230                 'gtk_accel_group_unref',                       'E',
231                 'gtk_action_block_activate_from',              'E', # since 2.16
232                 'gtk_action_connect_proxy',                    'E', # since 2.16: use gtk_activatable_set_related_action() (as of 2.16)
233                 'gtk_action_disconnect_proxy',                 'E', # since 2.16: use gtk_activatable_set_related_action() (as of 2.16)
234                 'gtk_action_unblock_activate_from',            'E', # since 2.16
235                 'gtk_binding_entry_add',                       'E',
236                 'gtk_binding_entry_add_signall',               'E',
237                 'gtk_binding_entry_clear',                     'E',
238                 'gtk_binding_parse_binding',                   'E',
239                 'gtk_box_pack_end_defaults',                   'E',
240                 'gtk_box_pack_start_defaults',                 'E',
241                 'gtk_button_box_get_child_ipadding',           'E',
242                 'gtk_button_box_get_child_size',               'E',
243                 'gtk_button_box_get_spacing',                  'E',
244                 'gtk_button_box_set_child_ipadding',           'E', # style properties child-internal-pad-x/-y
245                 'gtk_button_box_set_child_size',               'E', # style properties child-min-width/-height
246                 'gtk_button_box_set_spacing',                  'E', # gtk_box_set_spacing [==]
247                 'gtk_calendar_display_options',                'E',
248                 'gtk_calendar_freeze',                         'E',
249                 'gtk_calendar_thaw',                           'E',
250                 'GTK_CELL_PIXMAP',                             'E', # GtkTreeView (& related) ...
251                 'GTK_CELL_PIXTEXT',                            'E',
252                 'gtk_cell_renderer_editing_canceled',          'E',
253                 'GTK_CELL_TEXT',                               'W',
254                 'GTK_CELL_WIDGET',                             'E',
255                 'GTK_CHECK_CAST',                              'E', # G_TYPE_CHECK_INSTANCE_CAST [==]
256                 'GTK_CHECK_CLASS_CAST',                        'E', # G_TYPE_CHECK_CLASS_CAST [==]
257                 'GTK_CHECK_CLASS_TYPE',                        'E', # G_TYPE_CHECK_CLASS_TYPE [==]
258                 'GTK_CHECK_GET_CLASS',                         'E', # G_TYPE_INSTANCE_GET_CLASS [==]
259                 'gtk_check_menu_item_set_show_toggle',         'E', # Does nothing; remove; [show_toggle is always TRUE]
260                 'gtk_check_menu_item_set_state',               'E',
261                 'GTK_CHECK_TYPE',                              'E', # G_TYPE_CHECK_INSTANCE_TYPE [==]
262                 'GTK_CLASS_NAME',                              'E',
263                 'GTK_CLASS_TYPE',                              'E',
264                 'GTK_CLIST_ADD_MODE',                          'E', # GtkTreeView (& related) ...
265                 'gtk_clist_append',                            'W',
266                 'GTK_CLIST_AUTO_RESIZE_BLOCKED',               'E',
267                 'GTK_CLIST_AUTO_SORT',                         'E',
268                 'gtk_clist_clear',                             'W',
269                 'gtk_clist_column_title_active',               'E',
270                 'gtk_clist_column_title_passive',              'E',
271                 'gtk_clist_column_titles_active',              'E',
272                 'gtk_clist_column_titles_hide',                'E',
273                 'gtk_clist_column_titles_passive',             'E',
274                 'gtk_clist_column_titles_show',                'W',
275                 'gtk_clist_columns_autosize',                  'E',
276                 'GTK_CLIST_DRAW_DRAG_LINE',                    'E',
277                 'GTK_CLIST_DRAW_DRAG_RECT',                    'E',
278                 'gtk_clist_find_row_from_data',                'W',
279                 'GTK_CLIST_FLAGS',                             'E',
280                 'gtk_clist_freeze',                            'W',
281                 'gtk_clist_get_cell_style',                    'E',
282                 'gtk_clist_get_cell_type',                     'E',
283                 'gtk_clist_get_column_title',                  'E',
284                 'gtk_clist_get_column_widget',                 'E',
285                 'gtk_clist_get_hadjustment',                   'E',
286                 'gtk_clist_get_pixmap',                        'E',
287                 'gtk_clist_get_pixtext',                       'E',
288                 'gtk_clist_get_row_data',                      'W',
289                 'gtk_clist_get_row_style',                     'E',
290                 'gtk_clist_get_selectable',                    'E',
291                 'gtk_clist_get_selection_info',                'W',
292                 'gtk_clist_get_text',                          'W',
293                 'gtk_clist_get_vadjustment',                   'W',
294                 'GTK_CLIST_IN_DRAG',                           'E',
295                 'gtk_clist_insert',                            'E',
296                 'gtk_clist_moveto',                            'W',
297                 'gtk_clist_new',                               'W',
298                 'gtk_clist_new_with_titles',                   'E',
299                 'gtk_clist_optimal_column_width',              'E',
300                 'gtk_clist_prepend',                           'E',
301                 'gtk_clist_remove',                            'W',
302                 'GTK_CLIST_REORDERABLE',                       'E',
303                 'GTK_CLIST_ROW',                               'E',
304                 'GTK_CLIST_ROW_HEIGHT_SET',                    'E',
305                 'gtk_clist_row_is_visible',                    'W',
306                 'gtk_clist_row_move',                          'E',
307                 'gtk_clist_select_all',                        'W',
308                 'gtk_clist_select_row',                        'W',
309                 'gtk_clist_set_auto_sort',                     'E',
310                 'gtk_clist_set_background',                    'W',
311                 'gtk_clist_set_button_actions',                'E',
312                 'gtk_clist_set_cell_style',                    'E',
313                 'gtk_clist_set_column_auto_resize',            'W',
314                 'gtk_clist_set_column_justification',          'W',
315                 'gtk_clist_set_column_max_width',              'E',
316                 'gtk_clist_set_column_min_width',              'E',
317                 'gtk_clist_set_column_resizeable',             'W',
318                 'gtk_clist_set_column_title',                  'W',
319                 'gtk_clist_set_column_visibility',             'E',
320                 'gtk_clist_set_column_widget',                 'W',
321                 'gtk_clist_set_column_width',                  'W',
322                 'gtk_clist_set_compare_func',                  'W',
323                 'GTK_CLIST_SET_FLAG',                          'E',
324                 'gtk_clist_set_foreground',                    'W',
325                 'gtk_clist_set_hadjustment',                   'E',
326                 'gtk_clist_set_pixmap',                        'E',
327                 'gtk_clist_set_pixtext',                       'E',
328                 'gtk_clist_set_reorderable',                   'E',
329                 'gtk_clist_set_row_data',                      'W',
330                 'gtk_clist_set_row_data_full',                 'E',
331                 'gtk_clist_set_row_height',                    'E',
332                 'gtk_clist_set_row_style',                     'E',
333                 'gtk_clist_set_selectable',                    'E',
334                 'gtk_clist_set_selection_mode',                'W',
335                 'gtk_clist_set_shadow_type',                   'W',
336                 'gtk_clist_set_shift',                         'E',
337                 'gtk_clist_set_sort_column',                   'W',
338                 'gtk_clist_set_sort_type',                     'W',
339                 'gtk_clist_set_text',                          'W',
340                 'gtk_clist_set_use_drag_icons',                'E',
341                 'gtk_clist_set_vadjustment',                   'E',
342                 'GTK_CLIST_SHOW_TITLES',                       'E',
343                 'gtk_clist_sort',                              'W',
344                 'gtk_clist_swap_rows',                         'W',
345                 'gtk_clist_thaw',                              'W',
346                 'gtk_clist_undo_selection',                    'E',
347                 'gtk_clist_unselect_all',                      'W',
348                 'gtk_clist_unselect_row',                      'E',
349                 'GTK_CLIST_UNSET_FLAG',                        'E',
350                 'GTK_CLIST_USE_DRAG_ICONS',                    'E',
351                 'gtk_color_selection_get_color',               'E',
352                 'gtk_color_selection_set_change_palette_hook', 'E', 
353                 'gtk_color_selection_set_color',               'E',
354                 'gtk_color_selection_set_update_policy',       'E',
355                 'gtk_combo_disable_activate',                  'W', # GtkComboBox ... (avail since 2.4/2.6/2.10/2.14)
356                 'gtk_combo_new',                               'W',
357                 'gtk_combo_set_case_sensitive',                'W',
358                 'gtk_combo_set_item_string',                   'E',
359                 'gtk_combo_set_popdown_strings',               'W',
360                 'gtk_combo_set_use_arrows',                    'E',
361                 'gtk_combo_set_use_arrows_always',             'E',
362                 'gtk_combo_set_value_in_list',                 'E',
363                 'gtk_container_border_width',                  'E', # gtk_container_set_border_width [==]
364                 'gtk_container_children',                      'E', # gtk_container_get_children [==]
365                 'gtk_container_foreach_full',                  'E',
366                 'gtk_ctree_collapse',                          'E',
367                 'gtk_ctree_collapse_recursive',                'E',
368                 'gtk_ctree_collapse_to_depth',                 'E',
369                 'gtk_ctree_expand',                            'E',
370                 'gtk_ctree_expand_recursive',                  'E',
371                 'gtk_ctree_expand_to_depth',                   'E',
372                 'gtk_ctree_export_to_gnode',                   'E',
373                 'gtk_ctree_find',                              'E',
374                 'gtk_ctree_find_all_by_row_data',              'E',
375                 'gtk_ctree_find_all_by_row_data_custom',       'E',
376                 'gtk_ctree_find_by_row_data',                  'E',
377                 'gtk_ctree_find_by_row_data_custom',           'E',
378                 'gtk_ctree_find_node_ptr',                     'E',
379                 'GTK_CTREE_FUNC',                              'E',
380                 'gtk_ctree_get_node_info',                     'E',
381                 'gtk_ctree_insert_gnode',                      'E',
382                 'gtk_ctree_insert_node',                       'E',
383                 'gtk_ctree_is_ancestor',                       'E',
384                 'gtk_ctree_is_hot_spot',                       'E',
385                 'gtk_ctree_is_viewable',                       'E',
386                 'gtk_ctree_last',                              'E',
387                 'gtk_ctree_move',                              'E',
388                 'gtk_ctree_new',                               'E',
389                 'gtk_ctree_new_with_titles',                   'E',
390                 'GTK_CTREE_NODE',                              'E',
391                 'gtk_ctree_node_get_cell_style',               'E',
392                 'gtk_ctree_node_get_cell_type',                'E',
393                 'gtk_ctree_node_get_pixmap',                   'E',
394                 'gtk_ctree_node_get_pixtext',                  'E',
395                 'gtk_ctree_node_get_row_data',                 'E',
396                 'gtk_ctree_node_get_row_style',                'E',
397                 'gtk_ctree_node_get_selectable',               'E',
398                 'gtk_ctree_node_get_text',                     'E',
399                 'gtk_ctree_node_is_visible',                   'E',
400                 'gtk_ctree_node_moveto',                       'E',
401                 'GTK_CTREE_NODE_NEXT',                         'E',
402                 'gtk_ctree_node_nth',                          'E',
403                 'GTK_CTREE_NODE_PREV',                         'E',
404                 'gtk_ctree_node_set_background',               'E',
405                 'gtk_ctree_node_set_cell_style',               'E',
406                 'gtk_ctree_node_set_foreground',               'E',
407                 'gtk_ctree_node_set_pixmap',                   'E',
408                 'gtk_ctree_node_set_pixtext',                  'E',
409                 'gtk_ctree_node_set_row_data',                 'E',
410                 'gtk_ctree_node_set_row_data_full',            'E',
411                 'gtk_ctree_node_set_row_style',                'E',
412                 'gtk_ctree_node_set_selectable',               'E',
413                 'gtk_ctree_node_set_shift',                    'E',
414                 'gtk_ctree_node_set_text',                     'E',
415                 'gtk_ctree_post_recursive',                    'E',
416                 'gtk_ctree_post_recursive_to_depth',           'E',
417                 'gtk_ctree_pre_recursive',                     'E',
418                 'gtk_ctree_pre_recursive_to_depth',            'E',
419                 'gtk_ctree_real_select_recursive',             'E',
420                 'gtk_ctree_remove_node',                       'E',
421                 'GTK_CTREE_ROW',                               'E',
422                 'gtk_ctree_select',                            'E',
423                 'gtk_ctree_select_recursive',                  'E',
424                 'gtk_ctree_set_drag_compare_func',             'E',
425                 'gtk_ctree_set_expander_style',                'E',
426                 'gtk_ctree_set_indent',                        'E',
427                 'gtk_ctree_set_line_style',                    'E',
428                 'gtk_ctree_set_node_info',                     'E',
429                 'gtk_ctree_set_reorderable',                   'E',
430                 'gtk_ctree_set_show_stub',                     'E',
431                 'gtk_ctree_set_spacing',                       'E',
432                 'gtk_ctree_sort_node',                         'E',
433                 'gtk_ctree_sort_recursive',                    'E',
434                 'gtk_ctree_toggle_expansion',                  'E',
435                 'gtk_ctree_toggle_expansion_recursive',        'E',
436                 'gtk_ctree_unselect',                          'E',
437                 'gtk_ctree_unselect_recursive',                'E',
438                 'gtk_drag_set_default_icon',                   'E',
439                 'gtk_draw_arrow',                              'E',
440                 'gtk_draw_box',                                'E',
441                 'gtk_draw_box_gap',                            'E',
442                 'gtk_draw_check',                              'E',
443                 'gtk_draw_diamond',                            'E',
444                 'gtk_draw_expander',                           'E',
445                 'gtk_draw_extension',                          'E',
446                 'gtk_draw_flat_box',                           'E',
447                 'gtk_draw_focus',                              'E',
448                 'gtk_draw_handle',                             'E',
449                 'gtk_draw_hline',                              'E',
450                 'gtk_draw_layout',                             'E',
451                 'gtk_draw_option',                             'E',
452                 'gtk_draw_polygon',                            'E',
453                 'gtk_draw_resize_grip',                        'E',
454                 'gtk_draw_shadow',                             'E',
455                 'gtk_draw_shadow_gap',                         'E',
456                 'gtk_draw_slider',                             'E',
457                 'gtk_draw_string',                             'E',
458                 'gtk_draw_tab',                                'E',
459                 'gtk_draw_vline',                              'E',
460                 'gtk_drawing_area_size',                       'E', # >> g_object_set() [==] ? 
461                                                                     #    gtk_widget_set_size_request() [==?]
462                 'gtk_entry_append_text',                       'E', # >> gtk_editable_insert_text() [==?]
463                 'gtk_entry_new_with_max_length',               'E', # gtk_entry_new(); gtk_entry_set_max_length()
464                 'gtk_entry_prepend_text',                      'E',
465                 'gtk_entry_select_region',                     'E',
466                 'gtk_entry_set_editable',                      'E', # >> gtk_editable_set_editable() [==?]
467                 'gtk_entry_set_position',                      'E',
468                 'gtk_exit',                                    'E', # exit() [==]
469                 'gtk_file_chooser_button_new_with_backend',    'E',
470                 'gtk_file_chooser_dialog_new_with_backend',    'E',
471                 'gtk_file_chooser_widget_new_with_backend',    'E',
472                 'gtk_file_selection_complete',                 'E',
473                 'gtk_file_selection_get_filename',             'E', # GtkFileChooser ...
474                 'gtk_file_selection_get_select_multiple',      'E',
475                 'gtk_file_selection_get_selections',           'E',
476                 'gtk_file_selection_hide_fileop_buttons',      'E',
477                 'gtk_file_selection_new',                      'E',
478                 'gtk_file_selection_set_filename',             'E',
479                 'gtk_file_selection_set_select_multiple',      'E',
480                 'gtk_file_selection_show_fileop_buttons',      'E',
481                 'gtk_font_selection_dialog_get_apply_button',  'E',
482                 'gtk_font_selection_dialog_get_font',          'E',
483                 'gtk_font_selection_get_font',                 'E', # gtk_font_selection_get_font_name [!=]
484                 'GTK_FUNDAMENTAL_TYPE',                        'E',
485                 'gtk_hbutton_box_get_layout_default',          'E',
486                 'gtk_hbutton_box_get_spacing_default',         'E',
487                 'gtk_hbutton_box_set_layout_default',          'E',
488                 'gtk_hbutton_box_set_spacing_default',         'E',
489                 'gtk_idle_add',                                'E',
490                 'gtk_idle_add_full',                           'E',
491                 'gtk_idle_add_priority',                       'E',
492                 'gtk_idle_remove',                             'E',
493                 'gtk_idle_remove_by_data',                     'E',
494                 'gtk_image_get',                               'E',
495                 'gtk_image_set',                               'E',
496                 'gtk_input_add_full',                          'W', # >>> g_io_add_watch_full()
497                 'gtk_input_remove',                            'W', # >>> g_source_remove()
498                 'GTK_IS_ROOT_TREE',                            'E',
499                 'gtk_item_factories_path_delete',              'E', # GtkUIManager (avail since 2.4) ...
500                 'gtk_item_factory_add_foreign',                'E',
501                 'gtk_item_factory_construct',                  'E',
502                 'gtk_item_factory_create_item',                'W',
503                 'gtk_item_factory_create_items',               'E',
504                 'gtk_item_factory_create_items_ac',            'W',
505                 'gtk_item_factory_create_menu_entries',        'E',
506                 'gtk_item_factory_delete_entries',             'E',
507                 'gtk_item_factory_delete_entry',               'E',
508                 'gtk_item_factory_delete_item',                'E',
509                 'gtk_item_factory_from_path',                  'E',
510                 'gtk_item_factory_from_widget',                'E',
511                 'gtk_item_factory_get_item',                   'E',
512                 'gtk_item_factory_get_item_by_action',         'E',
513                 'gtk_item_factory_get_widget',                 'W',
514                 'gtk_item_factory_get_widget_by_action',       'E',
515                 'gtk_item_factory_new',                        'W',
516                 'gtk_item_factory_path_from_widget',           'E',
517                 'gtk_item_factory_popup',                      'E',
518                 'gtk_item_factory_popup_data',                 'E',
519                 'gtk_item_factory_popup_data_from_widget',     'E',
520                 'gtk_item_factory_popup_with_data',            'E',
521                 'gtk_item_factory_set_translate_func',         'E',
522                 'gtk_label_get',                               'E', # gtk_label_get_text() [!=]
523                 'gtk_label_parse_uline',                       'E',
524                 'gtk_label_set',                               'E', # gtk_label_set_text() [==]
525                 'gtk_layout_freeze',                           'E',
526                 'gtk_layout_thaw',                             'E',
527                 'gtk_list_append_items',                       'E',
528                 'gtk_list_child_position',                     'E',
529                 'gtk_list_clear_items',                        'E',
530                 'gtk_list_end_drag_selection',                 'E',
531                 'gtk_list_end_selection',                      'E',
532                 'gtk_list_extend_selection',                   'E',
533                 'gtk_list_insert_items',                       'E',
534                 'gtk_list_item_deselect',                      'E',
535                 'gtk_list_item_new',                           'E',
536                 'gtk_list_item_new_with_label',                'E',
537                 'gtk_list_item_select',                        'E',
538                 'gtk_list_new',                                'E',
539                 'gtk_list_prepend_items',                      'E',
540                 'gtk_list_remove_items',                       'E',
541                 'gtk_list_remove_items_no_unref',              'E',
542                 'gtk_list_scroll_horizontal',                  'E',
543                 'gtk_list_scroll_vertical',                    'E',
544                 'gtk_list_select_all',                         'E',
545                 'gtk_list_select_child',                       'E',
546                 'gtk_list_select_item',                        'E',
547                 'gtk_list_set_selection_mode',                 'E',
548                 'gtk_list_start_selection',                    'E',
549                 'gtk_list_toggle_add_mode',                    'E',
550                 'gtk_list_toggle_focus_row',                   'E',
551                 'gtk_list_toggle_row',                         'E',
552                 'gtk_list_undo_selection',                     'E',
553                 'gtk_list_unselect_all',                       'E',
554                 'gtk_list_unselect_child',                     'E',
555                 'gtk_list_unselect_item',                      'E',
556                 'gtk_menu_append',                             'E', # gtk_menu_shell_append() [==?]
557                 'gtk_menu_bar_append',                         'E',
558                 'gtk_menu_bar_insert',                         'E',
559                 'gtk_menu_bar_prepend',                        'E',
560                 'gtk_menu_insert',                             'E',
561                 'gtk_menu_item_remove_submenu',                'E',
562                 'gtk_menu_item_right_justify',                 'E',
563                 'gtk_menu_prepend',                            'E', # gtk_menu_shell_prepend() [==?]
564                 'gtk_menu_tool_button_set_arrow_tooltip',      'E',
565                 'gtk_notebook_current_page',                   'E',
566                 'gtk_notebook_get_group_id',                   'E',
567                 'gtk_notebook_set_group_id',                   'E',
568                 'gtk_notebook_set_homogeneous_tabs',           'E',
569                 'gtk_notebook_set_page',                       'E', # gtk_notebook_set_current_page() [==]
570                 'gtk_notebook_set_tab_border',                 'E',
571                 'gtk_notebook_set_tab_hborder',                'E',
572                 'gtk_notebook_set_tab_vborder',                'E',
573                 'gtk_object_add_arg_type',                     'E',
574                 'gtk_object_data_force_id',                    'E',
575                 'gtk_object_data_try_key',                     'E',
576                 'GTK_OBJECT_FLOATING',                         'E',
577                 'gtk_object_get',                              'E',
578                 'gtk_object_get_data',                         'E',
579                 'gtk_object_get_data_by_id',                   'E',
580                 'gtk_object_get_user_data',                    'E',
581                 'gtk_object_new',                              'E',
582                 'gtk_object_ref',                              'E',
583                 'gtk_object_remove_data',                      'E',
584                 'gtk_object_remove_data_by_id',                'E',
585                 'gtk_object_remove_no_notify',                 'E',
586                 'gtk_object_remove_no_notify_by_id',           'E',
587                 'gtk_object_set',                              'E',
588                 'gtk_object_set_data',                         'E',
589                 'gtk_object_set_data_by_id',                   'E',
590                 'gtk_object_set_data_by_id_full',              'E',
591                 'gtk_object_set_data_full',                    'E',
592                 'gtk_object_set_user_data',                    'E',
593                 'gtk_object_sink',                             'E',
594                 'gtk_object_unref',                            'E',
595                 'gtk_object_weakref',                          'E',
596                 'gtk_object_weakunref',                        'E',
597                 'gtk_old_editable_changed',                    'E',
598                 'gtk_old_editable_claim_selection',            'E',
599                 'gtk_option_menu_get_history',                 'E', # GtkComboBox ... (avail since 2.4/2.6/2.10/2.14)
600                 'gtk_option_menu_get_menu',                    'E',
601                 'gtk_option_menu_new',                         'W',
602                 'gtk_option_menu_remove_menu',                 'W',
603                 'gtk_option_menu_set_history',                 'W',
604                 'gtk_option_menu_set_menu',                    'W',
605                 'gtk_paint_string',                            'E',
606                 'gtk_paned_gutter_size',                       'E', # gtk_paned_set_gutter_size()
607                 'gtk_paned_set_gutter_size',                   'E', # "does nothing"
608                 'gtk_pixmap_get',                              'E', # GtkImage ...
609                 'gtk_pixmap_new',                              'E',
610                 'gtk_pixmap_set',                              'E',
611                 'gtk_pixmap_set_build_insensitive',            'E',
612                 'gtk_preview_draw_row',                        'E',
613                 'gtk_preview_get_cmap',                        'E',
614                 'gtk_preview_get_info',                        'E',
615                 'gtk_preview_get_visual',                      'E',
616                 'gtk_preview_new',                             'E',
617                 'gtk_preview_put',                             'E',
618                 'gtk_preview_reset',                           'E',
619                 'gtk_preview_set_color_cube',                  'E',
620                 'gtk_preview_set_dither',                      'E',
621                 'gtk_preview_set_expand',                      'E',
622                 'gtk_preview_set_gamma',                       'E',
623                 'gtk_preview_set_install_cmap',                'E',
624                 'gtk_preview_set_reserved',                    'E',
625                 'gtk_preview_size',                            'E',
626                 'gtk_preview_uninit',                          'E',
627                 'gtk_progress_bar_new_with_adjustment',        'E',
628                 'gtk_progress_bar_set_activity_blocks',        'E',
629                 'gtk_progress_bar_set_activity_step',          'E',
630                 'gtk_progress_bar_set_bar_style',              'E',
631                 'gtk_progress_bar_set_discrete_blocks',        'E',
632                 'gtk_progress_bar_update',                     'E', # >>> "gtk_progress_set_value() or 
633                                                                     #    gtk_progress_set_percentage()" 
634                                                                     ##  Actually: GtkProgress is deprecated so the 
635                                                                     ##  right answer appears to be to use 
636                                                                     ##  gtk_progress_bar_set_fraction()
637                 'gtk_progress_configure',                      'E',
638                 'gtk_progress_get_current_percentage',         'E',
639                 'gtk_progress_get_current_text',               'E',
640                 'gtk_progress_get_percentage_from_value',      'E',
641                 'gtk_progress_get_text_from_value',            'E',
642                 'gtk_progress_get_value',                      'E',
643                 'gtk_progress_set_activity_mode',              'E',
644                 'gtk_progress_set_adjustment',                 'E',
645                 'gtk_progress_set_format_string',              'E',
646                 'gtk_progress_set_percentage',                 'E',
647                 'gtk_progress_set_show_text',                  'E',
648                 'gtk_progress_set_text_alignment',             'E',
649                 'gtk_progress_set_value',                      'E',
650                 'gtk_radio_button_group',                      'E', # gtk_radio_button_get_group() [==]
651                 'gtk_radio_menu_item_group',                   'E',
652                 'gtk_rc_add_class_style',                      'E',
653                 'gtk_rc_add_widget_class_style',               'E',
654                 'gtk_rc_add_widget_name_style',                'E',
655                 'gtk_rc_style_ref',                            'E',
656                 'gtk_rc_style_unref',                          'E',
657                 'gtk_recent_chooser_get_show_numbers',         'E',
658                 'gtk_recent_chooser_set_show_numbers',         'E',
659                 'gtk_recent_manager_get_for_screen',           'E',
660                 'gtk_recent_manager_set_screen',               'E',
661                 'GTK_RETLOC_BOOL',                             'E',
662                 'GTK_RETLOC_BOXED',                            'E',
663                 'GTK_RETLOC_CHAR',                             'E',
664                 'GTK_RETLOC_DOUBLE',                           'E',
665                 'GTK_RETLOC_ENUM',                             'E',
666                 'GTK_RETLOC_FLAGS',                            'E',
667                 'GTK_RETLOC_FLOAT',                            'E',
668                 'GTK_RETLOC_INT',                              'E',
669                 'GTK_RETLOC_LONG',                             'E',
670                 'GTK_RETLOC_OBJECT',                           'E',
671                 'GTK_RETLOC_POINTER',                          'E',
672                 'GTK_RETLOC_STRING',                           'E',
673                 'GTK_RETLOC_UCHAR',                            'E',
674                 'GTK_RETLOC_UINT',                             'E',
675                 'GTK_RETLOC_ULONG',                            'E',
676                 'gtk_selection_clear',                         'E',
677                 'gtk_signal_connect',                          'E', # GSignal ...
678                 'gtk_signal_connect_after',                    'E',
679                 'gtk_signal_connect_full',                     'E',
680                 'gtk_signal_connect_object',                   'E',
681                 'gtk_signal_connect_object_after',             'E',
682                 'gtk_signal_connect_object_while_alive',       'E',
683                 'gtk_signal_connect_while_alive',              'E',
684                 'gtk_signal_default_marshaller',               'E',
685                 'gtk_signal_disconnect',                       'E',
686                 'gtk_signal_disconnect_by_data',               'E',
687                 'gtk_signal_disconnect_by_func',               'E',
688                 'gtk_signal_emit',                             'E',
689                 'gtk_signal_emit_by_name',                     'E',
690                 'gtk_signal_emit_stop',                        'E',
691                 'gtk_signal_emit_stop_by_name',                'E',
692                 'gtk_signal_emitv',                            'E',
693                 'gtk_signal_emitv_by_name',                    'E',
694                 'GTK_SIGNAL_FUNC',                             'E',
695                 'gtk_signal_handler_block',                    'E',
696                 'gtk_signal_handler_block_by_data',            'E',
697                 'gtk_signal_handler_block_by_func',            'E',
698                 'gtk_signal_handler_pending',                  'E',
699                 'gtk_signal_handler_pending_by_func',          'E',
700                 'gtk_signal_handler_unblock',                  'E',
701                 'gtk_signal_handler_unblock_by_data',          'E',
702                 'gtk_signal_handler_unblock_by_func',          'E',
703                 'gtk_signal_lookup',                           'E',
704                 'gtk_signal_name',                             'E',
705                 'gtk_signal_new',                              'E',
706                 'gtk_signal_newv',                             'E',
707                 'GTK_SIGNAL_OFFSET',                           'E',
708                 'gtk_socket_steal',                            'E',
709                 'gtk_spin_button_get_value_as_float',          'E', # gtk_spin_button_get_value() [==]
710                 'GTK_STRUCT_OFFSET',                           'E',
711                 'gtk_style_apply_default_pixmap',              'E',
712                 'gtk_style_get_font',                          'E',
713                 'gtk_style_ref',                               'E',
714                 'gtk_style_set_font',                          'E',
715                 'gtk_style_unref',                             'E', # g_object_unref() [==?]
716                 'gtk_text_backward_delete',                    'E',
717                 'gtk_text_forward_delete',                     'E',
718                 'gtk_text_freeze',                             'E',
719                 'gtk_text_get_length',                         'E',
720                 'gtk_text_get_point',                          'E',
721                 'GTK_TEXT_INDEX',                              'E',
722                 'gtk_text_insert',                             'E', # GtkTextView (GtkText "known to be buggy" !)
723                 'gtk_text_new',                                'E',
724                 'gtk_text_set_adjustments',                    'E',
725                 'gtk_text_set_editable',                       'E',
726                 'gtk_text_set_line_wrap',                      'E',
727                 'gtk_text_set_point',                          'E',
728                 'gtk_text_set_word_wrap',                      'E',
729                 'gtk_text_thaw',                               'E',
730                 'gtk_timeout_add',                             'E', # g_timeout_add()
731                 'gtk_timeout_add_full',                        'E',
732                 'gtk_timeout_remove',                          'E', # g_source_remove()
733                 'gtk_tips_query_new',                          'E',
734                 'gtk_tips_query_set_caller',                   'E',
735                 'gtk_tips_query_set_labels',                   'E',
736                 'gtk_tips_query_start_query',                  'E',
737                 'gtk_tips_query_stop_query',                   'E',
738                 'gtk_toggle_button_set_state',                 'E', # gtk_toggle_button_set_active [==]
739                 'gtk_toolbar_append_element',                  'E',
740                 'gtk_toolbar_append_item',                     'E',
741                 'gtk_toolbar_append_space',                    'E', # Use gtk_toolbar_insert() instead
742                 'gtk_toolbar_append_widget',                   'E', # ??
743                 'gtk_toolbar_get_tooltips',                    'E',
744                 'gtk_toolbar_insert_element',                  'E',
745                 'gtk_toolbar_insert_item',                     'E',
746                 'gtk_toolbar_insert_space',                    'E',
747                 'gtk_toolbar_insert_stock',                    'E',
748                 'gtk_toolbar_insert_widget',                   'E',
749                 'gtk_toolbar_prepend_element',                 'E',
750                 'gtk_toolbar_prepend_item',                    'E',
751                 'gtk_toolbar_prepend_space',                   'E',
752                 'gtk_toolbar_prepend_widget',                  'E',
753                 'gtk_toolbar_remove_space',                    'E',
754                 'gtk_toolbar_set_tooltips',                    'E',
755                 'gtk_tree_append',                             'E',
756                 'gtk_tree_child_position',                     'E',
757                 'gtk_tree_clear_items',                        'E',
758                 'gtk_tree_insert',                             'E',
759                 'gtk_tree_item_collapse',                      'E',
760                 'gtk_tree_item_deselect',                      'E',
761                 'gtk_tree_item_expand',                        'E',
762                 'gtk_tree_item_new',                           'E',
763                 'gtk_tree_item_new_with_label',                'E',
764                 'gtk_tree_item_remove_subtree',                'E',
765                 'gtk_tree_item_select',                        'E',
766                 'gtk_tree_item_set_subtree',                   'E',
767                 'GTK_TREE_ITEM_SUBTREE',                       'E',
768                 'gtk_tree_model_get_iter_root',                'E',
769                 'gtk_tree_new',                                'E',
770                 'gtk_tree_path_new_root',                      'E',
771                 'gtk_tree_prepend',                            'E',
772                 'gtk_tree_remove_item',                        'E',
773                 'gtk_tree_remove_items',                       'E',
774                 'GTK_TREE_ROOT_TREE',                          'E',
775                 'gtk_tree_select_child',                       'E',
776                 'gtk_tree_select_item',                        'E',
777                 'GTK_TREE_SELECTION_OLD',                      'E',
778                 'gtk_tree_set_selection_mode',                 'E',
779                 'gtk_tree_set_view_lines',                     'E',
780                 'gtk_tree_set_view_mode',                      'E',
781                 'gtk_tree_unselect_child',                     'E',
782                 'gtk_tree_unselect_item',                      'E',
783                 'gtk_tree_view_tree_to_widget_coords',         'E',
784                 'gtk_tree_view_widget_to_tree_coords',         'E',
785                 'gtk_type_class',                              'E', # g_type_class_peek() or g_type_class_ref()
786                 'GTK_TYPE_CTREE_NODE',                         'E',
787                 'gtk_type_enum_find_value',                    'E',
788                 'gtk_type_enum_get_values',                    'E',
789                 'gtk_type_flags_find_value',                   'E',
790                 'gtk_type_flags_get_values',                   'E',
791                 'gtk_type_from_name',                          'E',
792                 'gtk_type_init',                               'E',
793                 'gtk_type_is_a',                               'E',
794                 'GTK_TYPE_IS_OBJECT',                          'E',
795                 'gtk_type_name',                               'E',
796                 'gtk_type_new',                                'E',
797                 'gtk_type_parent',                             'E',
798                 'gtk_type_unique',                             'E',
799                 'GTK_VALUE_BOOL',                              'E',
800                 'GTK_VALUE_BOXED',                             'E',
801                 'GTK_VALUE_CHAR',                              'E',
802                 'GTK_VALUE_DOUBLE',                            'E',
803                 'GTK_VALUE_ENUM',                              'E',
804                 'GTK_VALUE_FLAGS',                             'E',
805                 'GTK_VALUE_FLOAT',                             'E',
806                 'GTK_VALUE_INT',                               'E',
807                 'GTK_VALUE_LONG',                              'E',
808                 'GTK_VALUE_OBJECT',                            'E',
809                 'GTK_VALUE_POINTER',                           'E',
810                 'GTK_VALUE_SIGNAL',                            'E',
811                 'GTK_VALUE_STRING',                            'E',
812                 'GTK_VALUE_UCHAR',                             'E',
813                 'GTK_VALUE_UINT',                              'E',
814                 'GTK_VALUE_ULONG',                             'E',
815                 'gtk_vbutton_box_get_layout_default',          'E',
816                 'gtk_vbutton_box_get_spacing_default',         'E',
817                 'gtk_vbutton_box_set_layout_default',          'E',
818                 'gtk_vbutton_box_set_spacing_default',         'E',
819                 'gtk_widget_draw',                             'E', # gtk_widget_queue_draw_area(): 
820                                                                     #  "in general a better choice if you want
821                                                                     #  to draw a region of a widget."
822                 'gtk_widget_pop_visual',                       'E',
823                 'gtk_widget_push_visual',                      'E',
824                 'gtk_widget_queue_clear',                      'E',
825                 'gtk_widget_queue_clear_area',                 'E',
826                 'gtk_widget_ref',                              'E', # g_object_ref() [==]
827                 'gtk_widget_restore_default_style',            'E',
828                 'gtk_widget_set',                              'E', # g_object_set() [==]
829                 'gtk_widget_set_default_visual',               'E',
830                 'gtk_widget_set_rc_style',                     'E',
831                 'gtk_widget_set_uposition',                    'E', # ?? (see GTK documentation)
832                 'gtk_widget_set_usize',                        'E', # gtk_widget_set_size_request()
833                 'gtk_widget_set_visual',                       'E',
834                 'gtk_widget_unref',                            'E',
835                 'gtk_window_position',                         'E',
836                 'gtk_window_set_policy',                       'E', # >>? gtk_window_set_resizable()
837 ##
838 ## Deprecated for GTK versions greater than 2.4
839 ## Note that entries marked with 'W' are currently being used by Wireshark
840 ## Those marked with 'E' are not being used by Wireshark
841 ##
842 ## Deprecated as of GTK+ 2.12 but to be replaced only when Wireshark requires GTK+ 2.12 or later
843 ##  (or: use conditional code based upon the GTK version).
844                 'gtk_tooltips_data_get',                       'E', # new API: GtkToolTip (avail since 2.12) ...
845                 'gtk_tooltips_disable',                        'E',
846                 'gtk_tooltips_enable',                         'E',
847                 'gtk_tooltips_force_window',                   'E',
848                 'gtk_tooltips_get_info_from_tip_window',       'E',
849 ##              'gtk_tooltips_new',                            'W',
850                 'gtk_tooltips_set_delay',                      'E',
851 ##              'gtk_tooltips_set_tip',                        'W',
852 ##              'gtk_tool_item_set_tooltip',                   'W', # gtk_tool_item_set_tooltip_text() (avail since 2.12)
853 ##
854 ## Deprecated as of GTK+ 2.16 but to be replaced only when Wireshark requires GTK+ 2.16 or later
855 ##  (or: use conditional code based upon the GTK version).
856                 'gtk_scale_button_get_orientation',            'E', # gtk_orientable_get_orientation()     (avail since 2.16)
857                 'gtk_scale_button_set_orientation',            'E', # gtk_orientable_set_orientation()     (avail since 2.16)
858                 'gtk_toolbar_get_orientation',                 'E', # gtk_orientable_get_orientation()     (avail since 2.16)
859 ##              'gtk_toolbar_set_orientation',                 'W', # gtk_orientable_set_orientation()     (avail since 2.16)
860                 'gtk_status_icon_set_tooltip',                 'E', # gtk_status_icon_set_tooltip_text()   (avail since 2.16)
861                 'gtk_widget_get_action',                       'E', # gtk_activatable_get_related_action() (avail since 2.16)
862 ##
863 ## Deprecated as of GTK+ 2.18 but to be replaced only when Wireshark requires GTK+ 2.12 or later
864 ##  (or: use conditional code based upon the GTK version).
865                 'gtk_cell_view_get_cell_renderers',            'E', # gtk_cell_layout_get_cells ()         (avail since 2.12)
866 ##              'gtk_tree_view_column_get_cell_renderers',     'W', # gtk_cell_layout_get_cells ()         (avail since 2.12)
867 );
868
869 @{$APIs{'deprecated-gtk'}->{'functions'}}      = grep {$deprecatedGtkFunctions{$_} eq 'E'} keys %deprecatedGtkFunctions;
870 @{$APIs{'deprecated-gtk-todo'}->{'functions'}} = grep {$deprecatedGtkFunctions{$_} eq 'W'} keys %deprecatedGtkFunctions;
871
872
873
874 # Given a ref to a hash containing "functions" and "functions_count" entries:
875 # Determine if the any of the list of APIs contained in the array referenced by "functions"
876 # exists in the file.
877 # For each API which appears in the file: 
878 #     Push the API onto the provided list;
879 #     Add the number of times the API appears in the file to the total count
880 #      for the API (stored as the value of the API key in the hash referenced by "function_counts").
881
882 sub findAPIinFile($$$)
883 {
884         my ($groupHashRef, $fileContentsRef, $foundAPIsRef) = @_;
885
886         for my $api ( @{$groupHashRef->{functions}} )
887         {
888                 my $cnt = 0;
889                 while (${$fileContentsRef} =~ m/ \W $api \W* \( /gx)
890                 {
891                         $cnt += 1;
892                 }
893                 if ($cnt > 0) {
894                         push @{$foundAPIsRef}, $api;
895                         $groupHashRef->{function_counts}->{$api} += 1;
896                 }
897         }
898 }
899
900 # The below Regexp are based on those from:
901 # http://aspn.activestate.com/ASPN/Cookbook/Rx/Recipe/59811
902 # They are in the public domain.
903
904 # 1. A complicated regex which matches C-style comments.
905 my $CComment = qr{ / [*] [^*]* [*]+ (?: [^/*] [^*]* [*]+ )* / }x;
906
907 # 1.a A regex that matches C++-style comments.
908 #my $CppComment = qr{ // (.*?) \n }x;
909
910 # 2. A regex which matches double-quoted strings.
911 #    ?s added so that strings containing a 'line continuation' 
912 #    ( \ followed by a new-line) will match.
913 my $DoubleQuotedStr = qr{ (?: ["] (?s: \\. | [^\"\\])* ["]) }x;
914
915 # 3. A regex which matches single-quoted strings.
916 my $SingleQuotedStr = qr{ (?: \' (?: \\. | [^\'\\])* [']) }x;
917
918 # 4. Now combine 1 through 3 to produce a regex which
919 #    matches _either_ double or single quoted strings
920 #    OR comments. We surround the comment-matching
921 #    regex in capturing parenthesis to store the contents
922 #    of the comment in $1.
923 #    my $commentAndStringRegex = qr{(?:$DoubleQuotedStr|$SingleQuotedStr)|($CComment)|($CppComment)};
924
925 # 4. Wireshark is strictly a C program so don't take out C++ style comments
926 #    since they shouldn't be there anyway...
927 #    Also: capturing the comment isn't necessary.
928 my $commentAndStringRegex = qr{ (?: $DoubleQuotedStr | $SingleQuotedStr | $CComment) }x;
929
930 #### Regex for use when searching for value-string definitions
931 my $StaticRegex             = qr/ static \s+                                                       /xs;
932 my $ConstRegex              = qr/ const  \s+                                                       /xs;
933 my $Static_andor_ConstRegex = qr/ (?: $StaticRegex $ConstRegex | $StaticRegex | $ConstRegex)       /xs;
934 my $ValueStringRegex        = qr/ $Static_andor_ConstRegex value_string [^;*]+ = [^;]+ [{] [^;]+ ; /xs;
935
936 #
937 # MAIN
938 #
939 my $errorCount = 0;
940 # The default list, which can be expanded.
941 my @apiGroups = qw(prohibited deprecated);
942 my @apiSummaryGroups = ();
943 my $check_value_string_array_null_termination = 1; # default: enabled
944 my $machine_readable_output = 0;                   # default: disabled
945 my $debug_flag = 0;
946
947 my $result = GetOptions(
948                         'group=s' => \@apiGroups, 
949                         'summary-group=s' => \@apiSummaryGroups, 
950                         'check-value-string-array-null-termination!' => \$check_value_string_array_null_termination,
951                         'Machine-readable' => \$machine_readable_output,
952                         'debug' => \$debug_flag
953                        );
954 if (!$result) {
955         print "Usage: checkAPIs.pl [-M] [-g group1] [-g group2] ... [-s group1] [-s group2] ... [--nocheck-value-string-array-null-termination] file1 file2 ..\n";
956         print "       -g <group>:  Check input files for use of APIs in <group> (in addition to the default groups)\n";
957         print "       -s <group>:  Output summary (count) for each API in <group> (-g <group> also req'd)\n";
958         print "       -M: Generate output for -g in 'machine-readable' format\n";
959         print "\n";
960         print "   Default Groups[-g]: ", join (", ", sort @apiGroups), "\n";
961         print "   Available Groups:   ", join (", ", sort keys %APIs), "\n";
962         exit(1);
963 }
964
965 # Add a 'function_count' anonymous hash to each of the 'apiGroup' entries in the %APIs hash.
966 for my $apiGroup (keys %APIs) {
967         my @functions = @{$APIs{$apiGroup}{functions}};
968
969         $APIs{$apiGroup}->{function_counts}   = {};
970         @{$APIs{$apiGroup}->{function_counts}}{@functions} = ();  # Add fcn names as keys to the anonymous hash
971 }
972
973
974 # Read through the files; do various checks
975 while ($_ = $ARGV[0])
976 {
977         shift;
978         my $filename = $_;
979         my $fileContents = '';
980         my @foundAPIs = ();
981
982         die "No such file: \"$filename\"" if (! -e $filename);
983
984         # delete leading './'
985         $filename =~ s{ ^ \. / } {}xo;
986
987         # Read in the file (ouch, but it's easier that way)
988         open(FC, $filename) || die("Couldn't open $filename");
989         while (<FC>) { $fileContents .= $_; }
990         close(FC);
991
992         if ($fileContents =~ m{ [\x80-\xFF] }xo)
993         {
994                 print STDERR "Error: Found non-ASCII characters in " .$filename."\n";
995                 $errorCount++;
996         }
997
998         if ($fileContents =~ m{ %ll }xo)
999         {
1000                 # use G_GINT64_MODIFIER instead of ll
1001                 print STDERR "Error: Found %ll in " .$filename."\n";
1002                 $errorCount++;
1003         }
1004
1005         if (! ($fileContents =~ m{ \$Id .* \$ }xo))
1006         {
1007                 print STDERR "Warning: ".$filename." does not have an SVN Id tag.\n";
1008         }
1009
1010         # Remove all the C-comments and strings
1011         $fileContents =~ s {$commentAndStringRegex} []xog;
1012
1013         if ($fileContents =~ m{ // }xo)
1014         {
1015                 print STDERR "Error: Found C++ style comments in " .$filename."\n";
1016                 $errorCount++;
1017         }
1018
1019         # Brute force check for value_string arrays which are not NULL terminated
1020         if ($check_value_string_array_null_termination) {
1021                 #  Assumption: definition is of form (pseudo-Regex):
1022                 #    " (static const|static|const) value_string .+ = { .+ ;" (possibly over multiple lines) 
1023                 while ($fileContents =~ / ( $ValueStringRegex ) /xsog) {
1024                         # value_string array definition found; check if NULL terminated
1025                         my $vs = my $vsx = $1;
1026                         if ($debug_flag) {
1027                                 $vsx =~ / ( .+ value_string [^=]+ ) = /xo;
1028                                 printf STDERR "==> %-35.35s: %s\n", $filename, $1;
1029                                 printf STDERR "%s\n", $vs;
1030                         }
1031                         $vs =~ s{ \s } {}xg;
1032                         # README.developer says 
1033                         #  "Don't put a comma after the last tuple of an initializer of an array"
1034                         # However: since this usage is present in some number of cases, we'll allow for now
1035                         if ($vs !~ / , NULL [}] ,? [}] ; $/xo) {
1036                                 $vsx =~ /( value_string [^=]+ ) = /xo;
1037                                 printf STDERR "Error: %-35.35s: Not terminated: %s\n", $filename, $1;
1038                                 $errorCount++;
1039                         }
1040                         if ($vs !~ / (static)? const value_string /xo)  {
1041                                 $vsx =~ /( value_string [^=]+ ) = /xo;
1042                                 printf STDERR "Error: %-35.35s: Missing 'const': %s\n", $filename, $1;
1043                                 $errorCount++;
1044                         }
1045                 }
1046         }
1047
1048         # Check and count APIs
1049         for my $apiGroup (@apiGroups) {
1050                 my $pfx = "Warning";
1051                 @foundAPIs = ();
1052
1053                 findAPIinFile($APIs{$apiGroup}, \$fileContents, \@foundAPIs);
1054
1055                 if ($APIs{$apiGroup}->{count_errors}) {
1056                         # the use of "prohibited" APIs is an error, increment the error count
1057                         $errorCount += @foundAPIs;
1058                         $pfx = "Error";
1059                 }
1060
1061                 if (@foundAPIs && ! $machine_readable_output) {
1062                         print STDERR $pfx . ": Found " . $apiGroup . " APIs in ".$filename.": ".join(',', @foundAPIs)."\n"
1063                 }
1064                 if (@foundAPIs && $machine_readable_output) {
1065                         for my $api (@foundAPIs) {
1066                                 printf STDERR "%-8.8s %-20.20s %-30.30s %-45.45s\n", $pfx, $apiGroup, $filename, $api; 
1067                         }
1068                 }
1069         }
1070 }
1071
1072 # Summary: Print Use Counts of each API in each requested summary group
1073
1074 for my $apiGroup (@apiSummaryGroups) {
1075         printf "\n\nUse Counts\n";
1076         for my $api (sort {"\L$a" cmp "\L$b"} (keys %{$APIs{$apiGroup}->{function_counts}}   )) {
1077                 printf "%-20.20s %5d  %-40.40s\n", $apiGroup . ':', $APIs{$apiGroup}{function_counts}{$api}, $api;
1078         }
1079 }
1080
1081 exit($errorCount);
1082