| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# You may distribute under the terms of either the GNU General Public License |
|
2
|
|
|
|
|
|
|
# or the Artistic License (the same terms as Perl itself) |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
# (C) Paul Evans, 2012-2024 -- leonerd@leonerd.org.uk |
|
5
|
|
|
|
|
|
|
|
|
6
|
15
|
|
|
15
|
|
204
|
use v5.26; |
|
|
15
|
|
|
|
|
59
|
|
|
7
|
15
|
|
|
15
|
|
88
|
use warnings; |
|
|
15
|
|
|
|
|
33
|
|
|
|
15
|
|
|
|
|
1042
|
|
|
8
|
15
|
|
|
15
|
|
92
|
use Object::Pad 0.800; |
|
|
15
|
|
|
|
|
118
|
|
|
|
15
|
|
|
|
|
804
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
package Tangence::Meta::Struct 0.33; |
|
11
|
|
|
|
|
|
|
class Tangence::Meta::Struct :strict(params); |
|
12
|
|
|
|
|
|
|
|
|
13
|
15
|
|
|
15
|
|
6483
|
use Carp; |
|
|
15
|
|
|
|
|
35
|
|
|
|
15
|
|
|
|
|
13539
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
C - structure representing one C structure |
|
18
|
|
|
|
|
|
|
type |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
This data structure stores information about one L structure type. |
|
23
|
|
|
|
|
|
|
Once constructed and defined, such objects are immutable. |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head2 new |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
$struct = Tangence::Meta::Struct->new( name => $name ) |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Returns a new instance representing the given name. |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
|
38
|
|
|
|
|
|
|
|
|
39
|
12
|
|
|
12
|
1
|
43
|
field $name :param :reader; |
|
|
12
|
|
|
|
|
113
|
|
|
40
|
555
|
|
|
555
|
1
|
991
|
field $defined :reader = 0; |
|
41
|
|
|
|
|
|
|
|
|
42
|
555
|
|
|
|
|
1419
|
field @fields; |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head2 define |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
$struct->define( %args ) |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Provides a definition for the structure. |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=over 8 |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item fields => ARRAY |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
ARRAY reference containing metadata about the structure's fields, as instances |
|
55
|
|
|
|
|
|
|
of L. |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=back |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
|
60
|
|
|
|
|
|
|
|
|
61
|
68
|
|
|
68
|
1
|
124
|
method define ( %args ) |
|
|
68
|
|
|
|
|
221
|
|
|
|
68
|
|
|
|
|
164
|
|
|
|
68
|
|
|
|
|
124
|
|
|
62
|
|
|
|
|
|
|
{ |
|
63
|
68
|
50
|
|
|
|
191
|
$defined and croak "Cannot define $name twice"; |
|
64
|
|
|
|
|
|
|
|
|
65
|
68
|
|
|
|
|
110
|
$defined++; |
|
66
|
68
|
|
|
|
|
109
|
@fields = @{ $args{fields} }; |
|
|
68
|
|
|
|
|
289
|
|
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 ACCESSORS |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 defined |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
$defined = $struct->defined |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Returns true if a definition of the structure has been provided using |
|
78
|
|
|
|
|
|
|
C. |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 name |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
$name = $struct->name |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Returns the name of the structure |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 fields |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
@fields = $struct->fields |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Returns a list of the fields defined on the structure, in their order of |
|
95
|
|
|
|
|
|
|
definition. |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
method fields |
|
100
|
|
|
|
|
|
|
{ |
|
101
|
|
|
|
|
|
|
$self->defined or croak $self->name . " is not yet defined"; |
|
102
|
|
|
|
|
|
|
return @fields; |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 AUTHOR |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Paul Evans |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=cut |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
0x55AA; |