summaryrefslogtreecommitdiff
path: root/dist/Devel-PPPort/parts/inc/version
blob: 8eedf807e40ec859ddb7565c01d112c2ec38c621 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
################################################################################
##
##  Version 3.x, Copyright (C) 2004-2013, Marcus Holland-Moritz.
##  Version 2.x, Copyright (C) 2001, Paul Marquess.
##  Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
##
##  This program is free software; you can redistribute it and/or
##  modify it under the same terms as Perl itself.
##
################################################################################

=provides

__UNDEFINED__

=dontwarn

## We don't want people to be using these symbols so even though we provide
## them, we don't publicly mention them

PERL_REVISION
PERL_VERSION
PERL_SUBVERSION
PERL_PATCHLEVEL_H_IMPLICIT
PERL_BCDVERSION

=implementation

#define D_PPP_RELEASE_DATE 1625616000 /* 2021-07-07 */

#if ! defined(PERL_REVISION) && ! defined(PERL_VERSION_MAJOR)
#  if   !   defined(__PATCHLEVEL_H_INCLUDED__)                                  \
     && ! ( defined(PATCHLEVEL) && defined(SUBVERSION))
#    define PERL_PATCHLEVEL_H_IMPLICIT
#    include <patchlevel.h>
#  endif
#  if     ! defined(PERL_VERSION)                                               \
     &&   ! defined(PERL_VERSION_MAJOR)                                         \
     && ( ! defined(SUBVERSION) || ! defined(PATCHLEVEL) )
#    include <could_not_find_Perl_patchlevel.h>
#  endif
#endif

#ifdef PERL_VERSION_MAJOR
#  define D_PPP_MAJOR  PERL_VERSION_MAJOR
#elif defined(PERL_REVISION)
#  define D_PPP_MAJOR  PERL_REVISION
#else
#  define D_PPP_MAJOR  5
#endif

#ifdef PERL_VERSION_MINOR
#  define D_PPP_MINOR  PERL_VERSION_MINOR
#elif defined(PERL_VERSION)
#  define D_PPP_MINOR  PERL_VERSION
#elif defined(PATCHLEVEL)
#  define D_PPP_MINOR  PATCHLEVEL
#  define PERL_VERSION         PATCHLEVEL   /* back-compat */
#else
#  error Could not find a source for PERL_VERSION_MINOR
#endif

#ifdef PERL_VERSION_PATCH
#  define D_PPP_PATCH  PERL_VERSION_PATCH
#elif defined(PERL_SUBVERSION)
#  define D_PPP_PATCH  PERL_SUBVERSION
#elif defined(SUBVERSION)
#  define D_PPP_PATCH  SUBVERSION
#  define PERL_SUBVERSION      SUBVERSION   /* back-compat */
#else
#  error Could not find a source for PERL_VERSION_PATCH
#endif

#if D_PPP_MAJOR < 5 || D_PPP_MAJOR == 6
#  error Devel::PPPort works only on Perl 5, Perl 7, ...
#elif D_PPP_MAJOR != 5
    /* Perl 7 and above: the old forms are deprecated, set up so that they
     * assume Perl 5, and will make this look like 5.201.201.
     *
     * 201 is used so will be well above anything that would come from a 5
     * series if we unexpectedly have to continue it, but still gives plenty of
     * room, up to 255, of numbers that will fit into a byte in case there is
     * something else unforeseen */
#  undef  PERL_REVISION
#  undef  PERL_VERSION
#  undef  PERL_SUBVERSION
#  define D_PPP_REVISION      5
#  define D_PPP_VERSION     201
#  define D_PPP_SUBVERSION  201
#  if   (defined(__clang__)     /* _Pragma here doesn't work with gcc */  \
     && (   (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)    \
         || defined(_STDC_C99)                                            \
         || defined(__c99)))
