line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# [[[ HEADER ]]] |
2
|
|
|
|
|
|
|
package RPerl::DataType::Character; |
3
|
9
|
|
|
9
|
|
57
|
use strict; |
|
9
|
|
|
|
|
21
|
|
|
9
|
|
|
|
|
225
|
|
4
|
9
|
|
|
9
|
|
43
|
use warnings; |
|
9
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
223
|
|
5
|
9
|
|
|
9
|
|
55
|
use RPerl::AfterSubclass; |
|
9
|
|
|
|
|
29
|
|
|
9
|
|
|
|
|
1207
|
|
6
|
|
|
|
|
|
|
our $VERSION = 0.007_000; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# [[[ OO INHERITANCE ]]] |
9
|
9
|
|
|
9
|
|
65
|
use parent qw(RPerl::DataType::String); |
|
9
|
|
|
|
|
32
|
|
|
9
|
|
|
|
|
54
|
|
10
|
9
|
|
|
9
|
|
366
|
use RPerl::DataType::String; |
|
9
|
|
|
|
|
23
|
|
|
9
|
|
|
|
|
591
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# [[[ SUB-TYPES ]]] |
13
|
|
|
|
|
|
|
# a character is a string of length 0 or 1, meaning a single letter, digit, or other ASCII (Unicode???) symbol |
14
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
15
|
|
|
|
|
|
|
character; |
16
|
9
|
|
|
9
|
|
53
|
use strict; |
|
9
|
|
|
|
|
21
|
|
|
9
|
|
|
|
|
151
|
|
17
|
9
|
|
|
9
|
|
41
|
use warnings; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
231
|
|
18
|
9
|
|
|
9
|
|
45
|
use parent qw(RPerl::DataType::Integer); |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
38
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# [[[ PRE-DECLARED TYPES ]]] |
21
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
22
|
|
|
|
|
|
|
boolean; |
23
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
24
|
|
|
|
|
|
|
unsigned_integer; |
25
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
26
|
|
|
|
|
|
|
integer; |
27
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
28
|
|
|
|
|
|
|
number; |
29
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
30
|
|
|
|
|
|
|
string; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# [[[ SWITCH CONTEXT BACK TO PRIMARY PACKAGE ]]] |
33
|
|
|
|
|
|
|
package RPerl::DataType::Character; |
34
|
9
|
|
|
9
|
|
639
|
use strict; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
155
|
|
35
|
9
|
|
|
9
|
|
53
|
use warnings; |
|
9
|
|
|
|
|
29
|
|
|
9
|
|
|
|
|
220
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# [[[ EXPORTS ]]] |
38
|
9
|
|
|
9
|
|
70
|
use Exporter 'import'; |
|
9
|
|
|
|
|
21
|
|
|
9
|
|
|
|
|
4247
|
|
39
|
|
|
|
|
|
|
our @EXPORT = qw(character_CHECK character_CHECKTRACE character_to_boolean character_to_unsigned_integer character_to_integer character_to_number character_to_string); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# [[[ TYPE-CHECKING ]]] |
42
|
|
|
|
|
|
|
#our void $character_CHECK = sub { |
43
|
|
|
|
|
|
|
sub character_CHECK { |
44
|
0
|
|
|
0
|
0
|
|
( my $possible_character ) = @_; |
45
|
0
|
0
|
|
|
|
|
if ( not( defined $possible_character ) ) { croak( "\nERROR ETV00, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\ncharacter value expected but undefined/null value found,\ncroaking" ); } |
|
0
|
|
|
|
|
|
|
46
|
0
|
0
|
|
|
|
|
if ( not( main::RPerl_SvCOKp($possible_character) ) ) { croak( "\nERROR ETV01, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\ncharacter value expected but non-character value found,\ncroaking" ); } |
|
0
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
#our void $character_CHECKTRACE = sub { |
49
|
|
|
|
|
|
|
sub character_CHECKTRACE { |
50
|
0
|
|
|
0
|
0
|
|
( my $possible_character, my $variable_name, my $subroutine_name ) = @_; |
51
|
0
|
0
|
|
|
|
|
if ( not( defined $possible_character ) ) { croak( "\nERROR ETV00, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\ncharacter value expected but undefined/null value found,\nin variable " . $variable_name . " from subroutine " . $subroutine_name . ",\ncroaking" ); } |
|
0
|
|
|
|
|
|
|
52
|
0
|
0
|
|
|
|
|
if ( not( main::RPerl_SvCOKp($possible_character) ) ) { croak( "\nERROR ETV01, TYPE-CHECKING MISMATCH, PERLOPS_PERLTYPES:\ncharacter value expected but non-character value found,\nin variable " . $variable_name . " from subroutine " . $subroutine_name . ",\ncroaking" ); } |
|
0
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# [[[ BOOLEANIFY ]]] |
56
|
|
|
|
|
|
|
#our boolean $character_to_boolean = sub { |
57
|
|
|
|
|
|
|
sub character_to_boolean { |
58
|
0
|
|
|
0
|
0
|
|
(my character $input_character) = @_; |
59
|
|
|
|
|
|
|
# character_CHECK($lucky_character); |
60
|
0
|
|
|
|
|
|
character_CHECKTRACE( $input_character, '$input_character', 'character_to_boolean()' ); |
61
|
0
|
0
|
|
|
|
|
if (($input_character * 1) == 0) { return 0; } |
|
0
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
else { return 1; } |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# [[[ UNSIGNED INTEGERIFY ]]] |
66
|
|
|
|
|
|
|
#our unsigned_integer $character_to_unsigned_integer = sub { |
67
|
|
|
|
|
|
|
sub character_to_unsigned_integer { |
68
|
0
|
|
|
0
|
0
|
|
(my character $input_character) = @_; |
69
|
|
|
|
|
|
|
# character_CHECK($lucky_character); |
70
|
0
|
|
|
|
|
|
character_CHECKTRACE( $input_character, '$input_character', 'character_to_unsigned_integer()' ); |
71
|
0
|
|
|
|
|
|
return floor abs ($input_character * 1); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# [[[ INTEGERIFY ]]] |
75
|
|
|
|
|
|
|
#our integer $character_to_integer = sub { |
76
|
|
|
|
|
|
|
sub character_to_integer { |
77
|
0
|
|
|
0
|
0
|
|
(my character $input_character) = @_; |
78
|
|
|
|
|
|
|
# character_CHECK($lucky_character); |
79
|
0
|
|
|
|
|
|
character_CHECKTRACE( $input_character, '$input_character', 'character_to_integer()' ); |
80
|
0
|
|
|
|
|
|
return floor ($input_character * 1); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# [[[ NUMBERIFY ]]] |
84
|
|
|
|
|
|
|
#our number $character_to_number = sub { |
85
|
|
|
|
|
|
|
sub character_to_number { |
86
|
0
|
|
|
0
|
0
|
|
(my character $input_character) = @_; |
87
|
|
|
|
|
|
|
# character_CHECK($lucky_character); |
88
|
0
|
|
|
|
|
|
character_CHECKTRACE( $input_character, '$input_character', 'character_to_number()' ); |
89
|
0
|
|
|
|
|
|
return $input_character * 1.0; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# [[[ STRINGIFY ]]] |
93
|
|
|
|
|
|
|
#our string $character_to_string = sub { |
94
|
|
|
|
|
|
|
sub character_to_string { |
95
|
0
|
|
|
0
|
0
|
|
(my character $input_character) = @_; |
96
|
|
|
|
|
|
|
# character_CHECK($lucky_character); |
97
|
0
|
|
|
|
|
|
character_CHECKTRACE( $input_character, '$input_character', 'character_to_string()' ); |
98
|
0
|
|
|
|
|
|
return $input_character; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# [[[ TYPE TESTING ]]] |
102
|
|
|
|
|
|
|
our character $character__typetest0 = sub { |
103
|
|
|
|
|
|
|
return chr(main::RPerl__DataType__Character__MODE_ID() + (ord '0')); |
104
|
|
|
|
|
|
|
}; |
105
|
|
|
|
|
|
|
our character $character__typetest1 = sub { |
106
|
|
|
|
|
|
|
(my character $lucky_character) = @_; |
107
|
|
|
|
|
|
|
# character_CHECK($lucky_character); |
108
|
|
|
|
|
|
|
character_CHECKTRACE( $lucky_character, '$lucky_character', 'character__typetest1()' ); |
109
|
|
|
|
|
|
|
return chr((ord $lucky_character) + main::RPerl__DataType__Character__MODE_ID()); |
110
|
|
|
|
|
|
|
}; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
1; # end of class |