1 #define PERL_constant_NOTFOUND 1
2 #define PERL_constant_NOTDEF 2
3 #define PERL_constant_ISIV 3
4 #define PERL_constant_ISNO 4
5 #define PERL_constant_ISNV 5
6 #define PERL_constant_ISPV 6
7 #define PERL_constant_ISPVN 7
8 #define PERL_constant_ISSV 8
9 #define PERL_constant_ISUNDEF 9
10 #define PERL_constant_ISUV 10
11 #define PERL_constant_ISYES 11
14 typedef double NV; /* 5.6 and later define NVTYPE, and typedef NV to it. */
17 #define aTHX_ /* 5.6 or later define this for threading support. */
20 #define pTHX_ /* 5.6 or later define this for threading support. */
24 constant_11 (pTHX_ const char *name, IV *iv_return) {
25 /* When generated this function returned values for the list of names given
26 here. However, subsequent manual editing may have added or removed some.
27 ITIMER_PROF ITIMER_REAL d_getitimer d_nanosleep d_setitimer */
28 /* Offset 7 gives the best switch position. */
31 if (memEQ(name, "ITIMER_PROF", 11)) {
34 *iv_return = ITIMER_PROF;
35 return PERL_constant_ISIV;
37 return PERL_constant_NOTDEF;
42 if (memEQ(name, "ITIMER_REAL", 11)) {
45 *iv_return = ITIMER_REAL;
46 return PERL_constant_ISIV;
48 return PERL_constant_NOTDEF;
53 if (memEQ(name, "d_getitimer", 11)) {
57 return PERL_constant_ISIV;
60 return PERL_constant_ISIV;
63 if (memEQ(name, "d_setitimer", 11)) {
67 return PERL_constant_ISIV;
70 return PERL_constant_ISIV;
75 if (memEQ(name, "d_nanosleep", 11)) {
79 return PERL_constant_ISIV;
82 return PERL_constant_ISIV;
87 return PERL_constant_NOTFOUND;
91 constant (pTHX_ const char *name, STRLEN len, IV *iv_return) {
92 /* Initially switch on the length of the name. */
93 /* When generated this function returned values for the list of names given
94 in this section of perl code. Rather than manually editing these functions
95 to add or remove constants, which would result in this comment and section
96 of code becoming inaccurate, we recommend that you edit this section of
97 code, and use it to regenerate a new set of constant functions which you
98 then use to replace the originals.
100 Regenerate these constant functions by feeding this entire source file to
103 #!/usr/local/bin/perl5.8.0 -w
104 use ExtUtils::Constant qw (constant_types C_constant XS_constant);
106 my $types = {map {($_, 1)} qw(IV)};
107 my @names = (qw(ITIMER_PROF ITIMER_REAL ITIMER_REALPROF ITIMER_VIRTUAL),
108 {name=>"d_getitimer", type=>"IV", macro=>"HAS_GETITIMER", value=>"1", default=>["IV", "0"]},
109 {name=>"d_gettimeofday", type=>"IV", macro=>"HAS_GETTIMEOFDAY", value=>"1", default=>["IV", "0"]},
110 {name=>"d_nanosleep", type=>"IV", macro=>"HAS_NANOSLEEP", value=>"1", default=>["IV", "0"]},
111 {name=>"d_setitimer", type=>"IV", macro=>"HAS_SETITIMER", value=>"1", default=>["IV", "0"]},
112 {name=>"d_ualarm", type=>"IV", macro=>"HAS_UALARM", value=>"1", default=>["IV", "0"]},
113 {name=>"d_usleep", type=>"IV", macro=>"HAS_USLEEP", value=>"1", default=>["IV", "0"]});
115 print constant_types(); # macro defs
116 foreach (C_constant ("Time::HiRes", 'constant', 'IV', $types, undef, 3, @names) ) {
117 print $_, "\n"; # C constant subs
119 print "#### XS Section:\n";
120 print XS_constant ("Time::HiRes", $types);
126 /* Names all of length 8. */
127 /* d_ualarm d_usleep */
128 /* Offset 7 gives the best switch position. */
131 if (memEQ(name, "d_ualarm", 8)) {
135 return PERL_constant_ISIV;
138 return PERL_constant_ISIV;
143 if (memEQ(name, "d_usleep", 8)) {
147 return PERL_constant_ISIV;
150 return PERL_constant_ISIV;
157 return constant_11 (aTHX_ name, iv_return);
160 /* Names all of length 14. */
161 /* ITIMER_VIRTUAL d_gettimeofday */
162 /* Offset 6 gives the best switch position. */
165 if (memEQ(name, "ITIMER_VIRTUAL", 14)) {
167 #ifdef ITIMER_VIRTUAL
168 *iv_return = ITIMER_VIRTUAL;
169 return PERL_constant_ISIV;
171 return PERL_constant_NOTDEF;
176 if (memEQ(name, "d_gettimeofday", 14)) {
178 #ifdef HAS_GETTIMEOFDAY
180 return PERL_constant_ISIV;
183 return PERL_constant_ISIV;
190 if (memEQ(name, "ITIMER_REALPROF", 15)) {
191 #ifdef ITIMER_REALPROF
192 *iv_return = ITIMER_REALPROF;
193 return PERL_constant_ISIV;
195 return PERL_constant_NOTDEF;
200 return PERL_constant_NOTFOUND;