| 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-2021 -- leonerd@leonerd.org.uk |
|
5
|
|
|
|
|
|
|
|
|
6
|
15
|
|
|
15
|
|
160
|
use v5.26; |
|
|
15
|
|
|
|
|
43
|
|
|
7
|
15
|
|
|
15
|
|
67
|
use Object::Pad 0.43; |
|
|
15
|
|
|
|
|
153
|
|
|
|
15
|
|
|
|
|
63
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package Tangence::Meta::Struct 0.28; |
|
10
|
|
|
|
|
|
|
class Tangence::Meta::Struct :strict(params); |
|
11
|
|
|
|
|
|
|
|
|
12
|
15
|
|
|
15
|
|
4347
|
use Carp; |
|
|
15
|
|
|
|
|
30
|
|
|
|
15
|
|
|
|
|
7049
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 NAME |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
C - structure representing one C structure |
|
17
|
|
|
|
|
|
|
type |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
This data structure stores information about one L structure type. |
|
22
|
|
|
|
|
|
|
Once constructed and defined, such objects are immutable. |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head2 new |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$struct = Tangence::Meta::Struct->new( name => $name ) |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Returns a new instance representing the given name. |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
|
37
|
|
|
|
|
|
|
|
|
38
|
12
|
|
|
12
|
1
|
30
|
has $name :param :reader; |
|
|
12
|
|
|
|
|
75
|
|
|
39
|
555
|
|
|
555
|
1
|
669
|
has $defined :reader = 0; |
|
|
555
|
|
|
|
|
1043
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
has @fields; |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 define |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
$struct->define( %args ) |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Provides a definition for the structure. |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=over 8 |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=item fields => ARRAY |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
ARRAY reference containing metadata about the structure's fields, as instances |
|
54
|
|
|
|
|
|
|
of L. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=back |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
|
59
|
|
|
|
|
|
|
|
|
60
|
68
|
|
|
|
|
88
|
method define ( %args ) |
|
|
68
|
|
|
|
|
114
|
|
|
|
68
|
|
|
|
|
81
|
|
|
61
|
68
|
|
|
68
|
1
|
134
|
{ |
|
62
|
68
|
50
|
|
|
|
146
|
$defined and croak "Cannot define $name twice"; |
|
63
|
|
|
|
|
|
|
|
|
64
|
68
|
|
|
|
|
85
|
$defined++; |
|
65
|
68
|
|
|
|
|
86
|
@fields = @{ $args{fields} }; |
|
|
68
|
|
|
|
|
208
|
|
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 ACCESSORS |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 defined |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
$defined = $struct->defined |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Returns true if a definition of the structure has been provided using |
|
77
|
|
|
|
|
|
|
C. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 name |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
$name = $struct->name |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Returns the name of the structure |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 fields |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
@fields = $struct->fields |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Returns a list of the fields defined on the structure, in their order of |
|
94
|
|
|
|
|
|
|
definition. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
method fields |
|
99
|
553
|
|
|
553
|
1
|
858
|
{ |
|
100
|
553
|
50
|
|
|
|
930
|
$self->defined or croak $self->name . " is not yet defined"; |
|
101
|
553
|
|
|
|
|
1263
|
return @fields; |
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 AUTHOR |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Paul Evans |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=cut |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
0x55AA; |