c_function.pm 3.21 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#
# Copyright 1999, 2000, 2001 Patrik Stridvall
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# 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
#

19 20 21 22
package c_function;

use strict;

23 24
sub new($)
{
25
    my ($proto) = @_;
26 27 28 29 30 31 32
    my $class = ref($proto) || $proto;
    my $self  = {};
    bless ($self, $class);

    return $self;
}

33 34 35 36 37 38 39

#
# Property setter / getter functions (each does both)
#

sub file($;$)
{
40 41 42
    my ($self, $filename) = @_;
    $self->{file} = $filename if (defined $filename);
    return $self->{file};
43 44
}

45
sub begin_line($$)
46
{
47 48 49
    my ($self, $begin_line) = @_;
    $self->{begin_line} = $begin_line if (defined $begin_line);
    return $self->{begin_line};
50 51
}

52 53
sub begin_column($;$)
{
54 55 56
    my ($self, $begin_column) = @_;
    $self->{begin_column} = $begin_column if (defined $begin_column);
    return $self->{begin_column};
57 58
}

59 60
sub end_line($;$)
{
61 62 63
    my ($self, $end_line) = @_;
    $self->{end_line} = $end_line if (defined $end_line);
    return $self->{end_line};
64 65
}

66 67
sub end_column($;$)
{
68 69 70
    my ($self, $end_column) = @_;
    $self->{end_column} = $end_column if (defined $end_column);
    return $self->{end_column};
71 72
}

73 74
sub linkage($;$)
{
75 76 77
    my ($self, $linkage) = @_;
    $self->{linkage} = $linkage if (defined $linkage);
    return $self->{linkage};
78 79
}

80 81
sub return_type($;$)
{
82 83 84
     my ($self, $return_type) = @_;
    $self->{return_type} = $return_type if (defined $return_type);
    return $self->{return_type};
85 86
}

87 88
sub calling_convention($;$)
{
89 90 91
    my ($self, $calling_convention) = @_;
    $self->{calling_convention} = $calling_convention if (defined $calling_convention);
    return $self->{calling_convention};
92 93
}

94 95
sub name($;$)
{
96 97 98
    my ($self, $name) = @_;
    $self->{name} = $name if (defined $name);
    return $self->{name};
99 100
}

101 102
sub argument_types($;$)
{
103 104 105
    my ($self, $argument_types) = @_;
    $self->{argument_types} = $argument_types if (defined $argument_types);
    return $self->{argument_types};
106 107
}

108 109
sub argument_names($;$)
{
110 111 112
    my ($self, $argument_names) = @_;
    $self->{argument_names} = $argument_names if (defined $argument_names);
    return $self->{argument_names};
113 114
}

115 116
sub statements_line($;$)
{
117 118 119
    my ($self, $statements_line) = @_;
    $self->{statements_line} = $statements_line if (defined $statements_line);
    return $self->{statements_line};
120 121
}

122 123
sub statements_column($;$)
{
124 125 126
    my ($self, $statements_column) = @_;
    $self->{statements_column} = $statements_column if (defined $statements_column);
    return $self->{statements_column};
127 128
}

129 130
sub statements($;$)
{
131 132 133
    my ($self, $statements) = @_;
    $self->{statements} = $statements if (defined $statements);
    return $self->{statements};
134 135 136
}

1;