Constants.pm

filter: Statementstmt 100% 46 / 46 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod n/a totaltotal 100% 57 / 57 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« HeaderPar.pm ↑ Summary
1 package Astro::STSDAS::Table::Constants;
2  
3 7 require 5.005_62;
4 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 7 require Exporter;
8  
9 7 our @ISA = qw(Exporter);
10  
11 7 our @EXPORT = qw(
12 TT_ROW_ORDER
13 TT_COL_ORDER
14 CHAR_SZ
15 TY_REAL
16 TY_DOUBLE
17 TY_INT
18 TY_SHORT
19 TY_BOOL
20 TY_STRING
21 %TypeSize
22 %TypeUPack
23 %TypeIndef
24 %HdrType
25 %Types
26 );
27  
28 7 our $VERSION = '0.01';
29  
30 7 ▶use constant TT_ROW_ORDER => 11;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 7 ▶use constant TT_COL_ORDER => 12;
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33 7 ▶use constant CHAR_SZ => 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
34  
35 # column data representation types; from IRAF unix/hlib/iraf.h
36 7 ▶use constant TY_BOOL => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
37 7 ▶use constant TY_SHORT => 3;
Subroutine BEGIN: called CC=1 SCAR=0.0
38 7 ▶use constant TY_INT => 4;
Subroutine BEGIN: called CC=1 SCAR=0.0
39 7 ▶use constant TY_REAL => 6;
Subroutine BEGIN: called CC=1 SCAR=0.0
40 7 ▶use constant TY_DOUBLE => 7;
Subroutine BEGIN: called CC=1 SCAR=0.0
41 # special to STSDAS tables
42 7 ▶use constant TY_STRING => -1;
Subroutine BEGIN: called CC=1 SCAR=0.0
43  
44 7 our @Types = ( TY_BOOL, TY_SHORT, TY_INT, TY_REAL, TY_DOUBLE, TY_STRING );
45 7 our %Types = map { $_ => 1 } @Types;
46  
47 # from IRAF unix/hlib/iraf.h
48 7 our %TypeSize = (
49 TY_BOOL() => 2 * CHAR_SZ,
50 TY_SHORT() => 1 * CHAR_SZ,
51 TY_INT() => 2 * CHAR_SZ,
52 TY_REAL() => 2 * CHAR_SZ,
53 TY_DOUBLE() => 4 * CHAR_SZ,
54 );
55  
56  
57 # use Perl pack types which have as exact a length as possible
58 7 our %TypeUPack = (
59 TY_BOOL() => 'l',
60 TY_SHORT() => 's',
61 TY_INT() => 'l',
62 TY_REAL() => 'f',
63 TY_DOUBLE() => 'd',
64 TY_STRING() => 'a',
65 );
66  
67  
68 # values that indicate the data are undefined.
69 # these are taken from the IRAF unix/hlib/iraf.h file,
70 # except for the TY_DOUBLE value, which is from the STSDAS Table
71 # tbtables.h file.
72 7 our %TypeIndef = (
73 TY_BOOL() => '', # not possible
74 TY_SHORT() => -32767,
75 TY_INT() => -2147483647,
76 # since Perl is double precision, do this to get
77 # single precision value of 1.6e38
78 TY_REAL() => unpack('f', pack('f', 1.6e38)),
79 TY_DOUBLE() => 1.6e38,
80 TY_STRING() => '' # not meaningful
81 );
82  
83 7 our %HdrType = (
84 b => TY_BOOL,
85 i => TY_INT,
86 r => TY_REAL,
87 d => TY_DOUBLE,
88 t => TY_STRING,
89 );
90  
91 7 1;
92  
« HeaderPar.pm ↑ Summary