c_function.pm 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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 c_function;
  19. use strict;
  20. use warnings 'all';
  21. sub new($)
  22. {
  23. my ($proto) = @_;
  24. my $class = ref($proto) || $proto;
  25. my $self = {};
  26. bless ($self, $class);
  27. return $self;
  28. }
  29. #
  30. # Property setter / getter functions (each does both)
  31. #
  32. sub file($;$)
  33. {
  34. my ($self, $filename) = @_;
  35. $self->{file} = $filename if (defined $filename);
  36. return $self->{file};
  37. }
  38. sub begin_line($$)
  39. {
  40. my ($self, $begin_line) = @_;
  41. $self->{begin_line} = $begin_line if (defined $begin_line);
  42. return $self->{begin_line};
  43. }
  44. sub begin_column($;$)
  45. {
  46. my ($self, $begin_column) = @_;
  47. $self->{begin_column} = $begin_column if (defined $begin_column);
  48. return $self->{begin_column};
  49. }
  50. sub end_line($;$)
  51. {
  52. my ($self, $end_line) = @_;
  53. $self->{end_line} = $end_line if (defined $end_line);
  54. return $self->{end_line};
  55. }
  56. sub end_column($;$)
  57. {
  58. my ($self, $end_column) = @_;
  59. $self->{end_column} = $end_column if (defined $end_column);
  60. return $self->{end_column};
  61. }
  62. sub linkage($;$)
  63. {
  64. my ($self, $linkage) = @_;
  65. $self->{linkage} = $linkage if (defined $linkage);
  66. return $self->{linkage};
  67. }
  68. sub return_type($;$)
  69. {
  70. my ($self, $return_type) = @_;
  71. $self->{return_type} = $return_type if (defined $return_type);
  72. return $self->{return_type};
  73. }
  74. sub calling_convention($;$)
  75. {
  76. my ($self, $calling_convention) = @_;
  77. $self->{calling_convention} = $calling_convention if (defined $calling_convention);
  78. return $self->{calling_convention};
  79. }
  80. sub name($;$)
  81. {
  82. my ($self, $name) = @_;
  83. $self->{name} = $name if (defined $name);
  84. return $self->{name};
  85. }
  86. sub argument_types($;$)
  87. {
  88. my ($self, $argument_types) = @_;
  89. $self->{argument_types} = $argument_types if (defined $argument_types);
  90. return $self->{argument_types};
  91. }
  92. sub argument_names($;$)
  93. {
  94. my ($self, $argument_names) = @_;
  95. $self->{argument_names} = $argument_names if (defined $argument_names);
  96. return $self->{argument_names};
  97. }
  98. sub statements_line($;$)
  99. {
  100. my ($self, $statements_line) = @_;
  101. $self->{statements_line} = $statements_line if (defined $statements_line);
  102. return $self->{statements_line};
  103. }
  104. sub statements_column($;$)
  105. {
  106. my ($self, $statements_column) = @_;
  107. $self->{statements_column} = $statements_column if (defined $statements_column);
  108. return $self->{statements_column};
  109. }
  110. sub statements($;$)
  111. {
  112. my ($self, $statements) = @_;
  113. $self->{statements} = $statements if (defined $statements);
  114. return $self->{statements};
  115. }
  116. 1;