| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
## no critic qw(ProhibitUselessNoCritic PodSpelling ProhibitExcessMainComplexity) # DEVELOPER DEFAULT 1a: allow unreachable & POD-commented code; SYSTEM SPECIAL 4: allow complex code outside subroutines, must be on line 1 |
|
2
|
|
|
|
|
|
|
package RPerl::DataStructure::Array::SubTypes; |
|
3
|
9
|
|
|
9
|
|
60
|
use strict; |
|
|
9
|
|
|
|
|
20
|
|
|
|
9
|
|
|
|
|
229
|
|
|
4
|
9
|
|
|
9
|
|
44
|
use warnings; |
|
|
9
|
|
|
|
|
22
|
|
|
|
9
|
|
|
|
|
197
|
|
|
5
|
9
|
|
|
9
|
|
46
|
use RPerl::AfterSubclass; |
|
|
9
|
|
|
|
|
18
|
|
|
|
9
|
|
|
|
|
1188
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = 0.010_000; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# [[[ CRITICS ]]] |
|
9
|
|
|
|
|
|
|
## no critic qw(ProhibitUselessNoCritic ProhibitMagicNumbers RequireCheckedSyscalls) # USER DEFAULT 1: allow numeric values & print operator |
|
10
|
|
|
|
|
|
|
## no critic qw(ProhibitUnreachableCode RequirePodSections RequirePodAtEnd) # DEVELOPER DEFAULT 1b: allow unreachable & POD-commented code, must be after line 1 |
|
11
|
|
|
|
|
|
|
## no critic qw(RequireInterpolationOfMetachars) # USER DEFAULT 2: allow single-quoted control characters & sigils |
|
12
|
|
|
|
|
|
|
## no critic qw(Capitalization ProhibitMultiplePackages ProhibitReusedNames) # SYSTEM DEFAULT 3: allow multiple & lower case package names |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# [[[ EXPORTS ]]] |
|
15
|
9
|
|
|
9
|
|
63
|
use Exporter 'import'; |
|
|
9
|
|
|
|
|
20
|
|
|
|
9
|
|
|
|
|
463
|
|
|
16
|
|
|
|
|
|
|
our @EXPORT = qw(arrayref_CHECK arrayref_CHECKTRACE integer_arrayref_CHECK integer_arrayref_CHECKTRACE number_arrayref_CHECK number_arrayref_CHECKTRACE string_arrayref_CHECK string_arrayref_CHECKTRACE); |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# [[[ INCLUDES ]]] |
|
19
|
9
|
|
|
9
|
|
57
|
use RPerl::DataType::Integer; # integer_CHECKTRACE |
|
|
9
|
|
|
|
|
22
|
|
|
|
9
|
|
|
|
|
784
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# [[[ PRE-DECLARED TYPES ]]] |
|
22
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
23
|
|
|
|
|
|
|
boolean; |
|
24
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
25
|
|
|
|
|
|
|
unsigned_integer; |
|
26
|
|
|
|
|
|
|
#package # hide from PAUSE indexing |
|
27
|
|
|
|
|
|
|
# integer; |
|
28
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
29
|
|
|
|
|
|
|
number; |
|
30
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
31
|
|
|
|
|
|
|
character; |
|
32
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
33
|
|
|
|
|
|
|
string; |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# [[[ ARRAYS ]]] |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# an array is a 1-dimensional list/vector/sequence/set of data types; |
|
38
|
|
|
|
|
|
|
# we never use this type directly, instead we always use the arrayref type, |
|
39
|
|
|
|
|
|
|
# per LMPC #27: Thou Shalt Not Use Direct Access To Arrays & Hashes Stored In @ Or % Non-Scalar Variables |
|
40
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
41
|
|
|
|
|
|
|
array; |
|
42
|
9
|
|
|
9
|
|
62
|
use strict; |
|
|
9
|
|
|
|
|
27
|
|
|
|
9
|
|
|
|
|
193
|
|
|
43
|
9
|
|
|
9
|
|
45
|
use warnings; |
|
|
9
|
|
|
|
|
20
|
|
|
|
9
|
|
|
|
|
269
|
|
|
44
|
9
|
|
|
9
|
|
65
|
use parent qw(RPerl::DataStructure::Array); |
|
|
9
|
|
|
|
|
23
|
|
|
|
9
|
|
|
|
|
44
|
|
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# [[[ ARRAY REF ]]] |
|
47
|
|
|
|
|
|
|
# [[[ ARRAY REF ]]] |
|
48
|
|
|
|
|
|
|
# [[[ ARRAY REF ]]] |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# ref to array |
|
51
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
52
|
|
|
|
|
|
|
arrayref; |
|
53
|
9
|
|
|
9
|
|
542
|
use strict; |
|
|
9
|
|
|
|
|
18
|
|
|
|
9
|
|
|
|
|
159
|
|
|
54
|
9
|
|
|
9
|
|
43
|
use warnings; |
|
|
9
|
|
|
|
|
21
|
|
|
|
9
|
|
|
|
|
284
|
|
|
55
|
|
|
|
|
|
|
#use parent -norequire, qw(ref); # NEED REMOVE: properly replaced by line below? |
|
56
|
9
|
|
|
9
|
|
57
|
use parent -norequire, qw(RPerl::DataStructure::Array::Reference); |
|
|
9
|
|
|
|
|
17
|
|
|
|
9
|
|
|
|
|
53
|
|
|
57
|
9
|
|
|
9
|
|
347
|
use Carp; |
|
|
9
|
|
|
|
|
17
|
|
|
|
9
|
|
|
|
|
450
|
|
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# [[[ SWITCH CONTEXT BACK TO PRIMARY PACKAGE FOR EXPORT TO WORK ]]] |
|
60
|
|
|
|
|
|
|
package RPerl::DataStructure::Array::SubTypes; |
|
61
|
9
|
|
|
9
|
|
52
|
use strict; |
|
|
9
|
|
|
|
|
20
|
|
|
|
9
|
|
|
|
|
202
|
|
|
62
|
9
|
|
|
9
|
|
41
|
use warnings; |
|
|
9
|
|
|
|
|
17
|
|
|
|
9
|
|
|
|
|
1690
|
|
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# [[[ TYPE-CHECKING ]]] |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
#our void $arrayref_CHECK = sub { |
|
67
|
|
|
|
|
|
|
sub arrayref_CHECK { |
|
68
|
0
|
|
|
0
|
0
|
0
|
( my $possible_arrayref ) = @_; |
|
69
|
0
|
0
|
|
|
|
0
|
if ( not( defined $possible_arrayref ) ) { |
|
70
|
0
|
|
|
|
|
0
|
croak( |
|
71
|
|
|
|
|
|
|
"\nERROR EAVRV00, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\narrayref value expected but undefined/null value found,\ncroaking" |
|
72
|
|
|
|
|
|
|
); |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# if ( UNIVERSAL::isa( $possible_arrayref, 'ARRAY' ) ) { # DEV NOTE: I believe these 2 lines are equivalent? |
|
76
|
0
|
0
|
|
|
|
0
|
if ( not( main::RPerl_SvAROKp($possible_arrayref) ) ) { |
|
77
|
0
|
|
|
|
|
0
|
croak( |
|
78
|
|
|
|
|
|
|
"\nERROR EAVRV01, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\narrayref value expected but non-arrayref value found,\ncroaking" |
|
79
|
|
|
|
|
|
|
); |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
#our void $arrayref_CHECKTRACE = sub { |
|
85
|
|
|
|
|
|
|
sub arrayref_CHECKTRACE { |
|
86
|
0
|
|
|
0
|
0
|
0
|
( my $possible_arrayref, my $variable_name, my $subroutine_name ) = @_; |
|
87
|
0
|
0
|
|
|
|
0
|
if ( not( defined $possible_arrayref ) ) { |
|
88
|
0
|
|
|
|
|
0
|
croak( |
|
89
|
|
|
|
|
|
|
"\nERROR EAVRV00, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\narrayref value expected but undefined/null value found,\nin variable $variable_name from subroutine $subroutine_name,\ncroaking" |
|
90
|
|
|
|
|
|
|
); |
|
91
|
|
|
|
|
|
|
} |
|
92
|
0
|
0
|
|
|
|
0
|
if ( not( main::RPerl_SvAROKp($possible_arrayref) ) ) { |
|
93
|
0
|
|
|
|
|
0
|
croak( |
|
94
|
|
|
|
|
|
|
"\nERROR EAVRV01, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\narrayref value expected but non-arrayref value found,\nin variable $variable_name from subroutine $subroutine_name,\ncroaking" |
|
95
|
|
|
|
|
|
|
); |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
# [[[ INTEGER ARRAY REF ]]] |
|
100
|
|
|
|
|
|
|
# [[[ INTEGER ARRAY REF ]]] |
|
101
|
|
|
|
|
|
|
# [[[ INTEGER ARRAY REF ]]] |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
# (ref to array) of integers |
|
104
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
105
|
|
|
|
|
|
|
integer_arrayref; |
|
106
|
9
|
|
|
9
|
|
63
|
use strict; |
|
|
9
|
|
|
|
|
20
|
|
|
|
9
|
|
|
|
|
160
|
|
|
107
|
9
|
|
|
9
|
|
46
|
use warnings; |
|
|
9
|
|
|
|
|
18
|
|
|
|
9
|
|
|
|
|
264
|
|
|
108
|
9
|
|
|
9
|
|
48
|
use parent -norequire, qw(arrayref); |
|
|
9
|
|
|
|
|
20
|
|
|
|
9
|
|
|
|
|
45
|
|
|
109
|
9
|
|
|
9
|
|
390
|
use Carp; |
|
|
9
|
|
|
|
|
18
|
|
|
|
9
|
|
|
|
|
565
|
|
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
# [[[ SWITCH CONTEXT BACK TO PRIMARY PACKAGE FOR EXPORT TO WORK ]]] |
|
112
|
|
|
|
|
|
|
package RPerl::DataStructure::Array::SubTypes; |
|
113
|
9
|
|
|
9
|
|
54
|
use strict; |
|
|
9
|
|
|
|
|
19
|
|
|
|
9
|
|
|
|
|
174
|
|
|
114
|
9
|
|
|
9
|
|
40
|
use warnings; |
|
|
9
|
|
|
|
|
18
|
|
|
|
9
|
|
|
|
|
5500
|
|
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
# [[[ TYPE-CHECKING ]]] |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
#our void $integer_arrayref_CHECK = sub { |
|
119
|
|
|
|
|
|
|
sub integer_arrayref_CHECK { |
|
120
|
0
|
|
|
0
|
0
|
0
|
( my $possible_integer_arrayref ) = @_; |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
# DEV NOTE: the following two if() statements are functionally equivalent to the arrayref_CHECK() subroutine, but with integer-specific error codes |
|
123
|
0
|
0
|
|
|
|
0
|
if ( not( defined $possible_integer_arrayref ) ) { |
|
124
|
0
|
|
|
|
|
0
|
croak( |
|
125
|
|
|
|
|
|
|
"\nERROR EIVAVRV00, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\ninteger_arrayref value expected but undefined/null value found,\ncroaking" |
|
126
|
|
|
|
|
|
|
); |
|
127
|
|
|
|
|
|
|
} |
|
128
|
|
|
|
|
|
|
|
|
129
|
0
|
0
|
|
|
|
0
|
if ( not( main::RPerl_SvAROKp($possible_integer_arrayref) ) ) { |
|
130
|
0
|
|
|
|
|
0
|
croak( |
|
131
|
|
|
|
|
|
|
"\nERROR EIVAVRV01, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\ninteger_arrayref value expected but non-arrayref value found,\ncroaking" |
|
132
|
|
|
|
|
|
|
); |
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
|
|
135
|
0
|
|
|
|
|
0
|
my integer $possible_integer; |
|
136
|
0
|
|
|
|
|
0
|
for my integer $i ( |
|
137
|
0
|
|
|
|
|
0
|
0 .. ( ( scalar @{$possible_integer_arrayref} ) - 1 ) ) |
|
138
|
|
|
|
|
|
|
{ |
|
139
|
0
|
|
|
|
|
0
|
$possible_integer = $possible_integer_arrayref->[$i]; |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
# DEV NOTE: the following two if() statements are functionally equivalent to the integer_CHECK() subroutine, but with array-specific error codes |
|
142
|
0
|
0
|
|
|
|
0
|
if ( not( defined $possible_integer ) ) { |
|
143
|
0
|
|
|
|
|
0
|
croak( |
|
144
|
|
|
|
|
|
|
"\nERROR EIVAVRV02, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\ninteger_arrayref element value expected but undefined/null value found at index $i,\ncroaking" |
|
145
|
|
|
|
|
|
|
); |
|
146
|
|
|
|
|
|
|
} |
|
147
|
0
|
0
|
|
|
|
0
|
if ( not( main::RPerl_SvIOKp($possible_integer) ) ) { |
|
148
|
0
|
|
|
|
|
0
|
croak( |
|
149
|
|
|
|
|
|
|
"\nERROR EIVAVRV03, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\ninteger_arrayref element value expected but non-integer value found at index $i,\ncroaking" |
|
150
|
|
|
|
|
|
|
); |
|
151
|
|
|
|
|
|
|
} |
|
152
|
|
|
|
|
|
|
} |
|
153
|
|
|
|
|
|
|
}; |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
#our void $integer_arrayref_CHECKTRACE = sub { |
|
157
|
|
|
|
|
|
|
sub integer_arrayref_CHECKTRACE { |
|
158
|
44
|
|
|
44
|
0
|
93
|
( my $possible_integer_arrayref, my $variable_name, my $subroutine_name ) |
|
159
|
|
|
|
|
|
|
= @_; |
|
160
|
44
|
100
|
|
|
|
114
|
if ( not( defined $possible_integer_arrayref ) ) { |
|
161
|
6
|
|
|
|
|
87
|
croak( |
|
162
|
|
|
|
|
|
|
"\nERROR EIVAVRV00, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\ninteger_arrayref value expected but undefined/null value found,\nin variable $variable_name from subroutine $subroutine_name,\ncroaking" |
|
163
|
|
|
|
|
|
|
); |
|
164
|
|
|
|
|
|
|
} |
|
165
|
38
|
100
|
|
|
|
144
|
if ( not( main::RPerl_SvAROKp($possible_integer_arrayref) ) ) { |
|
166
|
10
|
|
|
|
|
117
|
croak( |
|
167
|
|
|
|
|
|
|
"\nERROR EIVAVRV01, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\ninteger_arrayref value expected but non-arrayref value found,\nin variable $variable_name from subroutine $subroutine_name,\ncroaking" |
|
168
|
|
|
|
|
|
|
); |
|
169
|
|
|
|
|
|
|
} |
|
170
|
|
|
|
|
|
|
|
|
171
|
28
|
|
|
|
|
47
|
my integer $possible_integer; |
|
172
|
28
|
|
|
|
|
44
|
for my integer $i ( |
|
173
|
28
|
|
|
|
|
83
|
0 .. ( ( scalar @{$possible_integer_arrayref} ) - 1 ) ) |
|
174
|
|
|
|
|
|
|
{ |
|
175
|
144
|
|
|
|
|
212
|
$possible_integer = $possible_integer_arrayref->[$i]; |
|
176
|
144
|
100
|
|
|
|
286
|
if ( not( defined $possible_integer ) ) { |
|
177
|
4
|
|
|
|
|
58
|
croak( |
|
178
|
|
|
|
|
|
|
"\nERROR EIVAVRV02, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\ninteger_arrayref element value expected but undefined/null value found at index $i,\nin variable $variable_name from subroutine $subroutine_name,\ncroaking" |
|
179
|
|
|
|
|
|
|
); |
|
180
|
|
|
|
|
|
|
} |
|
181
|
140
|
100
|
|
|
|
349
|
if ( not( main::RPerl_SvIOKp($possible_integer) ) ) { |
|
182
|
10
|
|
|
|
|
119
|
croak( |
|
183
|
|
|
|
|
|
|
"\nERROR EIVAVRV03, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\ninteger_arrayref element value expected but non-integer value found at index $i,\nin variable $variable_name from subroutine $subroutine_name,\ncroaking" |
|
184
|
|
|
|
|
|
|
); |
|
185
|
|
|
|
|
|
|
} |
|
186
|
|
|
|
|
|
|
} |
|
187
|
|
|
|
|
|
|
} |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
# [[[ STRINGIFY ]]] |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
# convert from (Perl SV containing RV to (Perl AV of (Perl SVs containing IVs))) to Perl-parsable (Perl SV containing PV) |
|
192
|
|
|
|
|
|
|
# stringify an integer_arrayref |
|
193
|
|
|
|
|
|
|
our string $integer_arrayref_to_string = sub { |
|
194
|
|
|
|
|
|
|
# require exactly one integer_arrayref as input, store in variable $input_avref |
|
195
|
|
|
|
|
|
|
( my integer_arrayref $input_avref ) = @_; |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
# RPerl::diag("in PERLOPS_PERLTYPES integer_arrayref_to_string(), top of subroutine\n"); |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
# integer_arrayref_CHECK($input_avref); |
|
200
|
|
|
|
|
|
|
integer_arrayref_CHECKTRACE( $input_avref, '$input_avref', 'integer_arrayref_to_string()' ); |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
# declare local variables, av & sv mean "array value" & "scalar value" as used in Perl core |
|
203
|
|
|
|
|
|
|
# my @input_av; # DEV NOTE: match CPPOPS_*TYPES code |
|
204
|
|
|
|
|
|
|
my integer $input_av_length; |
|
205
|
|
|
|
|
|
|
my integer $input_av_element; |
|
206
|
|
|
|
|
|
|
my string $output_sv; |
|
207
|
|
|
|
|
|
|
my boolean $i_is_0 = 1; |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
# compute length of (number of elements in) input array |
|
210
|
|
|
|
|
|
|
# @input_av = @{$input_avref}; # DEV NOTE: match CPPOPS_*TYPES code |
|
211
|
|
|
|
|
|
|
# $input_av_length = scalar @input_av; # DEV NOTE: match CPPOPS_*TYPES code |
|
212
|
|
|
|
|
|
|
$input_av_length = scalar @{$input_avref}; |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
# RPerl::diag("in PERLOPS_PERLTYPES integer_arrayref_to_string(), have \$input_av_length = $input_av_length\n"); |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
# begin output string with left-square-bracket, as required for all RPerl arrays |
|
217
|
|
|
|
|
|
|
$output_sv = '['; |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
# loop through all valid values of $i for use as index to input array |
|
220
|
|
|
|
|
|
|
for my integer $i ( 0 .. ( $input_av_length - 1 ) ) { |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
# retrieve input array's element at index $i |
|
223
|
|
|
|
|
|
|
# $input_av_element = $input_av[$i]; # DEV NOTE: match CPPOPS_*TYPES code |
|
224
|
|
|
|
|
|
|
$input_av_element = $input_avref->[$i]; |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
# DEV NOTE: integer type-checking already done as part of integer_arrayref_CHECKTRACE() |
|
227
|
|
|
|
|
|
|
# integer_CHECK($input_av_element); |
|
228
|
|
|
|
|
|
|
#integer_CHECKTRACE( $input_av_element, "\$input_av_element at index $i", 'integer_arrayref_to_string()' ); |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
# append comma & space to output string for all elements except index 0 |
|
231
|
|
|
|
|
|
|
if ($i_is_0) { $i_is_0 = 0; } |
|
232
|
|
|
|
|
|
|
else { $output_sv .= ', '; } |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
# stringify individual integer element, append to output string |
|
235
|
|
|
|
|
|
|
$output_sv .= ::integer_to_string($input_av_element); |
|
236
|
|
|
|
|
|
|
} |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
# end output string with right-square-bracket, as required for all RPerl arrays |
|
239
|
|
|
|
|
|
|
$output_sv .= ']'; |
|
240
|
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
# RPerl::diag("in PERLOPS_PERLTYPES integer_arrayref_to_string(), after for() loop, have \$output_sv =\n$output_sv\n"); |
|
242
|
|
|
|
|
|
|
# RPerl::diag("in PERLOPS_PERLTYPES integer_arrayref_to_string(), bottom of subroutine\n"); |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
# return output string, containing stringified input array |
|
245
|
|
|
|
|
|
|
return $output_sv; |
|
246
|
|
|
|
|
|
|
}; |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
# [[[ TYPE TESTING ]]] |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
our string $integer_arrayref__typetest0 = sub { |
|
251
|
|
|
|
|
|
|
( my integer_arrayref $lucky_integers) = @_; |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
# integer_arrayref_CHECK($lucky_integers); |
|
254
|
|
|
|
|
|
|
integer_arrayref_CHECKTRACE( $lucky_integers, '$lucky_integers', |
|
255
|
|
|
|
|
|
|
'integer_arrayref__typetest0()' ); |
|
256
|
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
# my integer $how_lucky = scalar @{$lucky_integers}; |
|
258
|
|
|
|
|
|
|
# for my integer $i ( 0 .. ( $how_lucky - 1 ) ) { |
|
259
|
|
|
|
|
|
|
# my $lucky_integer = $lucky_integers->[$i]; |
|
260
|
|
|
|
|
|
|
# RPerl::diag("in PERLOPS_PERLTYPES integer_arrayref__typetest0(), have lucky integer $i/" . ( $how_lucky - 1 ) . ' = ' . $lucky_integers->[$i] . ", BARBAT\n"); |
|
261
|
|
|
|
|
|
|
# } |
|
262
|
|
|
|
|
|
|
# RPerl::diag("in PERLOPS_PERLTYPES integer_arrayref__typetest0(), bottom of subroutine\n"); |
|
263
|
|
|
|
|
|
|
return ( |
|
264
|
|
|
|
|
|
|
integer_arrayref_to_string($lucky_integers) . 'PERLOPS_PERLTYPES' ); |
|
265
|
|
|
|
|
|
|
}; |
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
our integer_arrayref $integer_arrayref__typetest1 = sub { |
|
268
|
|
|
|
|
|
|
( my integer $my_size) = @_; |
|
269
|
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
# integer_CHECK($my_size); |
|
271
|
|
|
|
|
|
|
integer_CHECKTRACE( $my_size, '$my_size', |
|
272
|
|
|
|
|
|
|
'integer_arrayref__typetest1()' ); |
|
273
|
|
|
|
|
|
|
my integer_arrayref $new_array = []; |
|
274
|
|
|
|
|
|
|
for my integer $i ( 0 .. ( $my_size - 1 ) ) { |
|
275
|
|
|
|
|
|
|
$new_array->[$i] = $i * 5; |
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
# RPerl::diag("in PERLOPS_PERLTYPES integer_arrayref__typetest1(), setting element $i/" . ( $my_size - 1 ) . ' = ' . $new_array->[$i] . ", BARBAT\n"); |
|
278
|
|
|
|
|
|
|
} |
|
279
|
|
|
|
|
|
|
return ($new_array); |
|
280
|
|
|
|
|
|
|
}; |
|
281
|
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
# [[[ NUMBER ARRAY REF ]]] |
|
283
|
|
|
|
|
|
|
# [[[ NUMBER ARRAY REF ]]] |
|
284
|
|
|
|
|
|
|
# [[[ NUMBER ARRAY REF ]]] |
|
285
|
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
# (ref to array) of numbers |
|
287
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
288
|
|
|
|
|
|
|
number_arrayref; |
|
289
|
9
|
|
|
9
|
|
63
|
use strict; |
|
|
9
|
|
|
|
|
21
|
|
|
|
9
|
|
|
|
|
182
|
|
|
290
|
9
|
|
|
9
|
|
60
|
use warnings; |
|
|
9
|
|
|
|
|
24
|
|
|
|
9
|
|
|
|
|
275
|
|
|
291
|
9
|
|
|
9
|
|
50
|
use parent -norequire, qw(arrayref); |
|
|
9
|
|
|
|
|
19
|
|
|
|
9
|
|
|
|
|
57
|
|
|
292
|
9
|
|
|
9
|
|
349
|
use Carp; |
|
|
9
|
|
|
|
|
17
|
|
|
|
9
|
|
|
|
|
405
|
|
|
293
|
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
# [[[ SWITCH CONTEXT BACK TO PRIMARY PACKAGE FOR EXPORT TO WORK ]]] |
|
295
|
|
|
|
|
|
|
package RPerl::DataStructure::Array::SubTypes; |
|
296
|
9
|
|
|
9
|
|
51
|
use strict; |
|
|
9
|
|
|
|
|
20
|
|
|
|
9
|
|
|
|
|
159
|
|
|
297
|
9
|
|
|
9
|
|
37
|
use warnings; |
|
|
9
|
|
|
|
|
21
|
|
|
|
9
|
|
|
|
|
5351
|
|
|
298
|
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
# [[[ TYPE-CHECKING ]]] |
|
300
|
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
#our void $number_arrayref_CHECK = sub { |
|
302
|
|
|
|
|
|
|
sub number_arrayref_CHECK { |
|
303
|
0
|
|
|
0
|
0
|
0
|
( my $possible_number_arrayref ) = @_; |
|
304
|
0
|
0
|
|
|
|
0
|
if ( not( defined $possible_number_arrayref ) ) { |
|
305
|
0
|
|
|
|
|
0
|
croak( |
|
306
|
|
|
|
|
|
|
"\nERROR ENVAVRV00, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\nnumber_arrayref value expected but undefined/null value found,\ncroaking" |
|
307
|
|
|
|
|
|
|
); |
|
308
|
|
|
|
|
|
|
} |
|
309
|
|
|
|
|
|
|
|
|
310
|
0
|
0
|
|
|
|
0
|
if ( not( main::RPerl_SvAROKp($possible_number_arrayref) ) ) { |
|
311
|
0
|
|
|
|
|
0
|
croak( |
|
312
|
|
|
|
|
|
|
"\nERROR ENVAVRV01, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\nnumber_arrayref value expected but non-arrayref value found,\ncroaking" |
|
313
|
|
|
|
|
|
|
); |
|
314
|
|
|
|
|
|
|
} |
|
315
|
|
|
|
|
|
|
|
|
316
|
0
|
|
|
|
|
0
|
my number $possible_number; |
|
317
|
0
|
|
|
|
|
0
|
for my integer $i ( 0 .. ( ( scalar @{$possible_number_arrayref} ) - 1 ) ) |
|
|
0
|
|
|
|
|
0
|
|
|
318
|
|
|
|
|
|
|
{ |
|
319
|
0
|
|
|
|
|
0
|
$possible_number = $possible_number_arrayref->[$i]; |
|
320
|
0
|
0
|
|
|
|
0
|
if ( not( defined $possible_number ) ) { |
|
321
|
0
|
|
|
|
|
0
|
croak( |
|
322
|
|
|
|
|
|
|
"\nERROR ENVAVRV02, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\nnumber_arrayref element value expected but undefined/null value found at index $i,\ncroaking" |
|
323
|
|
|
|
|
|
|
); |
|
324
|
|
|
|
|
|
|
} |
|
325
|
0
|
0
|
0
|
|
|
0
|
if (not( main::RPerl_SvNOKp($possible_number) |
|
326
|
|
|
|
|
|
|
|| main::RPerl_SvIOKp($possible_number) ) |
|
327
|
|
|
|
|
|
|
) |
|
328
|
|
|
|
|
|
|
{ |
|
329
|
0
|
|
|
|
|
0
|
croak( |
|
330
|
|
|
|
|
|
|
"\nERROR ENVAVRV03, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\nnumber_arrayref element value expected but non-number value found at index $i,\ncroaking" |
|
331
|
|
|
|
|
|
|
); |
|
332
|
|
|
|
|
|
|
} |
|
333
|
|
|
|
|
|
|
} |
|
334
|
|
|
|
|
|
|
} |
|
335
|
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
#our void $number_arrayref_CHECKTRACE = sub { |
|
338
|
|
|
|
|
|
|
sub number_arrayref_CHECKTRACE { |
|
339
|
48
|
|
|
48
|
0
|
109
|
( my $possible_number_arrayref, my $variable_name, my $subroutine_name ) |
|
340
|
|
|
|
|
|
|
= @_; |
|
341
|
48
|
100
|
|
|
|
129
|
if ( not( defined $possible_number_arrayref ) ) { |
|
342
|
6
|
|
|
|
|
89
|
croak( |
|
343
|
|
|
|
|
|
|
"\nERROR ENVAVRV00, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\nnumber_arrayref value expected but undefined/null value found,\nin variable $variable_name from subroutine $subroutine_name,\ncroaking" |
|
344
|
|
|
|
|
|
|
); |
|
345
|
|
|
|
|
|
|
} |
|
346
|
42
|
100
|
|
|
|
142
|
if ( not( main::RPerl_SvAROKp($possible_number_arrayref) ) ) { |
|
347
|
10
|
|
|
|
|
114
|
croak( |
|
348
|
|
|
|
|
|
|
"\nERROR ENVAVRV01, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\nnumber_arrayref value expected but non-arrayref value found,\nin variable $variable_name from subroutine $subroutine_name,\ncroaking" |
|
349
|
|
|
|
|
|
|
); |
|
350
|
|
|
|
|
|
|
} |
|
351
|
|
|
|
|
|
|
|
|
352
|
32
|
|
|
|
|
57
|
my number $possible_number; |
|
353
|
32
|
|
|
|
|
53
|
for my integer $i ( 0 .. ( ( scalar @{$possible_number_arrayref} ) - 1 ) ) |
|
|
32
|
|
|
|
|
90
|
|
|
354
|
|
|
|
|
|
|
{ |
|
355
|
166
|
|
|
|
|
267
|
$possible_number = $possible_number_arrayref->[$i]; |
|
356
|
166
|
100
|
|
|
|
335
|
if ( not( defined $possible_number ) ) { |
|
357
|
4
|
|
|
|
|
59
|
croak( |
|
358
|
|
|
|
|
|
|
"\nERROR ENVAVRV02, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\nnumber_arrayref element value expected but undefined/null value found at index $i,\nin variable $variable_name from subroutine $subroutine_name,\ncroaking" |
|
359
|
|
|
|
|
|
|
); |
|
360
|
|
|
|
|
|
|
} |
|
361
|
162
|
100
|
100
|
|
|
615
|
if (not( main::RPerl_SvNOKp($possible_number) |
|
362
|
|
|
|
|
|
|
|| main::RPerl_SvIOKp($possible_number) ) |
|
363
|
|
|
|
|
|
|
) |
|
364
|
|
|
|
|
|
|
{ |
|
365
|
8
|
|
|
|
|
113
|
croak( |
|
366
|
|
|
|
|
|
|
"\nERROR ENVAVRV03, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\nnumber_arrayref element value expected but non-number value found at index $i,\nin variable $variable_name from subroutine $subroutine_name,\ncroaking" |
|
367
|
|
|
|
|
|
|
); |
|
368
|
|
|
|
|
|
|
} |
|
369
|
|
|
|
|
|
|
} |
|
370
|
|
|
|
|
|
|
} |
|
371
|
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
# [[[ STRINGIFY ]]] |
|
373
|
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
# convert from (Perl SV containing RV to (Perl AV of (Perl SVs containing NVs))) to Perl-parsable (Perl SV containing PV) |
|
375
|
|
|
|
|
|
|
our string $number_arrayref_to_string = sub { |
|
376
|
|
|
|
|
|
|
( my $input_avref ) = @_; |
|
377
|
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
# RPerl::diag("in PERLOPS_PERLTYPES number_arrayref_to_string(), top of subroutine\n"); |
|
379
|
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
# number_arrayref_CHECK($input_avref); |
|
381
|
|
|
|
|
|
|
number_arrayref_CHECKTRACE( $input_avref, '$input_avref', |
|
382
|
|
|
|
|
|
|
'number_arrayref_to_string()' ); |
|
383
|
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
my @input_av; |
|
385
|
|
|
|
|
|
|
my integer $input_av_length; |
|
386
|
|
|
|
|
|
|
my number $input_av_element; |
|
387
|
|
|
|
|
|
|
my string $output_sv; |
|
388
|
|
|
|
|
|
|
my integer $i_is_0 = 1; # NEED UPGRADE: should be boolean type, not integer |
|
389
|
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
@input_av = @{$input_avref}; |
|
391
|
|
|
|
|
|
|
$input_av_length = scalar @input_av; |
|
392
|
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
# RPerl::diag("in PERLOPS_PERLTYPES number_arrayref_to_string(), have \$input_av_length = $input_av_length\n"); |
|
394
|
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
$output_sv = '['; |
|
396
|
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
for my integer $i ( 0 .. ( $input_av_length - 1 ) ) { |
|
398
|
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
$input_av_element = $input_av[$i]; |
|
400
|
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
if ($i_is_0) { $i_is_0 = 0; } |
|
402
|
|
|
|
|
|
|
else { $output_sv .= ', '; } |
|
403
|
|
|
|
|
|
|
$output_sv .= RPerl::DataType::Number::number_to_string($input_av_element); |
|
404
|
|
|
|
|
|
|
} |
|
405
|
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
$output_sv .= ']'; |
|
407
|
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
# RPerl::diag("in PERLOPS_PERLTYPES number_arrayref_to_string(), after for() loop, have \$output_sv =\n$output_sv\n"); |
|
409
|
|
|
|
|
|
|
# RPerl::diag("in PERLOPS_PERLTYPES number_arrayref_to_string(), bottom of subroutine\n"); |
|
410
|
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
return ($output_sv); |
|
412
|
|
|
|
|
|
|
}; |
|
413
|
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
# [[[ TYPE TESTING ]]] |
|
415
|
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
our string $number_arrayref__typetest0 = sub { |
|
417
|
|
|
|
|
|
|
( my number_arrayref $lucky_numbers) = @_; |
|
418
|
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
# number_arrayref_CHECK($lucky_numbers); |
|
420
|
|
|
|
|
|
|
number_arrayref_CHECKTRACE( $lucky_numbers, '$lucky_numbers', |
|
421
|
|
|
|
|
|
|
'number_arrayref__typetest0()' ); |
|
422
|
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
# my integer $how_lucky = scalar @{$lucky_numbers}; |
|
424
|
|
|
|
|
|
|
# for my integer $i ( 0 .. ( $how_lucky - 1 ) ) { |
|
425
|
|
|
|
|
|
|
# my $lucky_number = $lucky_numbers->[$i]; |
|
426
|
|
|
|
|
|
|
# RPerl::diag("in PERLOPS_PERLTYPES number_arrayref__typetest0(), have lucky number $i/" . ( $how_lucky - 1 ) . ' = ' . $lucky_numbers->[$i] . ", BARBAZ\n"); |
|
427
|
|
|
|
|
|
|
# } |
|
428
|
|
|
|
|
|
|
# RPerl::diag("in PERLOPS_PERLTYPES number_arrayref__typetest0(), bottom of subroutine\n"); |
|
429
|
|
|
|
|
|
|
return ( |
|
430
|
|
|
|
|
|
|
number_arrayref_to_string($lucky_numbers) . 'PERLOPS_PERLTYPES' ); |
|
431
|
|
|
|
|
|
|
}; |
|
432
|
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
our number_arrayref $number_arrayref__typetest1 = sub { |
|
434
|
|
|
|
|
|
|
( my integer $my_size) = @_; |
|
435
|
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
# integer_CHECK($my_size); |
|
437
|
|
|
|
|
|
|
integer_CHECKTRACE( $my_size, '$my_size', |
|
438
|
|
|
|
|
|
|
'number_arrayref__typetest1()' ); |
|
439
|
|
|
|
|
|
|
my number_arrayref $new_array = []; |
|
440
|
|
|
|
|
|
|
for my integer $i ( 0 .. ( $my_size - 1 ) ) { |
|
441
|
|
|
|
|
|
|
$new_array->[$i] = $i * 5.123456789; |
|
442
|
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
# RPerl::diag("in PERLOPS_PERLTYPES number_arrayref__typetest1(), setting element $i/" . ( $my_size - 1 ) . ' = ' . $new_array->[$i] . ", BARBAZ\n"); |
|
444
|
|
|
|
|
|
|
} |
|
445
|
|
|
|
|
|
|
return ($new_array); |
|
446
|
|
|
|
|
|
|
}; |
|
447
|
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
# [[[ CHARACTER ARRAY REF ]]] |
|
449
|
|
|
|
|
|
|
# [[[ CHARACTER ARRAY REF ]]] |
|
450
|
|
|
|
|
|
|
# [[[ CHARACTER ARRAY REF ]]] |
|
451
|
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
# (ref to array) of chars |
|
453
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
454
|
|
|
|
|
|
|
character_arrayref; |
|
455
|
9
|
|
|
9
|
|
77
|
use strict; |
|
|
9
|
|
|
|
|
22
|
|
|
|
9
|
|
|
|
|
199
|
|
|
456
|
9
|
|
|
9
|
|
58
|
use warnings; |
|
|
9
|
|
|
|
|
24
|
|
|
|
9
|
|
|
|
|
288
|
|
|
457
|
9
|
|
|
9
|
|
60
|
use parent -norequire, qw(arrayref); |
|
|
9
|
|
|
|
|
20
|
|
|
|
9
|
|
|
|
|
50
|
|
|
458
|
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
# [[[ STRING ARRAY REF ]]] |
|
460
|
|
|
|
|
|
|
# [[[ STRING ARRAY REF ]]] |
|
461
|
|
|
|
|
|
|
# [[[ STRING ARRAY REF ]]] |
|
462
|
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
# (ref to array) of strings |
|
464
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
465
|
|
|
|
|
|
|
string_arrayref; |
|
466
|
9
|
|
|
9
|
|
497
|
use strict; |
|
|
9
|
|
|
|
|
21
|
|
|
|
9
|
|
|
|
|
179
|
|
|
467
|
9
|
|
|
9
|
|
46
|
use warnings; |
|
|
9
|
|
|
|
|
19
|
|
|
|
9
|
|
|
|
|
235
|
|
|
468
|
9
|
|
|
9
|
|
43
|
use parent -norequire, qw(arrayref); |
|
|
9
|
|
|
|
|
17
|
|
|
|
9
|
|
|
|
|
48
|
|
|
469
|
9
|
|
|
9
|
|
318
|
use Carp; |
|
|
9
|
|
|
|
|
19
|
|
|
|
9
|
|
|
|
|
451
|
|
|
470
|
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
# [[[ SWITCH CONTEXT BACK TO PRIMARY PACKAGE FOR EXPORT TO WORK ]]] |
|
472
|
|
|
|
|
|
|
package RPerl::DataStructure::Array::SubTypes; |
|
473
|
9
|
|
|
9
|
|
52
|
use strict; |
|
|
9
|
|
|
|
|
17
|
|
|
|
9
|
|
|
|
|
181
|
|
|
474
|
9
|
|
|
9
|
|
41
|
use warnings; |
|
|
9
|
|
|
|
|
18
|
|
|
|
9
|
|
|
|
|
5686
|
|
|
475
|
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
# [[[ TYPE-CHECKING ]]] |
|
477
|
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
#our void $string_arrayref_CHECK = sub { |
|
479
|
|
|
|
|
|
|
sub string_arrayref_CHECK { |
|
480
|
0
|
|
|
0
|
0
|
0
|
( my $possible_string_arrayref ) = @_; |
|
481
|
0
|
0
|
|
|
|
0
|
if ( not( defined $possible_string_arrayref ) ) { |
|
482
|
0
|
|
|
|
|
0
|
croak( |
|
483
|
|
|
|
|
|
|
"\nERROR EPVAVRV00, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\nstring_arrayref value expected but undefined/null value found,\ncroaking" |
|
484
|
|
|
|
|
|
|
); |
|
485
|
|
|
|
|
|
|
} |
|
486
|
|
|
|
|
|
|
|
|
487
|
0
|
0
|
|
|
|
0
|
if ( not( main::RPerl_SvAROKp($possible_string_arrayref) ) ) { |
|
488
|
0
|
|
|
|
|
0
|
croak( |
|
489
|
|
|
|
|
|
|
"\nERROR EPVAVRV01, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\nstring_arrayref value expected but non-arrayref value found,\ncroaking" |
|
490
|
|
|
|
|
|
|
); |
|
491
|
|
|
|
|
|
|
} |
|
492
|
|
|
|
|
|
|
|
|
493
|
0
|
|
|
|
|
0
|
my string $possible_string; |
|
494
|
0
|
|
|
|
|
0
|
for my integer $i ( 0 .. ( ( scalar @{$possible_string_arrayref} ) - 1 ) ) |
|
|
0
|
|
|
|
|
0
|
|
|
495
|
|
|
|
|
|
|
{ |
|
496
|
0
|
|
|
|
|
0
|
$possible_string = $possible_string_arrayref->[$i]; |
|
497
|
0
|
0
|
|
|
|
0
|
if ( not( defined $possible_string ) ) { |
|
498
|
0
|
|
|
|
|
0
|
croak( |
|
499
|
|
|
|
|
|
|
"\nERROR EPVAVRV02, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\nstring_arrayref element value expected but undefined/null value found at index $i,\ncroaking" |
|
500
|
|
|
|
|
|
|
); |
|
501
|
|
|
|
|
|
|
} |
|
502
|
0
|
0
|
|
|
|
0
|
if ( not( main::RPerl_SvPOKp($possible_string) ) ) { |
|
503
|
0
|
|
|
|
|
0
|
croak( |
|
504
|
|
|
|
|
|
|
"\nERROR EPVAVRV03, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\nstring_arrayref element value expected but non-string value found at index $i,\ncroaking" |
|
505
|
|
|
|
|
|
|
); |
|
506
|
|
|
|
|
|
|
} |
|
507
|
|
|
|
|
|
|
} |
|
508
|
|
|
|
|
|
|
} |
|
509
|
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
#our void $string_arrayref_CHECKTRACE = sub { |
|
512
|
|
|
|
|
|
|
sub string_arrayref_CHECKTRACE { |
|
513
|
23
|
|
|
23
|
0
|
83
|
( my $possible_string_arrayref, my $variable_name, my $subroutine_name ) |
|
514
|
|
|
|
|
|
|
= @_; |
|
515
|
23
|
100
|
|
|
|
90
|
if ( not( defined $possible_string_arrayref ) ) { |
|
516
|
3
|
|
|
|
|
35
|
croak( |
|
517
|
|
|
|
|
|
|
"\nERROR EPVAVRV00, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\nstring_arrayref value expected but undefined/null value found,\nin variable $variable_name from subroutine $subroutine_name,\ncroaking" |
|
518
|
|
|
|
|
|
|
); |
|
519
|
|
|
|
|
|
|
} |
|
520
|
20
|
100
|
|
|
|
68
|
if ( not( main::RPerl_SvAROKp($possible_string_arrayref) ) ) { |
|
521
|
5
|
|
|
|
|
58
|
croak( |
|
522
|
|
|
|
|
|
|
"\nERROR EPVAVRV01, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\nstring_arrayref value expected but non-arrayref value found,\nin variable $variable_name from subroutine $subroutine_name,\ncroaking" |
|
523
|
|
|
|
|
|
|
); |
|
524
|
|
|
|
|
|
|
} |
|
525
|
|
|
|
|
|
|
|
|
526
|
15
|
|
|
|
|
29
|
my string $possible_string; |
|
527
|
15
|
|
|
|
|
24
|
for my integer $i ( 0 .. ( ( scalar @{$possible_string_arrayref} ) - 1 ) ) |
|
|
15
|
|
|
|
|
44
|
|
|
528
|
|
|
|
|
|
|
{ |
|
529
|
65
|
|
|
|
|
103
|
$possible_string = $possible_string_arrayref->[$i]; |
|
530
|
65
|
100
|
|
|
|
133
|
if ( not( defined $possible_string ) ) { |
|
531
|
2
|
|
|
|
|
25
|
croak( |
|
532
|
|
|
|
|
|
|
"\nERROR EPVAVRV02, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\nstring_arrayref element value expected but undefined/null value found at index $i,\nin variable $variable_name from subroutine $subroutine_name,\ncroaking" |
|
533
|
|
|
|
|
|
|
); |
|
534
|
|
|
|
|
|
|
} |
|
535
|
63
|
100
|
|
|
|
162
|
if ( not( main::RPerl_SvPOKp($possible_string) ) ) { |
|
536
|
5
|
|
|
|
|
82
|
croak( |
|
537
|
|
|
|
|
|
|
"\nERROR EPVAVRV03, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\nstring_arrayref element value expected but non-string value found at index $i,\nin variable $variable_name from subroutine $subroutine_name,\ncroaking" |
|
538
|
|
|
|
|
|
|
); |
|
539
|
|
|
|
|
|
|
} |
|
540
|
|
|
|
|
|
|
} |
|
541
|
|
|
|
|
|
|
} |
|
542
|
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
# [[[ STRINGIFY ]]] |
|
544
|
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
# convert from (Perl SV containing RV to (Perl AV of (Perl SVs containing PVs))) to Perl-parsable (Perl SV containing PV) |
|
546
|
|
|
|
|
|
|
our string $string_arrayref_to_string = sub { |
|
547
|
|
|
|
|
|
|
( my $input_avref ) = @_; |
|
548
|
|
|
|
|
|
|
|
|
549
|
|
|
|
|
|
|
# RPerl::diag("in PERLOPS_PERLTYPES string_arrayref_to_string(), top of subroutine\n"); |
|
550
|
|
|
|
|
|
|
|
|
551
|
|
|
|
|
|
|
# string_arrayref_CHECK($input_avref); |
|
552
|
|
|
|
|
|
|
string_arrayref_CHECKTRACE( $input_avref, '$input_avref', |
|
553
|
|
|
|
|
|
|
'string_arrayref_to_string()' ); |
|
554
|
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
my @input_av; |
|
556
|
|
|
|
|
|
|
my integer $input_av_length; |
|
557
|
|
|
|
|
|
|
my string $input_av_element; |
|
558
|
|
|
|
|
|
|
my string $output_sv; |
|
559
|
|
|
|
|
|
|
my integer $i_is_0 = 1; # NEED UPGRADE: should be boolean type, not integer |
|
560
|
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
@input_av = @{$input_avref}; |
|
562
|
|
|
|
|
|
|
$input_av_length = scalar @input_av; |
|
563
|
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
# RPerl::diag("in PERLOPS_PERLTYPES string_arrayref_to_string(), have \$input_av_length = $input_av_length\n"); |
|
565
|
|
|
|
|
|
|
|
|
566
|
|
|
|
|
|
|
$output_sv = '['; |
|
567
|
|
|
|
|
|
|
|
|
568
|
|
|
|
|
|
|
for my integer $i ( 0 .. ( $input_av_length - 1 ) ) { |
|
569
|
|
|
|
|
|
|
|
|
570
|
|
|
|
|
|
|
$input_av_element = $input_av[$i]; |
|
571
|
|
|
|
|
|
|
|
|
572
|
|
|
|
|
|
|
if ($i_is_0) { $i_is_0 = 0; } |
|
573
|
|
|
|
|
|
|
else { $output_sv .= ', '; } |
|
574
|
|
|
|
|
|
|
$input_av_element =~ s/\\/\\\\/gxms; # escape all back-slash \ characters with another back-slash \ character |
|
575
|
|
|
|
|
|
|
$input_av_element =~ s/\'/\\\'/gxms; # escape all single-quote ' characters with a back-slash \ character |
|
576
|
|
|
|
|
|
|
$output_sv .= "'$input_av_element'"; |
|
577
|
|
|
|
|
|
|
} |
|
578
|
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
$output_sv .= ']'; |
|
580
|
|
|
|
|
|
|
|
|
581
|
|
|
|
|
|
|
# RPerl::diag("in PERLOPS_PERLTYPES string_arrayref_to_string(), after for() loop, have \$output_sv =\n$output_sv\n"); |
|
582
|
|
|
|
|
|
|
# RPerl::diag("in PERLOPS_PERLTYPES string_arrayref_to_string(), bottom of subroutine\n"); |
|
583
|
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
return ($output_sv); |
|
585
|
|
|
|
|
|
|
}; |
|
586
|
|
|
|
|
|
|
|
|
587
|
|
|
|
|
|
|
# [[[ TYPE TESTING ]]] |
|
588
|
|
|
|
|
|
|
|
|
589
|
|
|
|
|
|
|
our string $string_arrayref__typetest0 = sub { |
|
590
|
|
|
|
|
|
|
( my string_arrayref $people) = @_; |
|
591
|
|
|
|
|
|
|
|
|
592
|
|
|
|
|
|
|
# string_arrayref_CHECK($people); |
|
593
|
|
|
|
|
|
|
string_arrayref_CHECKTRACE( $people, '$people', |
|
594
|
|
|
|
|
|
|
'string_arrayref__typetest0()' ); |
|
595
|
|
|
|
|
|
|
|
|
596
|
|
|
|
|
|
|
# my integer $how_crowded = scalar @{$people}; |
|
597
|
|
|
|
|
|
|
# for my integer $i ( 0 .. ( $how_crowded - 1 ) ) { |
|
598
|
|
|
|
|
|
|
# my $person = $people->[$i]; |
|
599
|
|
|
|
|
|
|
# RPerl::diag("in PERLOPS_PERLTYPES string_arrayref__typetest0(), have person $i/" . ( $how_crowded - 1 ) . ' = ' . $people->[$i] . ", BARBAR\n"); |
|
600
|
|
|
|
|
|
|
# } |
|
601
|
|
|
|
|
|
|
# RPerl::diag("in PERLOPS_PERLTYPES string_arrayref__typetest0(), bottom of subroutine\n"); |
|
602
|
|
|
|
|
|
|
return ( string_arrayref_to_string($people) . 'PERLOPS_PERLTYPES' ); |
|
603
|
|
|
|
|
|
|
}; |
|
604
|
|
|
|
|
|
|
|
|
605
|
|
|
|
|
|
|
our string_arrayref $string_arrayref__typetest1 = sub { |
|
606
|
|
|
|
|
|
|
( my integer $my_size) = @_; |
|
607
|
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
# integer_CHECK($my_size); |
|
609
|
|
|
|
|
|
|
integer_CHECKTRACE( $my_size, '$my_size', |
|
610
|
|
|
|
|
|
|
'string_arrayref__typetest1()' ); |
|
611
|
|
|
|
|
|
|
my string_arrayref $new_array = []; |
|
612
|
|
|
|
|
|
|
for my integer $i ( 0 .. ( $my_size - 1 ) ) { |
|
613
|
|
|
|
|
|
|
$new_array->[$i] |
|
614
|
|
|
|
|
|
|
= "Jeffy Ten! $i/" . ( $my_size - 1 ) . ' PERLOPS_PERLTYPES'; |
|
615
|
|
|
|
|
|
|
|
|
616
|
|
|
|
|
|
|
# RPerl::diag("in PERLOPS_PERLTYPES string_arrayref__typetest1(), bottom of for() loop, have i = $i, just set another Jeffy, BARBAR\n"); |
|
617
|
|
|
|
|
|
|
} |
|
618
|
|
|
|
|
|
|
return ($new_array); |
|
619
|
|
|
|
|
|
|
}; |
|
620
|
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
=block_comment |
|
622
|
|
|
|
|
|
|
THIS IS AN EXAMPLE BLOCK COMMENT |
|
623
|
|
|
|
|
|
|
it's purpose is to keep from triggering the UselessNoCritic rule, |
|
624
|
|
|
|
|
|
|
so we can keep the no critic sections at the top of the file for reference |
|
625
|
|
|
|
|
|
|
=cut |
|
626
|
|
|
|
|
|
|
|
|
627
|
|
|
|
|
|
|
# [[[ SCALAR ARRAYS ]]] |
|
628
|
|
|
|
|
|
|
|
|
629
|
|
|
|
|
|
|
# (ref to array) of scalartypes |
|
630
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
631
|
|
|
|
|
|
|
scalartype_arrayref; |
|
632
|
9
|
|
|
9
|
|
73
|
use strict; |
|
|
9
|
|
|
|
|
19
|
|
|
|
9
|
|
|
|
|
176
|
|
|
633
|
9
|
|
|
9
|
|
65
|
use warnings; |
|
|
9
|
|
|
|
|
22
|
|
|
|
9
|
|
|
|
|
278
|
|
|
634
|
9
|
|
|
9
|
|
55
|
use parent -norequire, qw(arrayref); |
|
|
9
|
|
|
|
|
22
|
|
|
|
9
|
|
|
|
|
261
|
|
|
635
|
|
|
|
|
|
|
|
|
636
|
|
|
|
|
|
|
# [[[ ARRAY ARRAYS (2-dimensional) ]]] |
|
637
|
|
|
|
|
|
|
|
|
638
|
|
|
|
|
|
|
# (ref to array) of (refs to arrays) |
|
639
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
640
|
|
|
|
|
|
|
arrayref_arrayref; |
|
641
|
9
|
|
|
9
|
|
463
|
use strict; |
|
|
9
|
|
|
|
|
26
|
|
|
|
9
|
|
|
|
|
180
|
|
|
642
|
9
|
|
|
9
|
|
50
|
use warnings; |
|
|
9
|
|
|
|
|
19
|
|
|
|
9
|
|
|
|
|
274
|
|
|
643
|
9
|
|
|
9
|
|
58
|
use parent -norequire, qw(arrayref); |
|
|
9
|
|
|
|
|
19
|
|
|
|
9
|
|
|
|
|
53
|
|
|
644
|
|
|
|
|
|
|
|
|
645
|
|
|
|
|
|
|
# [ HOMOGENEOUS ARRAY ARRAYS (2-dimensional) ] |
|
646
|
|
|
|
|
|
|
|
|
647
|
|
|
|
|
|
|
# method returning (ref to array) of (refs to (arrays of integers)) |
|
648
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
649
|
|
|
|
|
|
|
integer_arrayref_arrayref::method; |
|
650
|
9
|
|
|
9
|
|
413
|
use strict; |
|
|
9
|
|
|
|
|
19
|
|
|
|
9
|
|
|
|
|
176
|
|
|
651
|
9
|
|
|
9
|
|
42
|
use warnings; |
|
|
9
|
|
|
|
|
23
|
|
|
|
9
|
|
|
|
|
251
|
|
|
652
|
9
|
|
|
9
|
|
51
|
use parent -norequire, qw(method); |
|
|
9
|
|
|
|
|
21
|
|
|
|
9
|
|
|
|
|
47
|
|
|
653
|
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
# (ref to array) of (refs to (arrays of integers)) |
|
655
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
656
|
|
|
|
|
|
|
integer_arrayref_arrayref; |
|
657
|
9
|
|
|
9
|
|
364
|
use strict; |
|
|
9
|
|
|
|
|
18
|
|
|
|
9
|
|
|
|
|
162
|
|
|
658
|
9
|
|
|
9
|
|
39
|
use warnings; |
|
|
9
|
|
|
|
|
19
|
|
|
|
9
|
|
|
|
|
334
|
|
|
659
|
9
|
|
|
9
|
|
56
|
use parent -norequire, qw(arrayref_arrayref); |
|
|
9
|
|
|
|
|
22
|
|
|
|
9
|
|
|
|
|
45
|
|
|
660
|
|
|
|
|
|
|
|
|
661
|
|
|
|
|
|
|
# emulate C++ behavior by actually creating arrays (and presumably allocating memory) at initialization time |
|
662
|
|
|
|
|
|
|
our integer_arrayref_arrayref::method $new = sub { |
|
663
|
|
|
|
|
|
|
( my integer $row_count, my integer $column_count ) = @_; # row-major form (RMF) |
|
664
|
|
|
|
|
|
|
my integer_arrayref_arrayref $retval = []; |
|
665
|
|
|
|
|
|
|
for my integer $j (0 .. ($row_count - 1)) { |
|
666
|
|
|
|
|
|
|
my integer_arrayref $retval_row = []; |
|
667
|
|
|
|
|
|
|
for my integer $i (0 .. ($column_count - 1)) { |
|
668
|
|
|
|
|
|
|
$retval_row->[$i] = undef; |
|
669
|
|
|
|
|
|
|
} |
|
670
|
|
|
|
|
|
|
$retval->[$j] = $retval_row; |
|
671
|
|
|
|
|
|
|
} |
|
672
|
|
|
|
|
|
|
return $retval; |
|
673
|
|
|
|
|
|
|
}; |
|
674
|
|
|
|
|
|
|
|
|
675
|
|
|
|
|
|
|
# method returning (ref to array) of (refs to (arrays of numbers)) |
|
676
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
677
|
|
|
|
|
|
|
number_arrayref_arrayref::method; |
|
678
|
9
|
|
|
9
|
|
1319
|
use strict; |
|
|
9
|
|
|
|
|
21
|
|
|
|
9
|
|
|
|
|
177
|
|
|
679
|
9
|
|
|
9
|
|
46
|
use warnings; |
|
|
9
|
|
|
|
|
21
|
|
|
|
9
|
|
|
|
|
299
|
|
|
680
|
9
|
|
|
9
|
|
59
|
use parent -norequire, qw(method); |
|
|
9
|
|
|
|
|
23
|
|
|
|
9
|
|
|
|
|
51
|
|
|
681
|
|
|
|
|
|
|
|
|
682
|
|
|
|
|
|
|
# (ref to array) of (refs to (arrays of numbers)) |
|
683
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
684
|
|
|
|
|
|
|
number_arrayref_arrayref; |
|
685
|
9
|
|
|
9
|
|
414
|
use strict; |
|
|
9
|
|
|
|
|
26
|
|
|
|
9
|
|
|
|
|
214
|
|
|
686
|
9
|
|
|
9
|
|
46
|
use warnings; |
|
|
9
|
|
|
|
|
19
|
|
|
|
9
|
|
|
|
|
268
|
|
|
687
|
9
|
|
|
9
|
|
52
|
use parent -norequire, qw(arrayref_arrayref); |
|
|
9
|
|
|
|
|
19
|
|
|
|
9
|
|
|
|
|
41
|
|
|
688
|
|
|
|
|
|
|
|
|
689
|
|
|
|
|
|
|
# emulate C++ behavior by actually creating arrays (and presumably allocating memory) at initialization time |
|
690
|
|
|
|
|
|
|
our number_arrayref_arrayref::method $new = sub { |
|
691
|
|
|
|
|
|
|
( my integer $row_count, my integer $column_count ) = @_; # row-major form (RMF) |
|
692
|
|
|
|
|
|
|
my number_arrayref_arrayref $retval = []; |
|
693
|
|
|
|
|
|
|
for my integer $j (0 .. ($row_count - 1)) { |
|
694
|
|
|
|
|
|
|
my number_arrayref $retval_row = []; |
|
695
|
|
|
|
|
|
|
for my integer $i (0 .. ($column_count - 1)) { |
|
696
|
|
|
|
|
|
|
$retval_row->[$i] = undef; |
|
697
|
|
|
|
|
|
|
} |
|
698
|
|
|
|
|
|
|
$retval->[$j] = $retval_row; |
|
699
|
|
|
|
|
|
|
} |
|
700
|
|
|
|
|
|
|
return $retval; |
|
701
|
|
|
|
|
|
|
}; |
|
702
|
|
|
|
|
|
|
|
|
703
|
|
|
|
|
|
|
# method returning (ref to array) of (refs to (arrays of strings)) |
|
704
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
705
|
|
|
|
|
|
|
string_arrayref_arrayref::method; |
|
706
|
9
|
|
|
9
|
|
1644
|
use strict; |
|
|
9
|
|
|
|
|
28
|
|
|
|
9
|
|
|
|
|
175
|
|
|
707
|
9
|
|
|
9
|
|
46
|
use warnings; |
|
|
9
|
|
|
|
|
29
|
|
|
|
9
|
|
|
|
|
287
|
|
|
708
|
9
|
|
|
9
|
|
55
|
use parent -norequire, qw(method); |
|
|
9
|
|
|
|
|
18
|
|
|
|
9
|
|
|
|
|
57
|
|
|
709
|
|
|
|
|
|
|
|
|
710
|
|
|
|
|
|
|
# (ref to array) of (refs to (arrays of strings)) |
|
711
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
712
|
|
|
|
|
|
|
string_arrayref_arrayref; |
|
713
|
9
|
|
|
9
|
|
474
|
use strict; |
|
|
9
|
|
|
|
|
23
|
|
|
|
9
|
|
|
|
|
174
|
|
|
714
|
9
|
|
|
9
|
|
46
|
use warnings; |
|
|
9
|
|
|
|
|
23
|
|
|
|
9
|
|
|
|
|
287
|
|
|
715
|
9
|
|
|
9
|
|
53
|
use parent -norequire, qw(arrayref_arrayref); |
|
|
9
|
|
|
|
|
24
|
|
|
|
9
|
|
|
|
|
50
|
|
|
716
|
|
|
|
|
|
|
|
|
717
|
|
|
|
|
|
|
# emulate C++ behavior by actually creating arrays (and presumably allocating memory) at initialization time |
|
718
|
|
|
|
|
|
|
our string_arrayref_arrayref::method $new = sub { |
|
719
|
|
|
|
|
|
|
( my integer $row_count, my integer $column_count ) = @_; # row-major form (RMF) |
|
720
|
|
|
|
|
|
|
my string_arrayref_arrayref $retval = []; |
|
721
|
|
|
|
|
|
|
for my integer $j (0 .. ($row_count - 1)) { |
|
722
|
|
|
|
|
|
|
my string_arrayref $retval_row = []; |
|
723
|
|
|
|
|
|
|
for my integer $i (0 .. ($column_count - 1)) { |
|
724
|
|
|
|
|
|
|
$retval_row->[$i] = undef; |
|
725
|
|
|
|
|
|
|
} |
|
726
|
|
|
|
|
|
|
$retval->[$j] = $retval_row; |
|
727
|
|
|
|
|
|
|
} |
|
728
|
|
|
|
|
|
|
return $retval; |
|
729
|
|
|
|
|
|
|
}; |
|
730
|
|
|
|
|
|
|
|
|
731
|
|
|
|
|
|
|
# method returning (ref to array) of (refs to (arrays of scalartypes)) |
|
732
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
733
|
|
|
|
|
|
|
scalartype_arrayref_arrayref::method; |
|
734
|
9
|
|
|
9
|
|
1598
|
use strict; |
|
|
9
|
|
|
|
|
29
|
|
|
|
9
|
|
|
|
|
204
|
|
|
735
|
9
|
|
|
9
|
|
40
|
use warnings; |
|
|
9
|
|
|
|
|
20
|
|
|
|
9
|
|
|
|
|
283
|
|
|
736
|
9
|
|
|
9
|
|
58
|
use parent -norequire, qw(method); |
|
|
9
|
|
|
|
|
21
|
|
|
|
9
|
|
|
|
|
58
|
|
|
737
|
|
|
|
|
|
|
|
|
738
|
|
|
|
|
|
|
# (ref to array) of (refs to (arrays of scalars)) |
|
739
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
740
|
|
|
|
|
|
|
scalartype_arrayref_arrayref; |
|
741
|
9
|
|
|
9
|
|
450
|
use strict; |
|
|
9
|
|
|
|
|
22
|
|
|
|
9
|
|
|
|
|
184
|
|
|
742
|
9
|
|
|
9
|
|
48
|
use warnings; |
|
|
9
|
|
|
|
|
21
|
|
|
|
9
|
|
|
|
|
271
|
|
|
743
|
9
|
|
|
9
|
|
51
|
use parent -norequire, qw(arrayref_arrayref); |
|
|
9
|
|
|
|
|
21
|
|
|
|
9
|
|
|
|
|
43
|
|
|
744
|
|
|
|
|
|
|
|
|
745
|
|
|
|
|
|
|
# emulate C++ behavior by actually creating arrays (and presumably allocating memory) at initialization time |
|
746
|
|
|
|
|
|
|
our scalartype_arrayref_arrayref::method $new = sub { |
|
747
|
|
|
|
|
|
|
( my integer $row_count, my integer $column_count ) = @_; # row-major form (RMF) |
|
748
|
|
|
|
|
|
|
my scalartype_arrayref_arrayref $retval = []; |
|
749
|
|
|
|
|
|
|
for my integer $j (0 .. ($row_count - 1)) { |
|
750
|
|
|
|
|
|
|
my scalartype_arrayref $retval_row = []; |
|
751
|
|
|
|
|
|
|
for my integer $i (0 .. ($column_count - 1)) { |
|
752
|
|
|
|
|
|
|
$retval_row->[$i] = undef; |
|
753
|
|
|
|
|
|
|
} |
|
754
|
|
|
|
|
|
|
$retval->[$j] = $retval_row; |
|
755
|
|
|
|
|
|
|
} |
|
756
|
|
|
|
|
|
|
return $retval; |
|
757
|
|
|
|
|
|
|
}; |
|
758
|
|
|
|
|
|
|
|
|
759
|
|
|
|
|
|
|
# [[[ ARRAY ARRAY ARRAYS (3-dimensional) ]]] |
|
760
|
|
|
|
|
|
|
|
|
761
|
|
|
|
|
|
|
# (ref to array) of (refs to arrays) of (refs to arrays) |
|
762
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
763
|
|
|
|
|
|
|
arrayref_arrayref_arrayref; |
|
764
|
9
|
|
|
9
|
|
1272
|
use strict; |
|
|
9
|
|
|
|
|
21
|
|
|
|
9
|
|
|
|
|
188
|
|
|
765
|
9
|
|
|
9
|
|
51
|
use warnings; |
|
|
9
|
|
|
|
|
19
|
|
|
|
9
|
|
|
|
|
273
|
|
|
766
|
9
|
|
|
9
|
|
50
|
use parent -norequire, qw(arrayref); |
|
|
9
|
|
|
|
|
21
|
|
|
|
9
|
|
|
|
|
51
|
|
|
767
|
|
|
|
|
|
|
|
|
768
|
|
|
|
|
|
|
# [ HOMOGENEOUS ARRAY ARRAY ARRAYS (3-dimensional) ] |
|
769
|
|
|
|
|
|
|
|
|
770
|
|
|
|
|
|
|
# (ref to array) of (refs to arrays) of (refs to (arrays of integers)) |
|
771
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
772
|
|
|
|
|
|
|
integer_arrayref_arrayref_arrayref; |
|
773
|
9
|
|
|
9
|
|
476
|
use strict; |
|
|
9
|
|
|
|
|
32
|
|
|
|
9
|
|
|
|
|
199
|
|
|
774
|
9
|
|
|
9
|
|
47
|
use warnings; |
|
|
9
|
|
|
|
|
24
|
|
|
|
9
|
|
|
|
|
289
|
|
|
775
|
9
|
|
|
9
|
|
67
|
use parent -norequire, qw(arrayref_arrayref_arrayref); |
|
|
9
|
|
|
|
|
19
|
|
|
|
9
|
|
|
|
|
45
|
|
|
776
|
|
|
|
|
|
|
|
|
777
|
|
|
|
|
|
|
# (ref to array) of (refs to arrays) of (refs to (arrays of numbers)) |
|
778
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
779
|
|
|
|
|
|
|
number_arrayref_arrayref_arrayref; |
|
780
|
9
|
|
|
9
|
|
530
|
use strict; |
|
|
9
|
|
|
|
|
21
|
|
|
|
9
|
|
|
|
|
184
|
|
|
781
|
9
|
|
|
9
|
|
45
|
use warnings; |
|
|
9
|
|
|
|
|
22
|
|
|
|
9
|
|
|
|
|
260
|
|
|
782
|
9
|
|
|
9
|
|
51
|
use parent -norequire, qw(arrayref_arrayref_arrayref); |
|
|
9
|
|
|
|
|
26
|
|
|
|
9
|
|
|
|
|
45
|
|
|
783
|
|
|
|
|
|
|
|
|
784
|
|
|
|
|
|
|
# (ref to array) of (refs to arrays) of (refs to (arrays of strings)) |
|
785
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
786
|
|
|
|
|
|
|
string_arrayref_arrayref_arrayref; |
|
787
|
9
|
|
|
9
|
|
489
|
use strict; |
|
|
9
|
|
|
|
|
21
|
|
|
|
9
|
|
|
|
|
186
|
|
|
788
|
9
|
|
|
9
|
|
45
|
use warnings; |
|
|
9
|
|
|
|
|
25
|
|
|
|
9
|
|
|
|
|
264
|
|
|
789
|
9
|
|
|
9
|
|
73
|
use parent -norequire, qw(arrayref_arrayref_arrayref); |
|
|
9
|
|
|
|
|
23
|
|
|
|
9
|
|
|
|
|
55
|
|
|
790
|
|
|
|
|
|
|
|
|
791
|
|
|
|
|
|
|
# (ref to array) of (refs to arrays) of (refs to (arrays of scalars)) |
|
792
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
793
|
|
|
|
|
|
|
scalartype_arrayref_arrayref_arrayref; |
|
794
|
9
|
|
|
9
|
|
438
|
use strict; |
|
|
9
|
|
|
|
|
23
|
|
|
|
9
|
|
|
|
|
179
|
|
|
795
|
9
|
|
|
9
|
|
46
|
use warnings; |
|
|
9
|
|
|
|
|
17
|
|
|
|
9
|
|
|
|
|
301
|
|
|
796
|
9
|
|
|
9
|
|
51
|
use parent -norequire, qw(arrayref_arrayref_arrayref); |
|
|
9
|
|
|
|
|
19
|
|
|
|
9
|
|
|
|
|
48
|
|
|
797
|
|
|
|
|
|
|
|
|
798
|
|
|
|
|
|
|
# [[[ HASH ARRAYS (2-dimensional) ]]] |
|
799
|
|
|
|
|
|
|
|
|
800
|
|
|
|
|
|
|
# (ref to array) of (refs to hashs) |
|
801
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
802
|
|
|
|
|
|
|
hashref_arrayref; |
|
803
|
9
|
|
|
9
|
|
457
|
use strict; |
|
|
9
|
|
|
|
|
20
|
|
|
|
9
|
|
|
|
|
172
|
|
|
804
|
9
|
|
|
9
|
|
49
|
use warnings; |
|
|
9
|
|
|
|
|
18
|
|
|
|
9
|
|
|
|
|
252
|
|
|
805
|
9
|
|
|
9
|
|
49
|
use parent -norequire, qw(arrayref); |
|
|
9
|
|
|
|
|
20
|
|
|
|
9
|
|
|
|
|
46
|
|
|
806
|
|
|
|
|
|
|
|
|
807
|
|
|
|
|
|
|
# [[[ OBJECT ARRAYS (2-dimensional) ]]] |
|
808
|
|
|
|
|
|
|
|
|
809
|
|
|
|
|
|
|
# (ref to array) of objects |
|
810
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
|
811
|
|
|
|
|
|
|
object_arrayref; |
|
812
|
9
|
|
|
9
|
|
446
|
use strict; |
|
|
9
|
|
|
|
|
23
|
|
|
|
9
|
|
|
|
|
226
|
|
|
813
|
9
|
|
|
9
|
|
67
|
use warnings; |
|
|
9
|
|
|
|
|
22
|
|
|
|
9
|
|
|
|
|
269
|
|
|
814
|
9
|
|
|
9
|
|
48
|
use parent -norequire, qw(arrayref); |
|
|
9
|
|
|
|
|
20
|
|
|
|
9
|
|
|
|
|
46
|
|
|
815
|
|
|
|
|
|
|
|
|
816
|
|
|
|
|
|
|
1; # end of package |