winapi_global.pm 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #
  2. # Copyright 1999, 2000, 2001 Patrik Stridvall
  3. #
  4. # This library is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU Lesser General Public
  6. # License as published by the Free Software Foundation; either
  7. # version 2.1 of the License, or (at your option) any later version.
  8. #
  9. # This library is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. # Lesser General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU Lesser General Public
  15. # License along with this library; if not, write to the Free Software
  16. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  17. #
  18. package winapi_global;
  19. use strict;
  20. use modules qw($modules);
  21. use nativeapi qw($nativeapi);
  22. use options qw($options);
  23. use output qw($output);
  24. use winapi qw(@winapis);
  25. sub check_modules($$) {
  26. my $complete_module = shift;
  27. my $module2functions = shift;
  28. my @complete_modules = sort(keys(%$complete_module));
  29. if($options->declared) {
  30. foreach my $module (@complete_modules) {
  31. foreach my $winapi (@winapis) {
  32. if(!$winapi->is_module($module)) { next; }
  33. my $functions = $$module2functions{$module};
  34. foreach my $internal_name ($winapi->all_internal_functions_in_module($module)) {
  35. next if $internal_name =~ /\./;
  36. my $function = $functions->{$internal_name};
  37. if(!defined($function) && !$nativeapi->is_function($internal_name))
  38. {
  39. $output->write("*.c: $module: $internal_name: " .
  40. "function declared but not implemented or declared external\n");
  41. }
  42. }
  43. }
  44. }
  45. }
  46. if($options->argument && $options->argument_forbidden) {
  47. foreach my $winapi (@winapis) {
  48. my $types_not_used = $winapi->types_not_used;
  49. foreach my $module (sort(keys(%$types_not_used))) {
  50. if(!$$complete_module{$module}) { next; }
  51. foreach my $type (sort(keys(%{$$types_not_used{$module}}))) {
  52. $output->write("*.c: $module: type ($type) not used\n");
  53. }
  54. }
  55. }
  56. }
  57. }
  58. sub check_all_modules($) {
  59. my $include2info = shift;
  60. winapi_documentation::report_documentation();
  61. if($options->headers_unused && $options->include) {
  62. foreach my $name (sort(keys(%$include2info))) {
  63. if(!$$include2info{$name}{used}) {
  64. $output->write("*.c: $name: include file is never used\n");
  65. }
  66. }
  67. }
  68. $modules->global_report;
  69. $nativeapi->global_report;
  70. }
  71. 1;