#    define D_PPP_STRINGIFY(x) #x
#    define D_PPP_deprecate(xyz) _Pragma(D_PPP_STRINGIFY(GCC warning(D_PPP_STRINGIFY(xyz) " is deprecated")))
#    define PERL_REVISION     (D_PPP_REVISION D_PPP_deprecate(PERL_REVISION))
#    define PERL_VERSION      (D_PPP_REVISION D_PPP_deprecate(PERL_VERSION))
#    define PERL_SUBVERSION   (D_PPP_SUBVERSION D_PPP_deprecate(PERL_SUBVERSION))
#  else
#    define PERL_REVISION     D_PPP_REVISION
#    define PERL_VERSION      D_PPP_REVISION
#    define PERL_SUBVERSION   D_PPP_SUBVERSION
#  endif
#endif

/* Warning: PERL_PATCHLEVEL PATCHLEVEL SUBVERSION PERL_REVISION PERL_VERSION
 *          PERL_SUBVERSION PERL_BCDVERSION
 *
 * You should be using PERL_VERSION_xy(maj,min,ptch) instead of this, where xy
 * is one of EQ, NE, LE, GT, LT, GE
 */

/* Replace PERL_PATCHLEVEL with PERL_VERSION_xy(5,a,b) (where xy is EQ,LT,GT...) */
/* Replace PATCHLEVEL with PERL_VERSION_xy(5,a,b) (where xy is EQ,LT,GT...) */
/* Replace SUBVERSION with PERL_VERSION_xy(5,a,b) (where xy is EQ,LT,GT...) */
/* Replace PERL_REVISION with PERL_VERSION_xy(a,b,c) (where xy is EQ,LT,GT...) */
/* Replace PERL_VERSION with PERL_VERSION_xy(5,a,b) (where xy is EQ,LT,GT...) */
/* Replace PERL_SUBVERSION with PERL_VERSION_xy(5,a,b) (where xy is EQ,LT,GT...) */
/* Replace PERL_BCDVERSION with PERL_VERSION_xy(5,a,b) (where xy is EQ,LT,GT...) */

#define D_PPP_DEC2BCD(dec) ((((dec)/100)<<8)|((((dec)%100)/10)<<4)|((dec)%10))
#define D_PPP_JNP_TO_BCD(j,n,p) ((D_PPP_DEC2BCD(j)<<24)|(D_PPP_DEC2BCD(n)<<12)|D_PPP_DEC2BCD(p))
#define PERL_BCDVERSION D_PPP_JNP_TO_BCD(D_PPP_MAJOR,           \
                                          D_PPP_MINOR,          \
                                          D_PPP_PATCH)

/* These differ from the versions outside D:P in using PERL_BCDVERSION instead
 * of PERL_DECIMAL_VERSION.  The formats printing in this module assume BCD, so
 * always use it */
#undef PERL_VERSION_EQ
#undef PERL_VERSION_NE
#undef PERL_VERSION_LT
#undef PERL_VERSION_GE
#undef PERL_VERSION_LE
#undef PERL_VERSION_GT

/* N.B. These don't work if the patch number is 42 or 92, as those are what '*'
 * is in ASCII and EBCDIC respectively */
__UNDEFINED__ PERL_VERSION_EQ(j,n,p)                                        \
              (((p) == '*') ? (   (j) == D_PPP_VERSION_MAJOR                \
                               && (n) == D_PPP_VERSION_MINOR)               \
                            : (PERL_BCDVERSION == D_PPP_JNP_TO_BCD(j,n,p)))
__UNDEFINED__ PERL_VERSION_NE(j,n,p) (! PERL_VERSION_EQ(j,n,p))

__UNDEFINED__ PERL_VERSION_LT(j,n,p)      /* p=='*' means _LT(j,n,0) */     \
    (PERL_BCDVERSION < D_PPP_JNP_TO_BCD(                    (j),            \
                                                             (n),           \
                                         (((p) == '*') ? 0 : (p))))
__UNDEFINED__ PERL_VERSION_GE(j,n,p) (! PERL_VERSION_LT(j,n,p))

__UNDEFINED__ PERL_VERSION_LE(j,n,p)      /* p=='*' means _LT(j,n+1,0) */   \
    (PERL_BCDVERSION < D_PPP_JNP_TO_BCD(                          (j),      \
                                         (((p) == '*') ? ((n)+1) : (n)),    \
                                         (((p) == '*') ?   0     : (p))))
__UNDEFINED__ PERL_VERSION_GT(j,n,p) (! PERL_VERSION_LE(j,n,p))