1 ################################################################################
3 ## Version 3.x, Copyright (C) 2004-2013, Marcus Holland-Moritz.
4 ## Version 2.x, Copyright (C) 2001, Paul Marquess.
5 ## Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
7 ## This program is free software; you can redistribute it and/or
8 ## modify it under the same terms as Perl itself.
10 ################################################################################
18 ## We don't want people to be using these symbols so even though we provide
19 ## them, we don't publicly mention them
24 PERL_PATCHLEVEL_H_IMPLICIT
29 #define D_PPP_RELEASE_DATE 1602806400 /* 2020-10-16 */
31 #if ! defined(PERL_REVISION) && ! defined(PERL_VERSION_MAJOR)
32 # if ! defined(__PATCHLEVEL_H_INCLUDED__) \
33 && ! ( defined(PATCHLEVEL) && defined(SUBVERSION))
34 # define PERL_PATCHLEVEL_H_IMPLICIT
35 # include <patchlevel.h>
37 # if ! defined(PERL_VERSION) \
38 && ! defined(PERL_VERSION_MAJOR) \
39 && ( ! defined(SUBVERSION) || ! defined(PATCHLEVEL) )
40 # include <could_not_find_Perl_patchlevel.h>
44 #ifdef PERL_VERSION_MAJOR
45 # define D_PPP_MAJOR PERL_VERSION_MAJOR
46 #elif defined(PERL_REVISION)
47 # define D_PPP_MAJOR PERL_REVISION
49 # define D_PPP_MAJOR 5
52 #ifdef PERL_VERSION_MINOR
53 # define D_PPP_MINOR PERL_VERSION_MINOR
54 #elif defined(PERL_VERSION)
55 # define D_PPP_MINOR PERL_VERSION
56 #elif defined(PATCHLEVEL)
57 # define D_PPP_MINOR PATCHLEVEL
58 # define PERL_VERSION PATCHLEVEL /* back-compat */
60 # error Could not find a source for PERL_VERSION_MINOR
63 #ifdef PERL_VERSION_PATCH
64 # define D_PPP_PATCH PERL_VERSION_PATCH
65 #elif defined(PERL_SUBVERSION)
66 # define D_PPP_PATCH PERL_SUBVERSION
67 #elif defined(SUBVERSION)
68 # define D_PPP_PATCH SUBVERSION
69 # define PERL_SUBVERSION SUBVERSION /* back-compat */
71 # error Could not find a source for PERL_VERSION_PATCH
74 #if D_PPP_MAJOR < 5 || D_PPP_MAJOR == 6
75 # error Devel::PPPort works only on Perl 5, Perl 7, ...
76 #elif D_PPP_MAJOR != 5
77 /* Perl 7 and above: the old forms are deprecated, set up so that they
78 * assume Perl 5, and will make this look like 5.201.201.
80 * 201 is used so will be well above anything that would come from a 5
81 * series if we unexpectedly have to continue it, but still gives plenty of
82 * room, up to 255, of numbers that will fit into a byte in case there is
83 * something else unforeseen */
86 # undef PERL_SUBVERSION
87 # define D_PPP_REVISION 5
88 # define D_PPP_VERSION 201
89 # define D_PPP_SUBVERSION 201
90 # if (defined(__clang__) /* _Pragma here doesn't work with gcc */ \
91 && ( (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
92 || defined(_STDC_C99) \
94 # define D_PPP_STRINGIFY(x) #x
95 # define D_PPP_deprecate(xyz) _Pragma(D_PPP_STRINGIFY(GCC warning(D_PPP_STRINGIFY(xyz) " is deprecated")))
96 # define PERL_REVISION (D_PPP_REVISION D_PPP_deprecate(PERL_REVISION))
97 # define PERL_VERSION (D_PPP_REVISION D_PPP_deprecate(PERL_VERSION))
98 # define PERL_SUBVERSION (D_PPP_SUBVERSION D_PPP_deprecate(PERL_SUBVERSION))
100 # define PERL_REVISION D_PPP_REVISION
101 # define PERL_VERSION D_PPP_REVISION
102 # define PERL_SUBVERSION D_PPP_SUBVERSION
106 /* Warning: PERL_PATCHLEVEL PATCHLEVEL SUBVERSION PERL_REVISION PERL_VERSION
107 * PERL_SUBVERSION PERL_BCDVERSION
109 * You should be using PERL_VERSION_xy(maj,min,ptch) instead of this, where xy
110 * is one of EQ, NE, LE, GT, LT, GE
113 /* Replace PERL_PATCHLEVEL with PERL_VERSION_xy(5,a,b) (where xy is EQ,LT,GT...) */
114 /* Replace PATCHLEVEL with PERL_VERSION_xy(5,a,b) (where xy is EQ,LT,GT...) */
115 /* Replace SUBVERSION with PERL_VERSION_xy(5,a,b) (where xy is EQ,LT,GT...) */
116 /* Replace PERL_REVISION with PERL_VERSION_xy(a,b,c) (where xy is EQ,LT,GT...) */
117 /* Replace PERL_VERSION with PERL_VERSION_xy(5,a,b) (where xy is EQ,LT,GT...) */
118 /* Replace PERL_SUBVERSION with PERL_VERSION_xy(5,a,b) (where xy is EQ,LT,GT...) */
119 /* Replace PERL_BCDVERSION with PERL_VERSION_xy(5,a,b) (where xy is EQ,LT,GT...) */
121 #define D_PPP_DEC2BCD(dec) ((((dec)/100)<<8)|((((dec)%100)/10)<<4)|((dec)%10))
122 #define D_PPP_JNP_TO_BCD(j,n,p) ((D_PPP_DEC2BCD(j)<<24)|(D_PPP_DEC2BCD(n)<<12)|D_PPP_DEC2BCD(p))
123 #define PERL_BCDVERSION D_PPP_JNP_TO_BCD(D_PPP_MAJOR, \
127 /* These differ from the versions outside D:P in using PERL_BCDVERSION instead
128 * of PERL_DECIMAL_VERSION. The formats printing in this module assume BCD, so
130 #undef PERL_VERSION_EQ
131 #undef PERL_VERSION_NE
132 #undef PERL_VERSION_LT
133 #undef PERL_VERSION_GE
134 #undef PERL_VERSION_LE
135 #undef PERL_VERSION_GT
137 /* N.B. These don't work if the patch number is 42 or 92, as those are what '*'
138 * is in ASCII and EBCDIC respectively */
139 __UNDEFINED__ PERL_VERSION_EQ(j,n,p) \
140 (((p) == '*') ? ( (j) == D_PPP_VERSION_MAJOR \
141 && (n) == D_PPP_VERSION_MINOR) \
142 : (PERL_BCDVERSION == D_PPP_JNP_TO_BCD(j,n,p)))
143 __UNDEFINED__ PERL_VERSION_NE(j,n,p) (! PERL_VERSION_EQ(j,n,p))
145 __UNDEFINED__ PERL_VERSION_LT(j,n,p) /* p=='*' means _LT(j,n,0) */ \
146 (PERL_BCDVERSION < D_PPP_JNP_TO_BCD( (j), \
148 (((p) == '*') ? 0 : (p))))
149 __UNDEFINED__ PERL_VERSION_GE(j,n,p) (! PERL_VERSION_LT(j,n,p))
151 __UNDEFINED__ PERL_VERSION_LE(j,n,p) /* p=='*' means _LT(j,n+1,0) */ \
152 (PERL_BCDVERSION < D_PPP_JNP_TO_BCD( (j), \
153 (((p) == '*') ? ((n)+1) : (n)), \
154 (((p) == '*') ? 0 : (p))))
155 __UNDEFINED__ PERL_VERSION_GT(j,n,p) (! PERL_VERSION_LE(j,n,p))