Skip to content

Commit 7431637

Browse files
khwilliamsondemerphq
authored andcommitted
makedef.pl: Create $define{WIN32} etc
A portion of makedef.pl must manually be kept in sync with changes to portions of perl.h. Prior to this commit, you had to remember that #ifdef WIN32 from perl.h had to be translated to a completely different paradigm for use in this file. This commit fixes that, which can help prepare the way for future programmatic syncing of the two files.
1 parent 8920129 commit 7431637

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

makedef.pl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,13 @@ BEGIN
6666
die "PLATFORM must be one of: @PLATFORM\n"
6767
unless exists $PLATFORM{$ARGS{PLATFORM}};
6868
}
69+
6970
use constant PLATFORM => $ARGS{PLATFORM};
7071

72+
# This makes us able to use, e.g., $define{WIN32}, so you don't have to
73+
# remember what things came from %ARGS.
74+
$define{uc $ARGS{'PLATFORM'}} = 1;
75+
7176
require "./$ARGS{TARG_DIR}regen/embed_lib.pl";
7277

7378
# Is the following guard strictly necessary? Added during refactoring
@@ -110,6 +115,7 @@ BEGIN
110115
#==========================================================================
111116
# perl.h logic duplication begins
112117

118+
113119
if ($define{USE_ITHREADS}) {
114120
if (!$define{MULTIPLICITY}) {
115121
$define{MULTIPLICITY} = 1;
@@ -120,7 +126,7 @@ BEGIN
120126
$define{USE_ITHREADS} ||
121127
$define{PERL_IMPLICIT_CONTEXT} ;
122128

123-
if ($define{USE_ITHREADS} && PLATFORM ne 'win32') {
129+
if ($define{USE_ITHREADS} && ! $define{WIN32}) {
124130
$define{USE_REENTRANT_API} = 1;
125131
}
126132

@@ -155,8 +161,8 @@ BEGIN
155161
if ($define{USE_LOCALE_THREADS} && ! $define{NO_THREAD_SAFE_LOCALE})
156162
{
157163
if ( $define{USE_POSIX_2008_LOCALE}
158-
|| (PLATFORM eq 'win32' && ( $cctype !~ /\D/
159-
&& $cctype >= 80)))
164+
|| ($define{WIN32} && ( $cctype !~ /\D/
165+
&& $cctype >= 80)))
160166
{
161167
$define{USE_THREAD_SAFE_LOCALE} = 1;
162168
}
@@ -175,7 +181,7 @@ BEGIN
175181
$define{USE_PL_CUR_LC_ALL} = 1;
176182
}
177183

178-
if (PLATFORM eq 'win32' && $define{USE_THREAD_SAFE_LOCALE})
184+
if ($define{WIN32} && $define{USE_THREAD_SAFE_LOCALE})
179185
{
180186
$define{USE_PL_CUR_LC_ALL} = 1;
181187

@@ -185,7 +191,7 @@ BEGIN
185191
}
186192

187193
if ($define{MULTIPLICITY} && ( $define{USE_POSIX_2008_LOCALE}
188-
|| ( PLATFORM eq 'win32'
194+
|| ( $define{WIN32}
189195
&& $define{USE_THREAD_SAFE_LOCALE})))
190196
{
191197
$define{USE_PERL_SWITCH_LOCALE_CONTEXT}

0 commit comments

Comments
 (0)