4 # Copyright 2006, Jeff Morriss <jeff.morriss[AT]ulticom.com>
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.
10 # checkAPIs.pl [-M] [-g group1] [-g group2] [-s summary-group1] [-s summary-group2] [--nocheck-value-string-array-null-termination] file1 file2 ...
14 # Wireshark - Network traffic analyzer
15 # By Gerald Combs <gerald@wireshark.org>
16 # Copyright 1998 Gerald Combs
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
38 # Group name, e.g. 'prohibited'
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)
45 # APIs that MUST NOT be used in Wireshark
46 'prohibited' => { 'count_errors' => 1, 'functions' => [
48 # Use something that won't overwrite the end of your buffer instead
62 # use glib (g_*) versions instead of these:
69 # Windows doesn't have this; use g_ascii_strtoull() instead
71 ### non-portable: fails on Windows Wireshark built with VC newer than VC6
72 # See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6695#c2
76 # use memset, memcpy, memcmp instead of these:
80 # The MSDN page for ZeroMemory recommends SecureZeroMemory
83 # use ep_*, se_*, or g_* functions instead of these:
84 # (One thing to be aware of is that space allocated with malloc()
85 # may not be freeable--at least on Windows--with g_free() and
94 # These may have unexpected behaviors in some locales (e.g.,
95 # "I" isn't always the upper-case form of "i", and "i" isn't
96 # always the lower-case form of "I"). Use the g_ascii_* version
107 'strerror', # use g_strerror
108 # Use the ws_* version of these:
109 # (Necessary because on Windows we use UTF8 for throughout the code
110 # so we must tweak that to UTF16 before operating on the file. Code
111 # using these functions will work unless the file/path name contains
122 'tmpnam', # use mkstemp
123 '_snwprintf' # use StringCchPrintf
126 # APIs that SHOULD NOT be used in Wireshark (any more)
127 'deprecated' => { 'count_errors' => 1, 'functions' => [
128 'perror', # Use g_strerror() and report messages in whatever
129 # fashion is appropriate for the code in question.
130 'ctime', # Use abs_time_secs_to_str()
131 'next_tvb_add_port', # Use next_tvb_add_uint() (and a matching change
132 # of NTVB_PORT -> NTVB_UINT)
134 ### Deprecated GLib/GObject functions/macros
135 # (The list is based upon the GLib 2.30.2 & GObject 2.30.2 documentation;
136 # An entry may be commented out if it is currently
137 # being used in Wireshark and if the replacement functionality
138 # is not available in all the GLib versions that Wireshark
139 # currently supports.
140 # Note: Wireshark currently (Jan 2012) requires GLib 2.14 or newer.
141 # The Wireshark build currently (Jan 2012) defines G_DISABLE_DEPRECATED
142 # so use of any of the following should cause the Wireshark build to fail and
143 # therefore the tests for obsolete GLib function usage in checkAPIs should not be needed.
146 'g_allocator_free', # "use slice allocator" (avail since 2.10,2.14)
147 'g_allocator_new', # "use slice allocator" (avail since 2.10,2.14)
148 'g_async_queue_ref_unlocked', # g_async_queue_ref() (OK since 2.8)
149 'g_async_queue_unref_and_unlock', # g_async_queue_unref() (OK since 2.8)
150 'g_atomic_int_exchange_and_add', # since 2.30
152 'g_blow_chunks', # "use slice allocator" (avail since 2.10,2.14)
153 'g_cache_value_foreach', # g_cache_key_foreach()
154 'g_chunk_free', # g_slice_free (avail since 2.10)
155 'g_chunk_new', # g_slice_new (avail since 2.10)
156 'g_chunk_new0', # g_slice_new0 (avail since 2.10)
157 'g_completion_add_items', # since 2.26
158 'g_completion_clear_items', # since 2.26
159 'g_completion_complete', # since 2.26
160 'g_completion_complete_utf8', # since 2.26
161 'g_completion_free', # since 2.26
162 'g_completion_new', # since 2.26
163 'g_completion_remove_items', # since 2.26
164 'g_completion_set_compare', # since 2.26
165 'G_CONST_RETURN', # since 2.26
166 'g_date_set_time', # g_date_set_time_t (avail since 2.10)
168 'g_format_size_for_display', # since 2.30: use g_format_size()
170 'G_GNUC_PRETTY_FUNCTION',
171 'g_hash_table_freeze',
174 'g_io_channel_close',
177 'g_io_channel_write',
178 'g_list_pop_allocator', # "does nothing since 2.10"
179 'g_list_push_allocator', # "does nothing since 2.10"
187 'g_main_set_poll_func',
188 'g_mapped_file_free', # [as of 2.22: use g_map_file_unref]
189 'g_mem_chunk_alloc', # "use slice allocator" (avail since 2.10)
190 'g_mem_chunk_alloc0', # "use slice allocator" (avail since 2.10)
191 'g_mem_chunk_clean', # "use slice allocator" (avail since 2.10)
192 'g_mem_chunk_create', # "use slice allocator" (avail since 2.10)
193 'g_mem_chunk_destroy', # "use slice allocator" (avail since 2.10)
194 'g_mem_chunk_free', # "use slice allocator" (avail since 2.10)
195 'g_mem_chunk_info', # "use slice allocator" (avail since 2.10)
196 'g_mem_chunk_new', # "use slice allocator" (avail since 2.10)
197 'g_mem_chunk_print', # "use slice allocator" (avail since 2.10)
198 'g_mem_chunk_reset', # "use slice allocator" (avail since 2.10)
199 'g_node_pop_allocator', # "does nothing since 2.10"
200 'g_node_push_allocator', # "does nothing since 2.10"
201 'g_relation_count', # since 2.26
202 'g_relation_delete', # since 2.26
203 'g_relation_destroy', # since 2.26
204 'g_relation_exists', # since 2.26
205 'g_relation_index', # since 2.26
206 'g_relation_insert', # since 2.26
207 'g_relation_new', # since 2.26
208 'g_relation_print', # since 2.26
209 'g_relation_select', # since 2.26
210 'g_scanner_add_symbol',
211 'g_scanner_remove_symbol',
212 'g_scanner_foreach_symbol',
213 'g_scanner_freeze_symbol_table',
214 'g_scanner_thaw_symbol_table',
215 'g_slist_pop_allocator', # "does nothing since 2.10"
216 'g_slist_push_allocator', # "does nothing since 2.10"
217 'g_source_get_current_time', # since 2.28: use g_source_get_time()
221 'g_string_sprintf', # use g_string_printf() instead
222 'g_string_sprintfa', # use g_string_append_printf instead
227 'g_tuples_destroy', # since 2.26
228 'g_tuples_index', # since 2.26
229 'g_unicode_canonical_decomposition', # since 2.30: use g_unichar_fully_decompose()
230 'G_UNICODE_COMBINING_MARK', # since 2.30:use G_UNICODE_SPACING_MARK
231 'g_value_set_boxed_take_ownership', # GObject
232 'g_value_set_object_take_ownership', # GObject
233 'g_value_set_param_take_ownership', # GObject
234 'g_value_set_string_take_ownership', # Gobject
235 'G_WIN32_DLLMAIN_FOR_DLL_NAME',
236 'g_win32_get_package_installation_directory',
237 'g_win32_get_package_installation_subdirectory',
240 # APIs that make the program exit. Dissectors shouldn't call these
241 'abort' => { 'count_errors' => 1, 'functions' => [
250 # APIs that print to the terminal. Dissectors shouldn't call these
251 'termoutput' => { 'count_errors' => 0, 'functions' => [
256 # Deprecated GTK APIs
257 # which SHOULD NOT be used in Wireshark (any more).
258 # (Filled in from 'E' entries in %deprecatedGtkFunctions below)
259 'deprecated-gtk' => { 'count_errors' => 1, 'functions' => [
262 # Deprecated GTK APIs yet to be replaced
263 # (Filled in from 'W' entries in %deprecatedGtkFunctions below)
264 'deprecated-gtk-todo' => { 'count_errors' => 0, 'functions' => [
269 # Deprecated GTK+ (and GDK) functions/macros with (E)rror or (W)arning flag:
270 # (The list is based upon the GTK+ 2.24.8 documentation;
271 # E: There should be no current Wireshark use so Error if seen;
272 # W: Not all Wireshark use yet fixed so Warn if seen; (Change to E as fixed)
274 # Note: Wireshark currently (Jan 2012) requires GTK 2.12 or newer.
275 # The Wireshark build currently (Jan 2012) defines GTK_DISABLE_DEPRECATED.
276 # However: Wireshark source still has a few uses of deprecated GTK functions
277 # (which either are ifdef'd out or GTK_DISABLE_DEPRECATED is undef'd).
278 # Thus: there a few GTK functions still marked as 'W' below.
279 # Deprecated GDK functions are included in the list of deprecated GTK functions.
280 # The Wireshark build currently (Jan 2012) does not define GDK_DISABLE_DEPRECATED
281 # since there are still some uses of deprecated GDK functions.
282 # They are marked with 'W' below.
284 my %deprecatedGtkFunctions = (
285 'gtk_about_dialog_get_name', 'E',
286 'gtk_about_dialog_set_name', 'E',
287 'gtk_about_dialog_set_email_hook', 'E', # since 2.24
288 'gtk_about_dialog_set_url_hook', 'E', # since 2.24
289 'gtk_accel_group_ref', 'E',
290 'gtk_accel_group_unref', 'E',
291 'gtk_action_block_activate_from', 'E', # since 2.16
292 'gtk_action_connect_proxy', 'E', # since 2.16: use gtk_activatable_set_related_action() (as of 2.16)
293 'gtk_action_disconnect_proxy', 'E', # since 2.16: use gtk_activatable_set_related_action() (as of 2.16)
294 'gtk_action_unblock_activate_from', 'E', # since 2.16
295 'gtk_binding_entry_add', 'E',
296 'gtk_binding_entry_add_signal', 'E',
297 'gtk_binding_entry_clear', 'E',
298 'gtk_binding_parse_binding', 'E',
299 'gtk_box_pack_end_defaults', 'E',
300 'gtk_box_pack_start_defaults', 'E',
301 'gtk_button_box_get_child_ipadding', 'E',
302 'gtk_button_box_get_child_size', 'E',
303 'gtk_button_box_get_spacing', 'E',
304 'gtk_button_box_set_child_ipadding', 'E', # style properties child-internal-pad-x/-y
305 'gtk_button_box_set_child_size', 'E', # style properties child-min-width/-height
306 'gtk_button_box_set_spacing', 'E', # gtk_box_set_spacing [==]
307 'gtk_button_enter', 'E', # since 2.20
308 'gtk_button_leave', 'E', # since 2.20
309 'gtk_button_pressed', 'E', # since 2.20
310 'gtk_button_released', 'E', # since 2.20
311 'gtk_calendar_display_options', 'E',
312 'gtk_calendar_freeze', 'E',
313 'gtk_calendar_thaw', 'E',
314 'GTK_CELL_PIXMAP', 'E', # GtkTreeView (& related) ...
315 'GTK_CELL_PIXTEXT', 'E',
316 'gtk_cell_renderer_editing_canceled', 'E',
317 'GTK_CELL_TEXT', 'E',
318 'gtk_cell_view_get_cell_renderers', 'E', # gtk_cell_layout_get_cells () (avail since 2.12)
319 'GTK_CELL_WIDGET', 'E',
320 'GTK_CHECK_CAST', 'E', # G_TYPE_CHECK_INSTANCE_CAST [==]
321 'GTK_CHECK_CLASS_CAST', 'E', # G_TYPE_CHECK_CLASS_CAST [==]
322 'GTK_CHECK_CLASS_TYPE', 'E', # G_TYPE_CHECK_CLASS_TYPE [==]
323 'GTK_CHECK_GET_CLASS', 'E', # G_TYPE_INSTANCE_GET_CLASS [==]
324 'gtk_check_menu_item_set_show_toggle', 'E', # Does nothing; remove; [show_toggle is always TRUE]
325 'gtk_check_menu_item_set_state', 'E',
326 'GTK_CHECK_TYPE', 'E', # G_TYPE_CHECK_INSTANCE_TYPE [==]
327 'GTK_CLASS_NAME', 'E',
328 'GTK_CLASS_TYPE', 'E',
329 'GTK_CLIST_ADD_MODE', 'E', # GtkTreeView (& related) ...
330 'gtk_clist_append', 'E',
331 'GTK_CLIST_AUTO_RESIZE_BLOCKED', 'E',
332 'GTK_CLIST_AUTO_SORT', 'E',
333 'gtk_clist_clear', 'E',
334 'gtk_clist_column_title_active', 'E',
335 'gtk_clist_column_title_passive', 'E',
336 'gtk_clist_column_titles_active', 'E',
337 'gtk_clist_column_titles_hide', 'E',
338 'gtk_clist_column_titles_passive', 'E',
339 'gtk_clist_column_titles_show', 'E',
340 'gtk_clist_columns_autosize', 'E',
341 'GTK_CLIST_DRAW_DRAG_LINE', 'E',
342 'GTK_CLIST_DRAW_DRAG_RECT', 'E',
343 'gtk_clist_find_row_from_data', 'E',
344 'GTK_CLIST_FLAGS', 'E',
345 'gtk_clist_freeze', 'E',
346 'gtk_clist_get_cell_style', 'E',
347 'gtk_clist_get_cell_type', 'E',
348 'gtk_clist_get_column_title', 'E',
349 'gtk_clist_get_column_widget', 'E',
350 'gtk_clist_get_hadjustment', 'E',
351 'gtk_clist_get_pixmap', 'E',
352 'gtk_clist_get_pixtext', 'E',
353 'gtk_clist_get_row_data', 'E',
354 'gtk_clist_get_row_style', 'E',
355 'gtk_clist_get_selectable', 'E',
356 'gtk_clist_get_selection_info', 'E',
357 'gtk_clist_get_text', 'E',
358 'gtk_clist_get_vadjustment', 'E',
359 'GTK_CLIST_IN_DRAG', 'E',
360 'gtk_clist_insert', 'E',
361 'gtk_clist_moveto', 'E',
362 'gtk_clist_new', 'E',
363 'gtk_clist_new_with_titles', 'E',
364 'gtk_clist_optimal_column_width', 'E',
365 'gtk_clist_prepend', 'E',
366 'gtk_clist_remove', 'E',
367 'GTK_CLIST_REORDERABLE', 'E',
368 'GTK_CLIST_ROW', 'E',
369 'GTK_CLIST_ROW_HEIGHT_SET', 'E',
370 'gtk_clist_row_is_visible', 'E',
371 'gtk_clist_row_move', 'E',
372 'gtk_clist_select_all', 'E',
373 'gtk_clist_select_row', 'E',
374 'gtk_clist_set_auto_sort', 'E',
375 'gtk_clist_set_background', 'E',
376 'gtk_clist_set_button_actions', 'E',
377 'gtk_clist_set_cell_style', 'E',
378 'gtk_clist_set_column_auto_resize', 'E',
379 'gtk_clist_set_column_justification', 'E',
380 'gtk_clist_set_column_max_width', 'E',
381 'gtk_clist_set_column_min_width', 'E',
382 'gtk_clist_set_column_resizeable', 'E',
383 'gtk_clist_set_column_title', 'E',
384 'gtk_clist_set_column_visibility', 'E',
385 'gtk_clist_set_column_widget', 'E',
386 'gtk_clist_set_column_width', 'E',
387 'gtk_clist_set_compare_func', 'E',
388 'GTK_CLIST_SET_FLAG', 'E',
389 'gtk_clist_set_foreground', 'E',
390 'gtk_clist_set_hadjustment', 'E',
391 'gtk_clist_set_pixmap', 'E',
392 'gtk_clist_set_pixtext', 'E',
393 'gtk_clist_set_reorderable', 'E',
394 'gtk_clist_set_row_data', 'E',
395 'gtk_clist_set_row_data_full', 'E',
396 'gtk_clist_set_row_height', 'E',
397 'gtk_clist_set_row_style', 'E',
398 'gtk_clist_set_selectable', 'E',
399 'gtk_clist_set_selection_mode', 'E',
400 'gtk_clist_set_shadow_type', 'E',
401 'gtk_clist_set_shift', 'E',
402 'gtk_clist_set_sort_column', 'E',
403 'gtk_clist_set_sort_type', 'E',
404 'gtk_clist_set_text', 'E',
405 'gtk_clist_set_use_drag_icons', 'E',
406 'gtk_clist_set_vadjustment', 'E',
407 'GTK_CLIST_SHOW_TITLES', 'E',
408 'gtk_clist_sort', 'E',
409 'gtk_clist_swap_rows', 'E',
410 'gtk_clist_thaw', 'E',
411 'gtk_clist_undo_selection', 'E',
412 'gtk_clist_unselect_all', 'E',
413 'gtk_clist_unselect_row', 'E',
414 'GTK_CLIST_UNSET_FLAG', 'E',
415 'GTK_CLIST_USE_DRAG_ICONS', 'E',
416 'gtk_color_selection_get_color', 'E',
417 'gtk_color_selection_set_change_palette_hook', 'E',
418 'gtk_color_selection_set_color', 'E',
419 'gtk_color_selection_set_update_policy', 'E',
420 'gtk_combo_box_append_text', 'E', #
421 'gtk_combo_box_entry_get_text_column', 'E', #
422 'gtk_combo_box_entry_new', 'E', #
423 'gtk_combo_box_entry_new_text', 'E', #
424 'gtk_combo_box_entry_new_with_model', 'E', #
425 'gtk_combo_box_entry_set_text_column', 'E', #
426 'gtk_combo_box_get_active_text', 'E', #
427 'gtk_combo_box_insert_text', 'E', #
428 'gtk_combo_box_new_text', 'E', #
429 'gtk_combo_box_prepend_text', 'E', #
430 'gtk_combo_box_remove_text', 'E', #
431 'gtk_combo_disable_activate', 'E', # GtkComboBoxEntry ... (avail since 2.4/2.6/2.10/2.14)
432 'gtk_combo_new', 'E',
433 'gtk_combo_set_case_sensitive', 'E',
434 'gtk_combo_set_item_string', 'E',
435 'gtk_combo_set_popdown_strings', 'E',
436 'gtk_combo_set_use_arrows', 'E',
437 'gtk_combo_set_use_arrows_always', 'E',
438 'gtk_combo_set_value_in_list', 'E',
439 'gtk_container_border_width', 'E', # gtk_container_set_border_width [==]
440 'gtk_container_children', 'E', # gtk_container_get_children [==]
441 'gtk_container_foreach_full', 'E',
442 'gtk_ctree_collapse', 'E',
443 'gtk_ctree_collapse_recursive', 'E',
444 'gtk_ctree_collapse_to_depth', 'E',
445 'gtk_ctree_expand', 'E',
446 'gtk_ctree_expand_recursive', 'E',
447 'gtk_ctree_expand_to_depth', 'E',
448 'gtk_ctree_export_to_gnode', 'E',
449 'gtk_ctree_find', 'E',
450 'gtk_ctree_find_all_by_row_data', 'E',
451 'gtk_ctree_find_all_by_row_data_custom', 'E',
452 'gtk_ctree_find_by_row_data', 'E',
453 'gtk_ctree_find_by_row_data_custom', 'E',
454 'gtk_ctree_find_node_ptr', 'E',
455 'GTK_CTREE_FUNC', 'E',
456 'gtk_ctree_get_node_info', 'E',
457 'gtk_ctree_insert_gnode', 'E',
458 'gtk_ctree_insert_node', 'E',
459 'gtk_ctree_is_ancestor', 'E',
460 'gtk_ctree_is_hot_spot', 'E',
461 'gtk_ctree_is_viewable', 'E',
462 'gtk_ctree_last', 'E',
463 'gtk_ctree_move', 'E',
464 'gtk_ctree_new', 'E',
465 'gtk_ctree_new_with_titles', 'E',
466 'GTK_CTREE_NODE', 'E',
467 'gtk_ctree_node_get_cell_style', 'E',
468 'gtk_ctree_node_get_cell_type', 'E',
469 'gtk_ctree_node_get_pixmap', 'E',
470 'gtk_ctree_node_get_pixtext', 'E',
471 'gtk_ctree_node_get_row_data', 'E',
472 'gtk_ctree_node_get_row_style', 'E',
473 'gtk_ctree_node_get_selectable', 'E',
474 'gtk_ctree_node_get_text', 'E',
475 'gtk_ctree_node_is_visible', 'E',
476 'gtk_ctree_node_moveto', 'E',
477 'GTK_CTREE_NODE_NEXT', 'E',
478 'gtk_ctree_node_nth', 'E',
479 'GTK_CTREE_NODE_PREV', 'E',
480 'gtk_ctree_node_set_background', 'E',
481 'gtk_ctree_node_set_cell_style', 'E',
482 'gtk_ctree_node_set_foreground', 'E',
483 'gtk_ctree_node_set_pixmap', 'E',
484 'gtk_ctree_node_set_pixtext', 'E',
485 'gtk_ctree_node_set_row_data', 'E',
486 'gtk_ctree_node_set_row_data_full', 'E',
487 'gtk_ctree_node_set_row_style', 'E',
488 'gtk_ctree_node_set_selectable', 'E',
489 'gtk_ctree_node_set_shift', 'E',
490 'gtk_ctree_node_set_text', 'E',
491 'gtk_ctree_post_recursive', 'E',
492 'gtk_ctree_post_recursive_to_depth', 'E',
493 'gtk_ctree_pre_recursive', 'E',
494 'gtk_ctree_pre_recursive_to_depth', 'E',
495 'gtk_ctree_real_select_recursive', 'E',
496 'gtk_ctree_remove_node', 'E',
497 'GTK_CTREE_ROW', 'E',
498 'gtk_ctree_select', 'E',
499 'gtk_ctree_select_recursive', 'E',
500 'gtk_ctree_set_drag_compare_func', 'E',
501 'gtk_ctree_set_expander_style', 'E',
502 'gtk_ctree_set_indent', 'E',
503 'gtk_ctree_set_line_style', 'E',
504 'gtk_ctree_set_node_info', 'E',
505 'gtk_ctree_set_reorderable', 'E',
506 'gtk_ctree_set_show_stub', 'E',
507 'gtk_ctree_set_spacing', 'E',
508 'gtk_ctree_sort_node', 'E',
509 'gtk_ctree_sort_recursive', 'E',
510 'gtk_ctree_toggle_expansion', 'E',
511 'gtk_ctree_toggle_expansion_recursive', 'E',
512 'gtk_ctree_unselect', 'E',
513 'gtk_ctree_unselect_recursive', 'E',
514 'gtk_curve_get_vector', 'E', # since 2.20
515 'gtk_curve_new', 'E', # since 2.20
516 'gtk_curve_reset', 'E', # since 2.20
517 'gtk_curve_set_curve_type', 'E', # since 2.20
518 'gtk_curve_set_gamma', 'E', # since 2.20
519 'gtk_curve_set_range', 'E', # since 2.20
520 'gtk_curve_set_vector', 'E', # since 2.20
521 'gtk_dialog_get_has_separator', 'E', # This function will be removed in GTK+ 3
522 'gtk_dialog_set_has_separator', 'E', # This function will be removed in GTK+ 3
523 'gtk_drag_set_default_icon', 'E',
524 'gtk_draw_arrow', 'E',
526 'gtk_draw_box_gap', 'E',
527 'gtk_draw_check', 'E',
528 'gtk_draw_diamond', 'E',
529 'gtk_draw_expander', 'E',
530 'gtk_draw_extension', 'E',
531 'gtk_draw_flat_box', 'E',
532 'gtk_draw_focus', 'E',
533 'gtk_draw_handle', 'E',
534 'gtk_draw_hline', 'E',
535 'gtk_draw_layout', 'E',
536 'gtk_draw_option', 'E',
537 'gtk_draw_polygon', 'E',
538 'gtk_draw_resize_grip', 'E',
539 'gtk_draw_shadow', 'E',
540 'gtk_draw_shadow_gap', 'E',
541 'gtk_draw_slider', 'E',
542 'gtk_draw_string', 'E',
544 'gtk_draw_vline', 'E',
545 'gtk_drawing_area_size', 'E', # >> g_object_set() [==] ?
546 # gtk_widget_set_size_request() [==?]
547 'gtk_entry_append_text', 'E', # >> gtk_editable_insert_text() [==?]
548 'gtk_entry_new_with_max_length', 'E', # gtk_entry_new(); gtk_entry_set_max_length()
549 'gtk_entry_prepend_text', 'E',
550 'gtk_entry_select_region', 'E',
551 'gtk_entry_set_editable', 'E', # >> gtk_editable_set_editable() [==?]
552 'gtk_entry_set_position', 'E',
553 'gtk_exit', 'E', # exit() [==]
554 'gtk_file_chooser_button_new_with_backend', 'E',
555 'gtk_file_chooser_dialog_new_with_backend', 'E',
556 'gtk_file_chooser_widget_new_with_backend', 'E',
557 'gtk_file_selection_complete', 'E',
558 'gtk_file_selection_get_filename', 'E', # GtkFileChooser ...
559 'gtk_file_selection_get_select_multiple', 'E',
560 'gtk_file_selection_get_selections', 'E',
561 'gtk_file_selection_hide_fileop_buttons', 'E',
562 'gtk_file_selection_new', 'E',
563 'gtk_file_selection_set_filename', 'E',
564 'gtk_file_selection_set_select_multiple', 'E',
565 'gtk_file_selection_show_fileop_buttons', 'E',
566 'gtk_fixed_get_has_window', 'E', # gtk_widget_get_has_window() (available since 2.18)
567 'gtk_fixed_set_has_window', 'E', # gtk_widget_set_has_window() (available since 2.18)
568 'gtk_font_selection_dialog_get_apply_button', 'E',
569 'gtk_font_selection_dialog_get_font', 'E',
570 'gtk_font_selection_get_font', 'E', # gtk_font_selection_get_font_name() [!=]
571 'GTK_FUNDAMENTAL_TYPE', 'E',
572 'gtk_gamma_curve_new', 'E', # since 2.20
573 'gtk_hbox_new', 'W', # gtk_box_new
574 'gtk_hbutton_box_get_layout_default', 'E',
575 'gtk_hbutton_box_get_spacing_default', 'E',
576 'gtk_hbutton_box_new', 'W', # gtk_button_box_new
577 'gtk_hbutton_box_set_layout_default', 'E',
578 'gtk_hbutton_box_set_spacing_default', 'E',
579 'gtk_hruler_new', 'E', # since 2.24
580 'gtk_icon_view_get_orientation', 'E', # gtk_icon_view_get_item_orientation()
581 'gtk_icon_view_set_orientation', 'E', # gtk_icon_view_set_item_orientation()
583 'gtk_idle_add_full', 'E',
584 'gtk_idle_add_priority', 'E',
585 'gtk_idle_remove', 'E',
586 'gtk_idle_remove_by_data', 'E',
587 'gtk_image_get', 'E',
588 'gtk_image_set', 'E',
589 'gtk_init_add', 'E', # removed in 3.0
590 'gtk_input_add_full', 'E', # >>> g_io_add_watch_full()
591 'gtk_input_dialog_new', 'E', # since 2.20
592 'gtk_input_remove', 'E', # >>> g_source_remove()
593 'GTK_IS_ROOT_TREE', 'E',
594 'gtk_item_deselect', 'E', # gtk_menu_item_deselect()
595 'gtk_item_select', 'E', # gtk_menu_item_select()
596 'gtk_item_toggle', 'E', #
597 'gtk_item_factories_path_delete', 'E', # GtkUIManager (avail since 2.4) ...
598 'gtk_item_factory_add_foreign', 'E',
599 'gtk_item_factory_construct', 'E',
600 'gtk_item_factory_create_item', 'W',
601 'gtk_item_factory_create_items', 'E',
602 'gtk_item_factory_create_items_ac', 'E',
603 'gtk_item_factory_create_menu_entries', 'E',
604 'gtk_item_factory_delete_entries', 'E',
605 'gtk_item_factory_delete_entry', 'E',
606 'gtk_item_factory_delete_item', 'E',
607 'gtk_item_factory_from_path', 'E',
608 'gtk_item_factory_from_widget', 'W',
609 'gtk_item_factory_get_item', 'W',
610 'gtk_item_factory_get_item_by_action', 'E',
611 'gtk_item_factory_get_widget', 'W',
612 'gtk_item_factory_get_widget_by_action', 'E',
613 'gtk_item_factory_new', 'E',
614 'gtk_item_factory_path_from_widget', 'E',
615 'gtk_item_factory_popup', 'E',
616 'gtk_item_factory_popup_data', 'E',
617 'gtk_item_factory_popup_data_from_widget', 'E',
618 'gtk_item_factory_popup_with_data', 'E',
619 'gtk_item_factory_set_translate_func', 'E',
620 'gtk_label_get', 'E', # gtk_label_get_text() [!=]
621 'gtk_label_parse_uline', 'E',
622 'gtk_label_set', 'E', # gtk_label_set_text() [==]
623 'gtk_layout_freeze', 'E',
624 'gtk_layout_thaw', 'E',
625 'gtk_link_button_set_uri_hook', 'E', # since 2.24
626 'gtk_list_append_items', 'E',
627 'gtk_list_child_position', 'E',
628 'gtk_list_clear_items', 'E',
629 'gtk_list_end_drag_selection', 'E',
630 'gtk_list_end_selection', 'E',
631 'gtk_list_extend_selection', 'E',
632 'gtk_list_insert_items', 'E',
633 'gtk_list_item_deselect', 'E',
634 'gtk_list_item_new', 'E',
635 'gtk_list_item_new_with_label', 'E',
636 'gtk_list_item_select', 'E',
638 'gtk_list_prepend_items', 'E',
639 'gtk_list_remove_items', 'E',
640 'gtk_list_remove_items_no_unref', 'E',
641 'gtk_list_scroll_horizontal', 'E',
642 'gtk_list_scroll_vertical', 'E',
643 'gtk_list_select_all', 'E',
644 'gtk_list_select_child', 'E',
645 'gtk_list_select_item', 'E',
646 'gtk_list_set_selection_mode', 'E',
647 'gtk_list_start_selection', 'E',
648 'gtk_list_toggle_add_mode', 'E',
649 'gtk_list_toggle_focus_row', 'E',
650 'gtk_list_toggle_row', 'E',
651 'gtk_list_undo_selection', 'E',
652 'gtk_list_unselect_all', 'E',
653 'gtk_list_unselect_child', 'E',
654 'gtk_list_unselect_item', 'E',
655 'gtk_menu_append', 'E', # gtk_menu_shell_append() [==?]
656 'gtk_menu_bar_append', 'E',
657 'gtk_menu_bar_insert', 'E',
658 'gtk_menu_bar_prepend', 'E',
659 'gtk_menu_insert', 'E',
660 'gtk_menu_item_remove_submenu', 'E',
661 'gtk_menu_item_right_justify', 'E',
662 'gtk_menu_prepend', 'E', # gtk_menu_shell_prepend() [==?]
663 'gtk_menu_tool_button_set_arrow_tooltip', 'E',
664 'gtk_notebook_current_page', 'E',
665 'gtk_notebook_get_group', 'E', # since 2.24
666 'gtk_notebook_get_group_id', 'E',
667 'gtk_notebook_query_tab_label_packing', 'E', # since 2.20
668 'gtk_nitebook_set_group', 'E', # since 2.24
669 'gtk_notebook_set_group_id', 'E',
670 'gtk_notebook_set_homogeneous_tabs', 'E',
671 'gtk_notebook_set_page', 'E', # gtk_notebook_set_current_page() [==]
672 'gtk_notebook_set_tab_border', 'E',
673 'gtk_notebook_set_tab_hborder', 'E',
674 'gtk_notebook_set_tab_label_packing', 'E', # since 2.20
675 'gtk_notebook_set_tab_vborder', 'E',
676 'gtk_notebook_set_window_creation_hook', 'E', # since 2.24
677 'gtk_object_add_arg_type', 'E',
678 'gtk_object_data_force_id', 'E',
679 'gtk_object_data_try_key', 'E',
680 'gtk_object_destroy', 'E', # since 2.24
681 'GTK_OBJECT_FLAGS', 'E', # since 2.22
682 'GTK_OBJECT_FLOATING', 'E',
683 'gtk_object_get', 'E',
684 'gtk_object_get_data', 'E',
685 'gtk_object_get_data_by_id', 'E',
686 'gtk_object_get_user_data', 'E',
687 'gtk_object_new', 'E',
688 'gtk_object_ref', 'E',
689 'gtk_object_remove_data', 'E',
690 'gtk_object_remove_data_by_id', 'E',
691 'gtk_object_remove_no_notify', 'E',
692 'gtk_object_remove_no_notify_by_id', 'E',
693 'gtk_object_set', 'E',
694 'gtk_object_set_data', 'E',
695 'gtk_object_set_data_by_id', 'E',
696 'gtk_object_set_data_by_id_full', 'E',
697 'gtk_object_set_data_full', 'E',
698 'gtk_object_set_user_data', 'E',
699 'gtk_object_sink', 'E',
700 'GTK_OBJECT_TYPE', 'E', # G_OBJECT_TYPE
701 'GTK_OBJECT_TYPE_NAME', 'E', # G_OBJECT_TYPE_NAME
702 'gtk_object_unref', 'E',
703 'gtk_object_weakref', 'E',
704 'gtk_object_weakunref', 'E',
705 'gtk_old_editable_changed', 'E',
706 'gtk_old_editable_claim_selection', 'E',
707 'gtk_option_menu_get_history', 'E', # GtkComboBox ... (avail since 2.4/2.6/2.10/2.14)
708 'gtk_option_menu_get_menu', 'E',
709 'gtk_option_menu_new', 'E',
710 'gtk_option_menu_remove_menu', 'E',
711 'gtk_option_menu_set_history', 'E',
712 'gtk_option_menu_set_menu', 'E',
713 'gtk_paint_string', 'E',
714 'gtk_paned_gutter_size', 'E', # gtk_paned_set_gutter_size()
715 'gtk_paned_set_gutter_size', 'E', # "does nothing"
716 'gtk_pixmap_get', 'E', # GtkImage ...
717 'gtk_pixmap_new', 'E',
718 'gtk_pixmap_set', 'E',
719 'gtk_pixmap_set_build_insensitive', 'E',
720 'gtk_preview_draw_row', 'E',
721 'gtk_preview_get_cmap', 'E',
722 'gtk_preview_get_info', 'E',
723 'gtk_preview_get_visual', 'E',
724 'gtk_preview_new', 'E',
725 'gtk_preview_put', 'E',
726 'gtk_preview_reset', 'E',
727 'gtk_preview_set_color_cube', 'E',
728 'gtk_preview_set_dither', 'E',
729 'gtk_preview_set_expand', 'E',
730 'gtk_preview_set_gamma', 'E',
731 'gtk_preview_set_install_cmap', 'E',
732 'gtk_preview_set_reserved', 'E',
733 'gtk_preview_size', 'E',
734 'gtk_preview_uninit', 'E',
735 'GTK_PRIORITY_DEFAULT', 'E',
736 'GTK_PRIORITY_HIGH', 'E',
737 'GTK_PRIORITY_INTERNAL', 'E',
738 'GTK_PRIORITY_LOW', 'E',
739 'GTK_PRIORITY_REDRAW', 'E',
740 'gtk_progress_bar_new_with_adjustment', 'E',
741 'gtk_progress_bar_set_activity_blocks', 'E',
742 'gtk_progress_bar_set_activity_step', 'E',
743 'gtk_progress_bar_set_bar_style', 'E',
744 'gtk_progress_bar_set_discrete_blocks', 'E',
745 'gtk_progress_bar_update', 'E', # >>> "gtk_progress_set_value() or
746 # gtk_progress_set_percentage()"
747 ## Actually: GtkProgress is deprecated so the
748 ## right answer appears to be to use
749 ## gtk_progress_bar_set_fraction()
750 'gtk_progress_configure', 'E',
751 'gtk_progress_get_current_percentage', 'E',
752 'gtk_progress_get_current_text', 'E',
753 'gtk_progress_get_percentage_from_value', 'E',
754 'gtk_progress_get_text_from_value', 'E',
755 'gtk_progress_get_value', 'E',
756 'gtk_progress_set_activity_mode', 'E',
757 'gtk_progress_set_adjustment', 'E',
758 'gtk_progress_set_format_string', 'E',
759 'gtk_progress_set_percentage', 'E',
760 'gtk_progress_set_show_text', 'E',
761 'gtk_progress_set_text_alignment', 'E',
762 'gtk_progress_set_value', 'E',
763 'gtk_quit_add', 'E', # removed in 3.0
764 'gtk_quit_add_destroy', 'E',
765 'gtk_quit_add_full', 'E',
766 'gtk_quit_remove', 'E',
767 'gtk_quit_remove_by_data', 'E',
768 'gtk_radio_button_group', 'E', # gtk_radio_button_get_group() [==]
769 'gtk_radio_menu_item_group', 'E',
770 'gtk_range_get_update_policy', 'E',
771 'gtk_range_set_update_policy', 'E',
772 'gtk_rc_add_class_style', 'E',
773 'gtk_rc_add_widget_class_style', 'E',
774 'gtk_rc_add_widget_name_style', 'E',
775 'gtk_rc_style_ref', 'E',
776 'gtk_rc_style_unref', 'E',
777 'gtk_recent_chooser_get_show_numbers', 'E',
778 'gtk_recent_chooser_set_show_numbers', 'E',
779 'gtk_recent_manager_get_for_screen', 'E',
780 'gtk_recent_manager_get_limit', 'E', # Use GtkRecentChooser
781 'gtk_recent_manager_set_limit', 'E', #
782 'gtk_recent_manager_set_screen', 'E',
783 'GTK_RETLOC_BOOL', 'E',
784 'GTK_RETLOC_BOXED', 'E',
785 'GTK_RETLOC_CHAR', 'E',
786 'GTK_RETLOC_DOUBLE', 'E',
787 'GTK_RETLOC_ENUM', 'E',
788 'GTK_RETLOC_FLAGS', 'E',
789 'GTK_RETLOC_FLOAT', 'E',
790 'GTK_RETLOC_INT', 'E',
791 'GTK_RETLOC_LONG', 'E',
792 'GTK_RETLOC_OBJECT', 'E',
793 'GTK_RETLOC_POINTER', 'E',
794 'GTK_RETLOC_STRING', 'E',
795 'GTK_RETLOC_UCHAR', 'E',
796 'GTK_RETLOC_UINT', 'E',
797 'GTK_RETLOC_ULONG', 'E',
798 'gtk_ruler_get_metric', 'E',
799 'gtk_ruler_get_range', 'E',
800 'gtk_ruler_set_metric', 'E',
801 'gtk_ruler_set_range', 'E',
802 'gtk_scale_button_get_orientation', 'E', # gtk_orientable_get_orientation() (avail since 2.16)
803 'gtk_scale_button_set_orientation', 'E', # gtk_orientable_set_orientation() (avail since 2.16)
804 'gtk_status_icon_set_tooltip', 'E', # gtk_status_icon_set_tooltip_text() (avail since 2.16)
805 'gtk_selection_clear', 'E',
806 'gtk_set_locale', 'E',
807 'gtk_signal_connect', 'E', # GSignal ...
808 'gtk_signal_connect_after', 'E',
809 'gtk_signal_connect_full', 'E',
810 'gtk_signal_connect_object', 'E',
811 'gtk_signal_connect_object_after', 'E',
812 'gtk_signal_connect_object_while_alive', 'E',
813 'gtk_signal_connect_while_alive', 'E',
814 'gtk_signal_default_marshaller', 'E',
815 'gtk_signal_disconnect', 'E',
816 'gtk_signal_disconnect_by_data', 'E',
817 'gtk_signal_disconnect_by_func', 'E',
818 'gtk_signal_emit', 'E',
819 'gtk_signal_emit_by_name', 'E',
820 'gtk_signal_emit_stop', 'E',
821 'gtk_signal_emit_stop_by_name', 'E',
822 'gtk_signal_emitv', 'E',
823 'gtk_signal_emitv_by_name', 'E',
824 'GTK_SIGNAL_FUNC', 'E',
825 'gtk_signal_handler_block', 'E',
826 'gtk_signal_handler_block_by_data', 'E',
827 'gtk_signal_handler_block_by_func', 'E',
828 'gtk_signal_handler_pending', 'E',
829 'gtk_signal_handler_pending_by_func', 'E',
830 'gtk_signal_handler_unblock', 'E',
831 'gtk_signal_handler_unblock_by_data', 'E',
832 'gtk_signal_handler_unblock_by_func', 'E',
833 'gtk_signal_lookup', 'E',
834 'gtk_signal_name', 'E',
835 'gtk_signal_new', 'E',
836 'gtk_signal_newv', 'E',
837 'GTK_SIGNAL_OFFSET', 'E',
838 'gtk_socket_steal', 'E',
839 'gtk_spin_button_get_value_as_float', 'E', # gtk_spin_button_get_value() [==]
840 'gtk_status_icon_get_blinking', 'E',
841 'gtk_status_icon_set_blinking', 'E',
842 'GTK_STRUCT_OFFSET', 'E',
843 'gtk_style_apply_default_pixmap', 'E',
844 'gtk_style_get_font', 'E',
845 'gtk_style_ref', 'E',
846 'gtk_style_set_font', 'E',
847 'gtk_style_unref', 'E', # g_object_unref() [==?]
848 'gtk_text_backward_delete', 'E',
849 'gtk_text_forward_delete', 'E',
850 'gtk_text_freeze', 'E',
851 'gtk_text_get_length', 'E',
852 'gtk_text_get_point', 'E',
853 'GTK_TEXT_INDEX', 'E',
854 'gtk_text_insert', 'E', # GtkTextView (GtkText "known to be buggy" !)
856 'gtk_text_set_adjustments', 'E',
857 'gtk_text_set_editable', 'E',
858 'gtk_text_set_line_wrap', 'E',
859 'gtk_text_set_point', 'E',
860 'gtk_text_set_word_wrap', 'E',
861 'gtk_text_thaw', 'E',
862 'gtk_timeout_add', 'E', # g_timeout_add()
863 'gtk_timeout_add_full', 'E',
864 'gtk_timeout_remove', 'E', # g_source_remove()
865 'gtk_tips_query_new', 'E',
866 'gtk_tips_query_set_caller', 'E',
867 'gtk_tips_query_set_labels', 'E',
868 'gtk_tips_query_start_query', 'E',
869 'gtk_tips_query_stop_query', 'E',
870 'gtk_toggle_button_set_state', 'E', # gtk_toggle_button_set_active [==]
871 'gtk_toolbar_append_element', 'E',
872 'gtk_toolbar_append_item', 'E',
873 'gtk_toolbar_append_space', 'E', # Use gtk_toolbar_insert() instead
874 'gtk_toolbar_append_widget', 'E', # ??
875 'gtk_toolbar_get_orientation', 'E', # gtk_orientable_get_orientation() (avail since 2.16)
876 'gtk_toolbar_get_tooltips', 'E',
877 'gtk_toolbar_insert_element', 'E',
878 'gtk_toolbar_insert_item', 'E',
879 'gtk_toolbar_insert_space', 'E',
880 'gtk_toolbar_insert_stock', 'E',
881 'gtk_toolbar_insert_widget', 'E',
882 'gtk_toolbar_prepend_element', 'E',
883 'gtk_toolbar_prepend_item', 'E',
884 'gtk_toolbar_prepend_space', 'E',
885 'gtk_toolbar_prepend_widget', 'E',
886 'gtk_toolbar_remove_space', 'E',
887 'gtk_toolbar_set_orientation', 'E', # gtk_orientable_set_orientation() (avail since 2.16)
888 'gtk_toolbar_set_tooltips', 'E',
889 'gtk_tooltips_data_get', 'E', # new API: GtkToolTip (avail since 2.12) ...
890 'gtk_tooltips_disable', 'E',
891 'gtk_tooltips_enable', 'E',
892 'gtk_tooltips_force_window', 'E',
893 'gtk_tooltips_get_info_from_tip_window', 'E',
894 'gtk_tooltips_new', 'E',
895 'gtk_tooltips_set_delay', 'E',
896 'gtk_tooltips_set_tip', 'E',
897 'gtk_tool_item_set_tooltip', 'E', # gtk_tool_item_set_tooltip_text() (avail since 2.12)
898 'gtk_tree_append', 'E',
899 'gtk_tree_child_position', 'E',
900 'gtk_tree_clear_items', 'E',
901 'gtk_tree_insert', 'E',
902 'gtk_tree_item_collapse', 'E',
903 'gtk_tree_item_deselect', 'E',
904 'gtk_tree_item_expand', 'E',
905 'gtk_tree_item_new', 'E',
906 'gtk_tree_item_new_with_label', 'E',
907 'gtk_tree_item_remove_subtree', 'E',
908 'gtk_tree_item_select', 'E',
909 'gtk_tree_item_set_subtree', 'E',
910 'GTK_TREE_ITEM_SUBTREE', 'E',
911 'gtk_tree_model_get_iter_root', 'E',
913 'gtk_tree_path_new_root', 'E',
914 'gtk_tree_prepend', 'E',
915 'gtk_tree_remove_item', 'E',
916 'gtk_tree_remove_items', 'E',
917 'GTK_TREE_ROOT_TREE', 'E',
918 'gtk_tree_select_child', 'E',
919 'gtk_tree_select_item', 'E',
920 'GTK_TREE_SELECTION_OLD', 'E',
921 'gtk_tree_set_selection_mode', 'E',
922 'gtk_tree_set_view_lines', 'E',
923 'gtk_tree_set_view_mode', 'E',
924 'gtk_tree_unselect_child', 'E',
925 'gtk_tree_unselect_item', 'E',
926 'gtk_tree_view_column_get_cell_renderers', 'E', # gtk_cell_layout_get_cells () (avail since 2.12)
927 'gtk_tree_view_tree_to_widget_coords', 'E',
928 'gtk_tree_view_widget_to_tree_coords', 'E',
929 'gtk_type_class', 'E', # g_type_class_peek() or g_type_class_ref()
930 'GTK_TYPE_CTREE_NODE', 'E',
931 'gtk_type_enum_find_value', 'E',
932 'gtk_type_enum_get_values', 'E',
933 'gtk_type_flags_find_value', 'E',
934 'gtk_type_flags_get_values', 'E',
935 'gtk_type_from_name', 'E',
936 'gtk_type_init', 'E',
937 'gtk_type_is_a', 'E',
938 'GTK_TYPE_FUNDAMENTAL_LAST', 'E',
939 'GTK_TYPE_FUNDAMENTAL_MAX', 'E',
940 'GTK_TYPE_IS_OBJECT', 'E',
941 'gtk_type_name', 'E',
943 'gtk_type_parent', 'E',
944 'gtk_type_unique', 'E',
945 'GTK_VALUE_BOOL', 'E',
946 'GTK_VALUE_BOXED', 'E',
947 'GTK_VALUE_CHAR', 'E',
948 'GTK_VALUE_DOUBLE', 'E',
949 'GTK_VALUE_ENUM', 'E',
950 'GTK_VALUE_FLAGS', 'E',
951 'GTK_VALUE_FLOAT', 'E',
952 'GTK_VALUE_INT', 'E',
953 'GTK_VALUE_LONG', 'E',
954 'GTK_VALUE_OBJECT', 'E',
955 'GTK_VALUE_POINTER', 'E',
956 'GTK_VALUE_SIGNAL', 'E',
957 'GTK_VALUE_STRING', 'E',
958 'GTK_VALUE_UCHAR', 'E',
959 'GTK_VALUE_UINT', 'E',
960 'GTK_VALUE_ULONG', 'E',
961 'gtk_vbox_new', 'W', # ws_gtk_box_new
962 'gtk_vbutton_box_get_layout_default', 'E',
963 'gtk_vbutton_box_get_spacing_default', 'E',
964 'gtk_vbutton_box_set_layout_default', 'E',
965 'gtk_vbutton_box_set_spacing_default', 'E',
966 'gtk_vruler_new', 'E',
967 'GTK_WIDGET_APP_PAINTABLE', 'E', # gtk_widget_get_app_paintable() (avail since 2.18)
968 'GTK_WIDGET_CAN_DEFAULT', 'E', # gtk_widget_get_can_default() (avail since 2.18)
969 'GTK_WIDGET_CAN_FOCUS', 'E', # gtk_widget_get_can_focus() (avail since 2.18)
970 'GTK_WIDGET_COMPOSITE_CHILD', 'E', # gtk_widget_get_composite_child() (avail since 2.18)
971 'GTK_WIDGET_DOUBLE_BUFFERED', 'E', # gtk_widget_get_double_buffered() (avail since 2.18)
972 'GTK_WIDGET_DRAWABLE', 'E', # gtk_widget_get_drawable() (avail since 2.18)
973 'GTK_WIDGET_FLAGS', 'E', # gtk_widget_get_flags() (avail since 2.18)
974 'GTK_WIDGET_HAS_DEFAULT', 'E', # gtk_widget_get_has_default() (avail since 2.18)
975 'GTK_WIDGET_HAS_FOCUS', 'E', # gtk_widget_get_has_focus() (avail since 2.18)
976 'GTK_WIDGET_HAS_GRAB', 'E', # gtk_widget_get_has_grab() (avail since 2.18)
977 'GTK_WIDGET_IS_SENSITIVE', 'E', # gtk_widget_get_is_sensitive() (avail since 2.18)
978 'GTK_WIDGET_MAPPED', 'E', # gtk_widget_get_mapped() (avail since 2.18)
979 'GTK_WIDGET_NO_WINDOW', 'E', # gtk_widget_get_no_window() (avail since 2.18)
980 'GTK_WIDGET_PARENT_SENSITIVE', 'E', # gtk_widget_get_parent_sensitive() (avail since 2.18)
981 'GTK_WIDGET_RC_STYLE', 'E', # gtk_widget_get_rc_style() (avail since 2.18)
982 'GTK_WIDGET_REALIZED', 'E', # gtk_widget_get_realized() (avail since 2.18)
983 'GTK_WIDGET_RECEIVES_DEFAULT', 'E', # gtk_widget_get_receives_default() (avail since 2.18)
984 'GTK_WIDGET_SAVED_STATE', 'E', # gtk_widget_get_saved_state() (avail since 2.18)
985 'GTK_WIDGET_SENSITIVE', 'E', # gtk_widget_get_sensitive() (avail since 2.18)
986 'GTK_WIDGET_SET_FLAGS', 'W', # since GTK 2.22
987 'GTK_WIDGET_STATE', 'E', # gtk_widget_get_state() (avail since 2.18)
988 'GTK_WIDGET_TOPLEVEL', 'E', # gtk_widget_get_toplevel() (avail since 2.18)
989 'GTK_WIDGET_TYPE', 'E', # gtk_widget_get_type() (avail since 2.18)
990 'GTK_WIDGET_UNSET_FLAGS', 'E',
991 'GTK_WIDGET_VISIBLE', 'E', # gtk_widget_get_visible() (avail since 2.18)
992 'gtk_widget_draw', 'E', # gtk_widget_queue_draw_area():
993 # "in general a better choice if you want
994 # to draw a region of a widget."
995 'gtk_widget_get_action', 'E', # gtk_activatable_get_related_action() (avail since 2.16)
996 'gtk_widget_hide_all', 'E',
997 'gtk_widget_pop_visual', 'E',
998 'gtk_widget_push_visual', 'E',
999 'gtk_widget_queue_clear', 'E',
1000 'gtk_widget_queue_clear_area', 'E',
1001 'gtk_widget_ref', 'E', # g_object_ref() [==]
1002 'gtk_widget_reset_shapes', 'E',
1003 'gtk_widget_restore_default_style', 'E',
1004 'gtk_widget_set', 'E', # g_object_set() [==]
1005 'gtk_widget_set_default_visual', 'E',
1006 'gtk_widget_set_rc_style', 'E',
1007 'gtk_widget_set_uposition', 'E', # ?? (see GTK documentation)
1008 'gtk_widget_set_usize', 'E', # gtk_widget_set_size_request()
1009 'gtk_widget_set_visual', 'E',
1010 'gtk_widget_unref', 'E',
1011 'gtk_window_get_frame_dimensions', 'E',
1012 'gtk_window_get_has_frame', 'E',
1013 'gtk_window_set_frame_dimensions', 'E',
1014 'gtk_window_set_has_frame', 'E',
1015 'gtk_window_position', 'E',
1016 'gtk_window_set_policy', 'E', # >>? gtk_window_set_resizable()
1018 ## GDK deprecated functions:
1019 'gdk_bitmap_create_from_data', 'E', #
1020 'gdk_bitmap_ref', 'E', #
1021 'gdk_bitmap_unref', 'E', #
1022 'gdk_cairo_set_source_pixmap', 'W', # deprecated since version 2.24.
1023 # Use gdk_cairo_set_source_window() where appropriate(Since 2.24).
1024 'gdk_char_height', 'E', #
1025 'gdk_char_measure', 'E', #
1026 'gdk_char_width', 'E', #
1027 'gdk_char_width_wc', 'E', #
1028 'gdk_colormap_change', 'E', #
1029 'gdk_colormap_get_system_size', 'E', #
1030 'gdk_colormap_ref', 'E', #
1031 'gdk_colormap_unref', 'E', #
1032 'gdk_colors_alloc', 'E', #
1033 'gdk_colors_free', 'E', #
1034 'gdk_colors_store', 'E', #
1035 'gdk_color_alloc', 'E', #
1036 'gdk_color_black', 'E', #
1037 'gdk_color_change', 'E', #
1038 'gdk_color_white', 'E', #
1039 'gdk_cursor_destroy', 'E', #
1040 'GdkDestroyNotify', 'E', #
1041 'gdk_DISPLAY', 'E', #
1042 'gdk_display_set_pointer_hooks', 'E', #
1043 'gdk_drag_context_new', 'E', #
1044 'gdk_drag_context_ref', 'E', #
1045 'gdk_drag_context_unref', 'E', #
1046 'gdk_drag_find_window', 'E', #
1047 'gdk_drag_get_protocol', 'E', #
1048 'gdk_drawable_copy_to_image', 'E', #
1049 'gdk_drawable_get_data', 'E', #
1050 'gdk_drawable_get_display', 'E', #
1051 'gdk_drawable_get_image', 'E', #
1052 'gdk_drawable_get_screen', 'E', #
1053 'gdk_drawable_get_size', 'W', # deprecated since version 2.24 Use gdk_window_get_width()
1054 # and gdk_window_get_height() for GdkWindows.
1055 # Use gdk_pixmap_get_size() for GdkPixmaps
1056 'gdk_drawable_get_visual', 'E', #
1057 'gdk_drawable_ref', 'E', #
1058 'gdk_drawable_set_data', 'E', #
1059 'gdk_drawable_unref', 'E', #
1060 'gdk_draw_arc', 'E', # deprecated since version 2.22. Use cairo_arc() and
1061 # cairo_fill() or cairo_stroke() instead.
1062 'gdk_draw_drawable', 'E', # deprecated since version 2.22. Use gdk_cairo_set_source_pixmap(),
1063 # cairo_rectangle() and cairo_fill() to draw pixmap
1064 # on top of other drawables
1065 'gdk_draw_glyphs', 'E', #
1066 'gdk_draw_glyphs_transformed', 'E', #
1067 'gdk_draw_gray_image', 'E', #
1068 'gdk_draw_image', 'E', #
1069 'gdk_draw_indexed_image', 'E', #
1070 'gdk_draw_layout', 'E', #
1071 'gdk_draw_layout_line', 'E', #
1072 'gdk_draw_layout_line_with_colors', 'E', #
1073 'gdk_draw_layout_with_colors', 'E', #
1074 'gdk_draw_line', 'W', # deprecated since version 2.22. Use cairo_line_to() and cairo_stroke()
1075 'gdk_draw_lines', 'E', # deprecated since version 2.22. Use cairo_line_to() and cairo_stroke()
1076 'gdk_draw_pixbuf', 'E', # gdk_cairo_set_source_pixbuf() and cairo_paint() or
1077 # cairo_rectangle() and cairo_fill() instead.
1078 'gdk_draw_pixmap', 'E', # gdk_draw_drawable() (gdk_draw_drawable has been
1079 # deprecated since version 2.22 )
1080 'gdk_draw_point', 'E', #
1081 'gdk_draw_points', 'E', #
1082 'gdk_draw_polygon', 'E', # deprecated since version 2.22. Use cairo_line_to()
1083 # or cairo_append_path() and cairo_fill()
1084 # or cairo_stroke() instead.
1085 'gdk_draw_rectangle', 'E', # deprecated since version 2.22, Use cairo_rectangle()
1086 # and cairo_fill() or cairo_stroke()
1087 'gdk_draw_rgb_32_image', 'E', #
1088 'gdk_draw_rgb_32_image_dithalign', 'E', #
1089 'gdk_draw_rgb_image', 'E', #
1090 'gdk_draw_rgb_image_dithalign', 'E', #
1091 'gdk_draw_segments', 'E', #
1092 'gdk_draw_string', 'E', #
1093 'gdk_draw_text', 'E', #
1094 'gdk_draw_text_wc', 'E', #
1095 'gdk_draw_trapezoids', 'E', #
1096 'gdk_event_get_graphics_expose', 'E', #
1098 'GdkFillRule', 'E', #
1100 'gdk_fontset_load', 'E', #
1101 'gdk_fontset_load_for_display', 'E', #
1102 'GdkFontType', 'E', #
1103 'gdk_font_equal', 'E', #
1104 'gdk_font_from_description', 'E', #
1105 'gdk_font_from_description_for_display', 'E', #
1106 'gdk_font_get_display', 'E', #
1107 'gdk_font_id', 'E', #
1108 'gdk_font_load', 'E', #
1109 'gdk_font_load_for_display', 'E', #
1110 'gdk_font_lookup', 'E', #
1111 'gdk_font_lookup_for_display', 'E', #
1112 'gdk_font_ref', 'E', #
1113 'gdk_font_unref', 'E', #
1114 'gdk_FONT_XDISPLAY', 'E', #
1115 'gdk_FONT_XFONT', 'E', #
1116 'gdk_free_compound_text', 'E', #
1117 'gdk_free_text_list', 'E', #
1118 'gdk_gc_copy', 'E', #
1119 'gdk_gc_destroy', 'E', #
1120 'gdk_gc_get_colormap', 'E', #
1121 'gdk_gc_get_screen', 'E', #
1122 'gdk_gc_get_values', 'E', #
1123 'gdk_gc_new', 'W', # deprecated since version 2.22 and should not be used
1124 # in newly-written code. Use Cairo for rendering.
1125 'gdk_gc_new_with_values', 'E', # deprecated since version 2.22
1126 'gdk_gc_offset', 'E', #
1127 'gdk_gc_ref', 'E', #
1128 'gdk_gc_set_background', 'E', #
1129 'gdk_gc_set_clip_mask', 'E', #
1130 'gdk_gc_set_clip_origin', 'E', #
1131 'gdk_gc_set_clip_rectangle', 'E', #
1132 'gdk_gc_set_clip_region', 'E', #
1133 'gdk_gc_set_colormap', 'E', #
1134 'gdk_gc_set_dashes', 'E', #
1135 'gdk_gc_set_exposures', 'E', #
1136 'gdk_gc_set_fill', 'E', # deprecated since version 2.22. Use cairo_pattern_set_extend()
1138 'gdk_gc_set_font', 'E', #
1139 'gdk_gc_set_foreground', 'W', # deprecated since version 2.22. Use gdk_cairo_set_source_color()
1140 # to use a GdkColor as the source in Cairo.
1141 'gdk_gc_set_function', 'W', # deprecated since version 2.22. Use cairo_set_operator() with Cairo.
1142 'gdk_gc_set_line_attributes', 'E', #
1143 'gdk_gc_set_rgb_bg_color', 'E', #
1144 'gdk_gc_set_rgb_fg_color', 'E', # deprecated since version 2.22.
1145 # Use gdk_cairo_set_source_color() instead.
1146 'gdk_gc_set_stipple', 'E', #
1147 'gdk_gc_set_subwindow', 'E', #
1148 'gdk_gc_set_tile', 'E', # deprecated since version 2.22.
1149 # The following code snippet sets a tiling GdkPixmap as the
1151 # gdk_cairo_set_source_pixmap (cr, tile, ts_origin_x, ts_origin_y);
1152 # cairo_pattern_set_extend (cairo_get_source (cr),
1153 # CAIRO_EXTEND_REPEAT);
1154 'gdk_gc_set_ts_origin', 'E', #
1155 'gdk_gc_set_values', 'E', #
1156 'gdk_gc_unref', 'E', # deprecated since version 2.0. Use g_object_unref()
1157 'gdk_get_use_xshm', 'E', #
1158 'gdk_image_destroy', 'E', #
1159 'gdk_image_get', 'E', #
1160 'gdk_image_get_bits_per_pixel', 'E', #
1161 'gdk_image_get_bytes_per_line', 'E', #
1162 'gdk_image_get_bytes_per_pixel', 'E', #
1163 'gdk_image_get_byte_order', 'E', #
1164 'gdk_image_get_colormap', 'E', #
1165 'gdk_image_get_depth', 'E', #
1166 'gdk_image_get_height', 'E', #
1167 'gdk_image_get_image_type', 'E', #
1168 'gdk_image_get_pixel', 'E', #
1169 'gdk_image_get_pixels', 'E', #
1170 'gdk_image_get_visual', 'E', #
1171 'gdk_image_get_width', 'E', #
1172 'gdk_image_new', 'E', #
1173 'gdk_image_new_bitmap', 'E', #
1174 'gdk_image_put_pixel', 'E', #
1175 'gdk_image_ref', 'E', #
1176 'gdk_image_set_colormap', 'E', #
1177 'gdk_image_unref', 'E', #
1178 'gdk_input_add', 'E', #
1179 'gdk_input_add_full', 'E', #
1180 'gdk_input_remove', 'E', #
1181 'gdk_mbstowcs', 'E', #
1182 'gdk_net_wm_supports', 'E', #
1183 'gdk_pango_context_set_colormap', 'E', #
1184 'gdk_pixbuf_render_to_drawable', 'E', #
1185 'gdk_pixbuf_render_to_drawable_alpha', 'E', #
1186 'gdk_pixmap_colormap_create_from_xpm', 'E', #
1187 'gdk_pixmap_colormap_create_from_xpm_d', 'E', #
1188 'gdk_pixmap_create_from_data', 'E', #
1189 'gdk_pixmap_create_from_xpm', 'E', #
1190 'gdk_pixmap_create_from_xpm_d', 'E', # deprecated since version 2.22. Use a GdkPixbuf instead. You can
1191 # use gdk_pixbuf_new_from_xpm_data() to create it.
1192 # If you must use a pixmap, use gdk_pixmap_new() to create it
1193 # and Cairo to draw the pixbuf onto it.
1194 'gdk_pixmap_ref', 'E', #
1195 'gdk_pixmap_unref', 'E', # Deprecated equivalent of g_object_unref().
1196 'gdk_region_polygon', 'E', #
1197 'gdk_region_rect_equal', 'E', #
1198 'gdk_region_shrink', 'E', #
1199 'gdk_region_spans_intersect_foreach', 'E', #
1200 'GdkRgbCmap', 'E', #
1201 'gdk_rgb_cmap_free', 'E', #
1202 'gdk_rgb_cmap_new', 'E', #
1203 'gdk_rgb_colormap_ditherable', 'E', #
1204 'gdk_rgb_ditherable', 'E', #
1205 'gdk_rgb_find_color', 'E', #
1206 'gdk_rgb_gc_set_background', 'E', #
1207 'gdk_rgb_gc_set_foreground', 'E', #
1208 'gdk_rgb_get_cmap', 'E', #
1209 'gdk_rgb_get_colormap', 'E', #
1210 'gdk_rgb_get_visual', 'E', #
1211 'gdk_rgb_init', 'E', #
1212 'gdk_rgb_set_install', 'E', #
1213 'gdk_rgb_set_min_colors', 'E', #
1214 'gdk_rgb_set_verbose', 'E', #
1215 'gdk_rgb_xpixel_from_rgb', 'E', #
1216 'gdk_ROOT_PARENT', 'E', #
1217 'gdk_screen_get_rgb_colormap', 'E', #
1218 'gdk_screen_get_rgb_visual', 'E', #
1219 'GdkSelection', 'E', #
1220 'GdkSelectionType', 'E', #
1221 'gdk_set_locale', 'E', #
1222 'gdk_set_pointer_hooks', 'E', #
1223 'gdk_set_sm_client_id', 'E', #
1224 'gdk_set_use_xshm', 'E', #
1225 'GdkSpanFunc', 'E', #
1226 'gdk_spawn_command_line_on_screen', 'E', #
1227 'gdk_spawn_on_screen', 'E', #
1228 'gdk_spawn_on_screen_with_pipes', 'E', #
1229 'gdk_string_extents', 'E', #
1230 'gdk_string_height', 'E', #
1231 'gdk_string_measure', 'E', #
1232 'gdk_string_to_compound_text', 'E', #
1233 'gdk_string_to_compound_text_for_display', 'E', #
1234 'gdk_string_width', 'E', #
1236 'gdk_text_extents', 'E', #
1237 'gdk_text_extents_wc', 'E', #
1238 'gdk_text_height', 'E', #
1239 'gdk_text_measure', 'E', #
1240 'gdk_text_property_to_text_list', 'E', #
1241 'gdk_text_property_to_text_list_for_display', 'E', #
1242 'gdk_text_property_to_utf8_list', 'E', #
1243 'gdk_text_width', 'E', #
1244 'gdk_text_width_wc', 'E', #
1245 'gdk_threads_mutex', 'E', #
1246 'gdk_utf8_to_compound_text', 'E', #
1247 'gdk_utf8_to_compound_text_for_display', 'E', #
1248 'gdk_visual_ref', 'E', #
1249 'gdk_visual_unref', 'E', #
1250 'gdk_wcstombs', 'E', #
1251 'gdk_window_copy_area', 'E', #
1252 'gdk_window_foreign_new', 'E', #
1253 'gdk_window_foreign_new_for_display', 'E', #
1254 'gdk_window_get_colormap', 'E', # Deprecated equivalent of gdk_drawable_get_colormap().
1255 'gdk_window_get_deskrelative_origin', 'E', #
1256 'gdk_window_get_size', 'E', # Deprecated equivalent of gdk_drawable_get_size().
1257 'gdk_window_get_toplevels', 'E', #
1258 'gdk_window_get_type', 'E', #
1259 'gdk_window_lookup', 'E', #
1260 'gdk_window_lookup_for_display', 'E', #
1261 'gdk_window_ref', 'E', #
1262 'gdk_window_set_colormap', 'E', #
1263 'gdk_window_set_hints', 'E', #
1264 'gdk_window_unref', 'E', #
1265 'gdk_x11_font_get_name', 'E', #
1266 'gdk_x11_font_get_xdisplay', 'E', #
1267 'gdk_x11_font_get_xfont', 'E', #
1268 'gdk_x11_gc_get_xdisplay', 'E', #
1269 'gdk_x11_gc_get_xgc', 'E', #
1270 'gdk_xid_table_lookup', 'E', #
1271 'gdk_xid_table_lookup_for_display', 'E', #
1272 'gdkx_colormap_get', 'E', #
1273 'gdkx_visual_get', 'E', #
1277 @{$APIs{'deprecated-gtk'}->{'functions'}} = grep {$deprecatedGtkFunctions{$_} eq 'E'} keys %deprecatedGtkFunctions;
1278 @{$APIs{'deprecated-gtk-todo'}->{'functions'}} = grep {$deprecatedGtkFunctions{$_} eq 'W'} keys %deprecatedGtkFunctions;
1282 # Given a ref to a hash containing "functions" and "functions_count" entries:
1283 # Determine if any item of the list of APIs contained in the array referenced by "functions"
1284 # exists in the file.
1285 # For each API which appears in the file:
1286 # Push the API onto the provided list;
1287 # Add the number of times the API appears in the file to the total count
1288 # for the API (stored as the value of the API key in the hash referenced by "function_counts").
1290 sub findAPIinFile($$$)
1292 my ($groupHashRef, $fileContentsRef, $foundAPIsRef) = @_;
1294 for my $api ( @{$groupHashRef->{functions}} )
1297 while (${$fileContentsRef} =~ m/ \W $api \W* \( /gx)
1302 push @{$foundAPIsRef}, $api;
1303 $groupHashRef->{function_counts}->{$api} += 1;
1308 sub checkAddTextCalls($$)
1310 my ($fileContentsRef, $filename) = @_;
1311 my $add_text_count = 0;
1312 my $okay_add_text_count = 0;
1313 my $add_xxx_count = 0;
1315 # The 3 loops here are slow, but trying a single loop with capturing
1316 # parenthesis is even slower!
1318 # First count how many proto_tree_add_text() calls there are in total
1319 while (${$fileContentsRef} =~ m/ \W* proto_tree_add_text \W* \( /gox) {
1322 # Then count how many of them are "okay" by virtue of their generate proto_item
1323 # being used (e.g., to hang a subtree off of)
1324 while (${$fileContentsRef} =~ m/ \W* [a-zA-Z0-9]+ \W* = \W* proto_tree_add_text \W* \( /gox) {
1325 $okay_add_text_count++;
1327 # Then count how many proto_tree_add_*() calls there are
1328 while (${$fileContentsRef} =~ m/ \W proto_tree_add_[a-z0-9]+ \W* \( /gox) {
1332 #printf "add_text_count %d, okay_add_text_count %d\n", $add_text_count, $okay_add_text_count;
1333 $add_xxx_count -= $add_text_count;
1334 $add_text_count -= $okay_add_text_count;
1336 # Don't bother with files with small counts
1337 if ($add_xxx_count < 10 || $add_text_count < 10) {
1341 my $percentage = 100*$add_text_count/$add_xxx_count;
1342 if ($percentage > 50) {
1343 printf "%s: found %d useless add_text() vs. %d add_<something else>() calls (%.2f%%)\n",
1344 $filename, $add_text_count, $add_xxx_count, $percentage;
1348 # APIs which (generally) should not be called with an argument of tvb_get_ptr()
1350 # Use NULL for the value_ptr instead of tvb_get_ptr() (only if the
1351 # given offset and length are equal) with these:
1352 'proto_tree_add_bytes_format',
1353 'proto_tree_add_bytes_format_value',
1354 # Use the tvb_* version of these:
1360 # Use tvb_bytes_to_str[_punct] instead of:
1362 'bytes_to_str_punct',
1365 sub checkAPIsCalledWithTvbGetPtr($$$)
1367 my ($APIs, $fileContentsRef, $foundAPIsRef) = @_;
1369 for my $api (@{$APIs}) {
1373 @items = (${$fileContentsRef} =~ m/ ($api [^;]* ; ) /xsg);
1375 my ($item) = @items;
1377 if ($item =~ / tvb_get_ptr /xos) {
1383 push @{$foundAPIsRef}, $api;
1388 sub check_snprintf_plus_strlen($$)
1390 my ($fileContentsRef, $filename) = @_;
1393 # This catches both snprintf() and g_snprint.
1394 # If we need to do more APIs, we can make this function look more like
1395 # checkAPIsCalledWithTvbGetPtr().
1396 @items = (${$fileContentsRef} =~ m/ (snprintf [^;]* ; ) /xsg);
1398 my ($item) = @items;
1400 if ($item =~ / strlen\s*\( /xos) {
1401 print STDERR "Warning: ".$filename." uses snprintf + strlen to assemble strings.\n";
1407 sub check_proto_tree_add_XXX_encoding($$)
1409 my ($fileContentsRef, $filename) = @_;
1413 @items = (${$fileContentsRef} =~ m/ (proto_tree_add_[_a-z0-9]+) \( ([^;]*) \) \s* ; /xsg);
1416 my ($func) = @items;
1418 my ($args) = @items;
1421 # Remove anything inside parenthesis in the arguments so we
1422 # don't get false positives when someone calls
1423 # proto_tree_add_XXX(..., tvb_YYY(..., ENC_ZZZ))
1424 $args =~ s/\(.*\)//g;
1426 if ($args =~ /,\s*ENC_/xos) {
1427 if (!($func =~ /proto_tree_add_(item|bitmask|bits_item|bits_ret_val)/xos)
1429 print STDERR "Error: ".$filename." uses $func with ENC_*.\n";
1432 # Print out the function args to make it easier
1433 # to find the offending code. But first make
1434 # it readable by eliminating extra white space.
1436 print STDERR "\tArgs: " . $args . "\n";
1445 # Verify that all declared ett_ variables are registered.
1446 # Don't bother trying to check usage (for now)...
1447 sub check_ett_registration($$)
1449 my ($fileContentsRef, $filename) = @_;
1450 my @ett_declarations;
1451 my %ett_registrations;
1452 my @unRegisteredEtts;
1455 # A pattern to match ett variable names. Obviously this assumes that
1456 # they start with ett_
1457 my $EttVarName = qr{ (?: ett_[a-z0-9_]+ (?:\[[0-9]+\])? ) }xi;
1459 # Remove macro lines
1460 my $fileContents = ${$fileContentsRef};
1461 $fileContents =~ s { ^\s*\#.*$} []xogm;
1463 # Find all the ett_ variables declared in the file
1464 @ett_declarations = ($fileContents =~ m{
1465 ^\s*static # assume declarations are on their own line
1467 g?int # could be int or gint
1469 ($EttVarName) # variable name
1474 if (!@ett_declarations) {
1475 print "Found no etts in ".$filename."\n";
1479 #print "Found these etts in ".$filename.": ".join(',', @ett_declarations)."\n\n";
1481 # Find the array used for registering the etts
1482 # Save off the block of code containing just the variables
1484 @reg_blocks = ($fileContents =~ m{
1488 \s*\*\s* # it's an array of pointers
1489 [a-z0-9_]+ # array name; usually (always?) "ett"
1490 \s*\[\s*\]\s* # array brackets
1493 ((?:\s*&\s* # address of the following variable
1494 $EttVarName # variable name
1495 \s*,? # the comma is optional (for the last entry)
1496 \s*)+) # match one or more variable names
1501 #print "Found this ett registration block in ".$filename.": ".join(',', @reg_blocks)."\n";
1503 if (@reg_blocks == 0) {
1504 print "Hmm, found ".@reg_blocks." ett registration blocks in ".$filename."\n";
1509 while (@reg_blocks) {
1510 my ($block) = @reg_blocks;
1513 # Convert the list returned by the match into a hash of the
1514 # form ett_variable_name -> 1. Then combine this new hash with
1515 # the hash from the last registration block.
1516 # (Of course) using hashes makes the lookups much faster.
1517 %ett_registrations = map { $_ => 1 } ($block =~ m{
1518 \s*&\s* # address of the following variable
1519 ($EttVarName) # variable name
1520 \s*,? # the comma is optional (for the last entry)
1521 }xgios, %ett_registrations);
1523 #print "Found these ett registrations in ".$filename.": ";
1524 #while( my ($k, $v) = each %ett_registrations ) {
1528 # Find which declared etts are not registered.
1529 # XXX - using <@ett_declarations> and $_ instead of $ett_var makes this
1530 # MUCH slower... Why?
1531 while (@ett_declarations) {
1532 my ($ett_var) = @ett_declarations;
1533 shift @ett_declarations;
1535 push(@unRegisteredEtts, $ett_var) if (!$ett_registrations{$ett_var});
1538 if (@unRegisteredEtts) {
1539 print STDERR "Error: found these unregistered ett variables in ".$filename.": ".join(',', @unRegisteredEtts)."\n";
1546 # Given the file contents and a file name, check all of the hf entries for
1547 # various problems (such as those checked for in proto.c).
1548 sub check_hf_entries($$)
1550 my ($fileContentsRef, $filename) = @_;
1554 @items = (${$fileContentsRef} =~ m{
1557 &\s*([A-Z0-9_\[\]-]+) # &hf
1560 ("[A-Z0-9 '\./\(\)_:-]+") # name
1562 (NULL|"[A-Z0-9_\.-]*") # abbrev
1564 (FT_[A-Z0-9_]+) # field type
1566 ([A-Z0-9x\|_]+) # display
1568 ([A-Z0-9&_\(\)' -]+) # convert
1570 ([A-Z0-9_]+) # bitmask
1572 (NULL|"[A-Z0-9 '\./\(\)\?_:-]+") # blurb (NULL or a string)
1577 #print "Found @items items\n";
1579 my ($hf, $name, $abbrev, $ft, $display, $convert, $bitmask, $blurb) = @items;
1580 shift @items; shift @items; shift @items; shift @items; shift @items; shift @items; shift @items; shift @items;
1582 #print "name=$name, abbrev=$abbrev, ft=$ft, display=$display, convert=$convert, bitmask=$bitmask, blurb=$blurb\n";
1584 if ($abbrev eq '""' || $abbrev eq "NULL") {
1585 print STDERR "Error: $hf does not have an abbreviation in $filename\n";
1588 if ($abbrev =~ m/\.\.+/) {
1589 print STDERR "Error: the abbreviation for $hf ($abbrev) contains two or more sequential periods in $filename\n";
1592 if ($name eq $abbrev) {
1593 print STDERR "Error: the abbreviation for $hf matches the field name in $filename\n";
1596 if (lc($name) eq lc($blurb)) {
1597 print STDERR "Error: the blurb for $hf ($abbrev) matches the field name in $filename\n";
1600 if ($name =~ m/"\s+/) {
1601 print STDERR "Error: the name for $hf ($abbrev) has leading space in $filename\n";
1604 if ($name =~ m/\s+"/) {
1605 print STDERR "Error: the name for $hf ($abbrev) has trailing space in $filename\n";
1608 if ($blurb =~ m/"\s+/) {
1609 print STDERR "Error: the blurb for $hf ($abbrev) has leading space in $filename\n";
1612 if ($blurb =~ m/\s+"/) {
1613 print STDERR "Error: the blurb for $hf ($abbrev) has trailing space in $filename\n";
1616 if ($abbrev =~ m/\s+/) {
1617 print STDERR "Error: the abbreviation for $hf ($abbrev) has white space in $filename\n";
1620 if ("\"".$hf ."\"" eq $name) {
1621 print STDERR "Error: name is the hf_variable_name in field $name ($abbrev) in $filename\n";
1624 if ("\"".$hf ."\"" eq $abbrev) {
1625 print STDERR "Error: abbreviation is the hf_variable_name in field $name ($abbrev) in $filename\n";
1628 if ($ft ne "FT_BOOLEAN" && $convert =~ m/^TFS\(.*\)/) {
1629 print STDERR "Error: $hf uses a true/false string but is an $ft instead of FT_BOOLEAN in $filename\n";
1632 if ($ft eq "FT_BOOLEAN" && $convert =~ m/^VALS\(.*\)/) {
1633 print STDERR "Error: $hf uses a value_string but is an FT_BOOLEAN in $filename\n";
1636 if (($ft eq "FT_BOOLEAN") && ($bitmask !~ /^(0x)?0+$/) && ($display =~ /^BASE_/)) {
1637 print STDERR "Error: $hf: FT_BOOLEAN with a bitmask must specify a 'parent field width' for 'display' in $filename\n";
1640 if ($convert =~ m/RVALS/ && $display !~ m/BASE_RANGE_STRING/) {
1641 print STDERR "Error: $hf uses RVALS but 'display' does not include BASE_RANGE_STRING in $filename\n";
1645 ## if (($ft eq "FT_BOOLEAN") && ($bitmask =~ /^(0x)?0+$/) && ($display ne "BASE_NONE")) {
1646 ## print STDERR "Error: $abbrev: FT_BOOLEAN with no bitmask must use BASE_NONE for 'display' in $filename\n";
1654 # The below Regexp are based on those from:
1655 # http://aspn.activestate.com/ASPN/Cookbook/Rx/Recipe/59811
1656 # They are in the public domain.
1658 # 1. A complicated regex which matches C-style comments.
1659 my $CComment = qr{ / [*] [^*]* [*]+ (?: [^/*] [^*]* [*]+ )* / }x;
1661 # 1.a A regex that matches C++-style comments.
1662 #my $CppComment = qr{ // (.*?) \n }x;
1664 # 2. A regex which matches double-quoted strings.
1665 # ?s added so that strings containing a 'line continuation'
1666 # ( \ followed by a new-line) will match.
1667 my $DoubleQuotedStr = qr{ (?: ["] (?s: \\. | [^\"\\])* ["]) }x;
1669 # 3. A regex which matches single-quoted strings.
1670 my $SingleQuotedStr = qr{ (?: \' (?: \\. | [^\'\\])* [']) }x;
1672 # 4. Now combine 1 through 3 to produce a regex which
1673 # matches _either_ double or single quoted strings
1674 # OR comments. We surround the comment-matching
1675 # regex in capturing parenthesis to store the contents
1676 # of the comment in $1.
1677 # my $commentAndStringRegex = qr{(?:$DoubleQuotedStr|$SingleQuotedStr)|($CComment)|($CppComment)};
1679 # 4. Wireshark is strictly a C program so don't take out C++ style comments
1680 # since they shouldn't be there anyway...
1681 # Also: capturing the comment isn't necessary.
1682 my $commentAndStringRegex = qr{ (?: $DoubleQuotedStr | $SingleQuotedStr | $CComment) }x;
1684 #### Regex for use when searching for value-string definitions
1685 my $StaticRegex = qr/ static \s+ /xs;
1686 my $ConstRegex = qr/ const \s+ /xs;
1687 my $Static_andor_ConstRegex = qr/ (?: $StaticRegex $ConstRegex | $StaticRegex | $ConstRegex) /xs;
1688 my $ValueStringRegex = qr/ $Static_andor_ConstRegex (?:value|string|range)_string \ + [^;*]+ = [^;]+ [{] [^;]+ ; /xs;
1689 my $EnumValRegex = qr/ $Static_andor_ConstRegex enum_val_t \ + [^;*]+ = [^;]+ [{] [^;]+ ; /xs;
1695 # The default list, which can be expanded.
1696 my @apiGroups = qw(prohibited deprecated);
1697 my @apiSummaryGroups = ();
1698 my $check_value_string_array_null_termination = 1; # default: enabled
1699 my $machine_readable_output = 0; # default: disabled
1700 my $check_hf = 1; # default: enabled
1702 my $buildbot_flag = 0;
1704 my $result = GetOptions(
1705 'group=s' => \@apiGroups,
1706 'summary-group=s' => \@apiSummaryGroups,
1707 'check-value-string-array-null-termination!' => \$check_value_string_array_null_termination,
1708 'Machine-readable' => \$machine_readable_output,
1709 'nohf' => \$check_hf,
1710 'build' => \$buildbot_flag,
1711 'debug' => \$debug_flag
1714 print "Usage: checkAPIs.pl [-M] [-g group1] [-g group2] ... [-s group1] [-s group2] ... [--nocheck-value-string-array-null-termination] file1 file2 ..\n";
1715 print " -g <group>: Check input files for use of APIs in <group> (in addition to the default groups)\n";
1716 print " -s <group>: Output summary (count) for each API in <group> (-g <group> also req'd)\n";
1717 print " -M: Generate output for -g in 'machine-readable' format\n";
1719 print " Default Groups[-g]: ", join (", ", sort @apiGroups), "\n";
1720 print " Available Groups: ", join (", ", sort keys %APIs), "\n";
1724 # Add a 'function_count' anonymous hash to each of the 'apiGroup' entries in the %APIs hash.
1725 for my $apiGroup (keys %APIs) {
1726 my @functions = @{$APIs{$apiGroup}{functions}};
1728 $APIs{$apiGroup}->{function_counts} = {};
1729 @{$APIs{$apiGroup}->{function_counts}}{@functions} = (); # Add fcn names as keys to the anonymous hash
1733 # Read through the files; do various checks
1734 while ($_ = $ARGV[0])
1738 my $fileContents = '';
1742 die "No such file: \"$filename\"" if (! -e $filename);
1744 # delete leading './'
1745 $filename =~ s{ ^ \. / } {}xo;
1747 # Read in the file (ouch, but it's easier that way)
1748 open(FC, $filename) || die("Couldn't open $filename");
1751 $fileContents .= $_;
1752 if ($_ =~ m{ [\x80-\xFF] }xo) {
1753 print STDERR "Error: Found non-ASCII characters on line " .$line. " of " .$filename."\n";
1760 if ($fileContents =~ m{ %ll }xo)
1762 # use G_GINT64_MODIFIER instead of ll
1763 print STDERR "Error: Found %ll in " .$filename."\n";
1766 if ($fileContents =~ m{ %hh }xo)
1768 # %hh is C99 and Windows doesn't like it:
1769 # http://connect.microsoft.com/VisualStudio/feedback/details/416843/sscanf-cannot-not-handle-hhd-format
1770 # Need to use temporary variables instead.
1771 print STDERR "Error: Found %hh in " .$filename."\n";
1775 if (! ($fileContents =~ m{ \$Id .* \$ }xo))
1777 print STDERR "Warning: ".$filename." does not have an SVN Id tag.\n";
1780 # optionally check the hf entries
1782 $errorCount += check_hf_entries(\$fileContents, $filename);
1785 # Remove all the C-comments and strings
1786 $fileContents =~ s {$commentAndStringRegex} []xog;
1788 #$errorCount += check_ett_registration(\$fileContents, $filename);
1790 if ($fileContents =~ m{ // }xo)
1792 print STDERR "Error: Found C++ style comments in " .$filename."\n";
1796 #checkAPIsCalledWithTvbGetPtr(\@TvbPtrAPIs, \$fileContents, \@foundAPIs);
1798 # print STDERR "Found APIs with embedded tvb_get_ptr() calls in ".$filename.": ".join(',', @foundAPIs)."\n"
1801 check_snprintf_plus_strlen(\$fileContents, $filename);
1803 if (! $buildbot_flag) {
1804 checkAddTextCalls(\$fileContents, $filename);
1807 $errorCount += check_proto_tree_add_XXX_encoding(\$fileContents, $filename);
1809 # Brute force check for value_string (and string_string or range_string) arrays
1810 # which are missing {0, NULL} as the final (terminating) array entry
1811 if ($check_value_string_array_null_termination) {
1812 # Assumption: definition is of form (pseudo-Regex):
1813 # " (static const|static|const) (value|string|range)_string .+ = { .+ ;"
1814 # (possibly over multiple lines)
1815 while ($fileContents =~ / ( $ValueStringRegex ) /xsog) {
1816 # XXX_string array definition found; check if NULL terminated
1817 my $vs = my $vsx = $1;
1819 $vsx =~ / ( .+ (?:value|string|range)_string [^=]+ ) = /xo;
1820 printf STDERR "==> %-35.35s: %s\n", $filename, $1;
1821 printf STDERR "%s\n", $vs;
1823 $vs =~ s{ \s } {}xg;
1824 # README.developer says
1825 # "Don't put a comma after the last tuple of an initializer of an array"
1826 # However: since this usage is present in some number of cases, we'll allow for now
1827 if ($vs !~ / , NULL [}] ,? [}] ; $/xo) {
1828 $vsx =~ /( (?:value|string|range)_string [^=]+ ) = /xo;
1829 printf STDERR "Error: %-35.35s: {..., NULL} is required as the last XXX_string array entry: %s\n", $filename, $1;
1832 if ($vs !~ / (static)? const (?:value|string|range)_string /xo) {
1833 $vsx =~ /( (?:value|string|range)_string [^=]+ ) = /xo;
1834 printf STDERR "Error: %-35.35s: Missing 'const': %s\n", $filename, $1;
1840 # Brute force check for enum_val_t arrays which are missing {NULL, NULL, ...}
1841 # as the final (terminating) array entry
1842 # For now use the same option to turn this and value_string checking on and off.
1843 # (Is the option even necessary?)
1844 if ($check_value_string_array_null_termination) {
1845 # Assumption: definition is of form (pseudo-Regex):
1846 # " (static const|static|const) enum_val_t .+ = { .+ ;"
1847 # (possibly over multiple lines)
1848 while ($fileContents =~ / ( $EnumValRegex ) /xsog) {
1849 # enum_val_t array definition found; check if NULL terminated
1850 my $vs = my $vsx = $1;
1852 $vsx =~ / ( .+ enum_val_t [^=]+ ) = /xo;
1853 printf STDERR "==> %-35.35s: %s\n", $filename, $1;
1854 printf STDERR "%s\n", $vs;
1856 $vs =~ s{ \s } {}xg;
1857 # README.developer says
1858 # "Don't put a comma after the last tuple of an initializer of an array"
1859 # However: since this usage is present in some number of cases, we'll allow for now
1860 if ($vs !~ / NULL, NULL, -?[0-9] [}] ,? [}] ; $/xo) {
1861 $vsx =~ /( enum_val_t [^=]+ ) = /xo;
1862 printf STDERR "Error: %-35.35s: {NULL, NULL, ...} is required as the last enum_val_t array entry: %s\n", $filename, $1;
1865 if ($vs !~ / (static)? const enum_val_t /xo) {
1866 $vsx =~ /( enum_val_t [^=]+ ) = /xo;
1867 printf STDERR "Error: %-35.35s: Missing 'const': %s\n", $filename, $1;
1873 # Check and count APIs
1874 for my $apiGroup (@apiGroups) {
1875 my $pfx = "Warning";
1878 findAPIinFile($APIs{$apiGroup}, \$fileContents, \@foundAPIs);
1880 if ($APIs{$apiGroup}->{count_errors}) {
1881 # the use of "prohibited" APIs is an error, increment the error count
1882 $errorCount += @foundAPIs;
1886 if (@foundAPIs && ! $machine_readable_output) {
1887 print STDERR $pfx . ": Found " . $apiGroup . " APIs in ".$filename.": ".join(',', @foundAPIs)."\n";
1889 if (@foundAPIs && $machine_readable_output) {
1890 for my $api (@foundAPIs) {
1891 printf STDERR "%-8.8s %-20.20s %-30.30s %-45.45s\n", $pfx, $apiGroup, $filename, $api;
1897 # Summary: Print Use Counts of each API in each requested summary group
1899 for my $apiGroup (@apiSummaryGroups) {
1900 printf "\n\nUse Counts\n";
1901 for my $api (sort {"\L$a" cmp "\L$b"} (keys %{$APIs{$apiGroup}->{function_counts}} )) {
1902 printf "%-20.20s %5d %-40.40s\n", $apiGroup . ':', $APIs{$apiGroup}{function_counts}{$api}, $api;