Bug Summary

File:obj/gnu/usr.bin/perl/ext/POSIX/POSIX.c
Warning:line 3966, column 3
Access to field 'sv_flags' results in a dereference of a null pointer

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple amd64-unknown-openbsd7.0 -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name POSIX.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 1 -fhalf-no-semantic-interposition -fno-delete-null-pointer-checks -mframe-pointer=all -relaxed-aliasing -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-feature +retpoline-indirect-calls -target-feature +retpoline-indirect-branches -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/usr/obj/gnu/usr.bin/perl/ext/POSIX -resource-dir /usr/local/lib/clang/13.0.0 -D NO_LOCALE_NUMERIC -D NO_LOCALE_COLLATE -D STRUCT_TM_HASZONE -D VERSION="1.94" -D XS_VERSION="1.94" -D PIC -I ../.. -internal-isystem /usr/local/lib/clang/13.0.0/include -internal-externc-isystem /usr/include -O2 -Wwrite-strings -fconst-strings -fdebug-compilation-dir=/usr/obj/gnu/usr.bin/perl/ext/POSIX -ferror-limit 19 -fwrapv -D_RET_PROTECTOR -ret-protector -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-valloc -fno-builtin-free -fno-builtin-strdup -fno-builtin-strndup -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /home/ben/Projects/vmm/scan-build/2022-01-12-194120-40624-1 -x c POSIX.c

POSIX.c

1/*
2 * This file was generated automatically by ExtUtils::ParseXS version 3.40 from the
3 * contents of POSIX.xs. Do not edit this file, edit POSIX.xs instead.
4 *
5 * ANY CHANGES MADE HERE WILL BE LOST!
6 *
7 */
8
9#line 1 "POSIX.xs"
10#define PERL_EXT_POSIX
11#define PERL_EXT
12
13#ifdef NETWARE
14 #define _POSIX_
15 /*
16 * Ideally this should be somewhere down in the includes
17 * but putting it in other places is giving compiler errors.
18 * Also here I am unable to check for HAS_UNAME since it wouldn't have
19 * yet come into the file at this stage - sgp 18th Oct 2000
20 */
21 #include <sys/utsname.h>
22#endif /* NETWARE */
23
24#define PERL_NO_GET_CONTEXT
25
26#include "EXTERN.h"
27#define PERLIO_NOT_STDIO1 1
28#include "perl.h"
29#include "XSUB.h"
30
31static int not_here(const char *s);
32
33#if defined(PERL_IMPLICIT_SYS)
34# undef signal
35# undef open
36# undef setmode
37# define open PerlLIO_open3
38#endif
39#include <ctype.h>
40#ifdef I_DIRENT /* XXX maybe better to just rely on perl.h? */
41#include <dirent.h>
42#endif
43#include <errno(*__errno()).h>
44#ifdef WIN32
45#include <sys/errno2.h>
46#endif
47#include <float.h>
48#ifdef I_FENV
49#if !(defined(__vax__) && defined(__NetBSD__))
50#include <fenv.h>
51#endif
52#endif
53#include <limits.h>
54#include <locale.h>
55#include <math.h>
56#ifdef I_PWD
57#include <pwd.h>
58#endif
59#include <setjmp.h>
60#include <signal.h>
61#include <stdarg.h>
62#include <stddef.h>
63
64#ifdef I_UNISTD
65#include <unistd.h>
66#endif
67
68#ifdef I_SYS_TIME
69# include <sys/time.h>
70#endif
71
72#ifdef I_SYS_RESOURCE
73# include <sys/resource.h>
74#endif
75
76/* Cygwin's stdio.h doesn't make cuserid() visible with -D_GNU_SOURCE,
77 unlike Linux.
78*/
79#ifdef __CYGWIN__
80# undef HAS_CUSERID
81#endif
82
83#if defined(USE_QUADMATH) && defined(I_QUADMATH)
84
85# undef M_E((double)2.7182818284590452354)
86# undef M_LOG2E((double)1.4426950408889634074)
87# undef M_LOG10E((double)0.43429448190325182765)
88# undef M_LN2((double)0.69314718055994530942)
89# undef M_LN10((double)2.30258509299404568402)
90# undef M_PI((double)3.14159265358979323846)
91# undef M_PI_2((double)1.57079632679489661923)
92# undef M_PI_4((double)0.78539816339744830962)
93# undef M_1_PI((double)0.31830988618379067154)
94# undef M_2_PI((double)0.63661977236758134308)
95# undef M_2_SQRTPI((double)1.12837916709551257390)
96# undef M_SQRT2((double)1.41421356237309504880)
97# undef M_SQRT1_2((double)0.70710678118654752440)
98
99# define M_E((double)2.7182818284590452354) M_Eq
100# define M_LOG2E((double)1.4426950408889634074) M_LOG2Eq
101# define M_LOG10E((double)0.43429448190325182765) M_LOG10Eq
102# define M_LN2((double)0.69314718055994530942) M_LN2q
103# define M_LN10((double)2.30258509299404568402) M_LN10q
104# define M_PI((double)3.14159265358979323846) M_PIq
105# define M_PI_2((double)1.57079632679489661923) M_PI_2q
106# define M_PI_4((double)0.78539816339744830962) M_PI_4q
107# define M_1_PI((double)0.31830988618379067154) M_1_PIq
108# define M_2_PI((double)0.63661977236758134308) M_2_PIq
109# define M_2_SQRTPI((double)1.12837916709551257390) M_2_SQRTPIq
110# define M_SQRT2((double)1.41421356237309504880) M_SQRT2q
111# define M_SQRT1_2((double)0.70710678118654752440) M_SQRT1_2q
112
113#else
114
115# ifdef USE_LONG_DOUBLE
116# undef M_E((double)2.7182818284590452354)
117# undef M_LOG2E((double)1.4426950408889634074)
118# undef M_LOG10E((double)0.43429448190325182765)
119# undef M_LN2((double)0.69314718055994530942)
120# undef M_LN10((double)2.30258509299404568402)
121# undef M_PI((double)3.14159265358979323846)
122# undef M_PI_2((double)1.57079632679489661923)
123# undef M_PI_4((double)0.78539816339744830962)
124# undef M_1_PI((double)0.31830988618379067154)
125# undef M_2_PI((double)0.63661977236758134308)
126# undef M_2_SQRTPI((double)1.12837916709551257390)
127# undef M_SQRT2((double)1.41421356237309504880)
128# undef M_SQRT1_2((double)0.70710678118654752440)
129# define FLOAT_C(c)(c) CAT2(c,L)cL
130# else
131# define FLOAT_C(c)(c) (c)
132# endif
133
134# ifndef M_E((double)2.7182818284590452354)
135# define M_E((double)2.7182818284590452354) FLOAT_C(2.71828182845904523536028747135266250)(2.71828182845904523536028747135266250)
136# endif
137# ifndef M_LOG2E((double)1.4426950408889634074)
138# define M_LOG2E((double)1.4426950408889634074) FLOAT_C(1.44269504088896340735992468100189214)(1.44269504088896340735992468100189214)
139# endif
140# ifndef M_LOG10E((double)0.43429448190325182765)
141# define M_LOG10E((double)0.43429448190325182765) FLOAT_C(0.434294481903251827651128918916605082)(0.434294481903251827651128918916605082)
142# endif
143# ifndef M_LN2((double)0.69314718055994530942)
144# define M_LN2((double)0.69314718055994530942) FLOAT_C(0.693147180559945309417232121458176568)(0.693147180559945309417232121458176568)
145# endif
146# ifndef M_LN10((double)2.30258509299404568402)
147# define M_LN10((double)2.30258509299404568402) FLOAT_C(2.30258509299404568401799145468436421)(2.30258509299404568401799145468436421)
148# endif
149# ifndef M_PI((double)3.14159265358979323846)
150# define M_PI((double)3.14159265358979323846) FLOAT_C(3.14159265358979323846264338327950288)(3.14159265358979323846264338327950288)
151# endif
152# ifndef M_PI_2((double)1.57079632679489661923)
153# define M_PI_2((double)1.57079632679489661923) FLOAT_C(1.57079632679489661923132169163975144)(1.57079632679489661923132169163975144)
154# endif
155# ifndef M_PI_4((double)0.78539816339744830962)
156# define M_PI_4((double)0.78539816339744830962) FLOAT_C(0.785398163397448309615660845819875721)(0.785398163397448309615660845819875721)
157# endif
158# ifndef M_1_PI((double)0.31830988618379067154)
159# define M_1_PI((double)0.31830988618379067154) FLOAT_C(0.318309886183790671537767526745028724)(0.318309886183790671537767526745028724)
160# endif
161# ifndef M_2_PI((double)0.63661977236758134308)
162# define M_2_PI((double)0.63661977236758134308) FLOAT_C(0.636619772367581343075535053490057448)(0.636619772367581343075535053490057448)
163# endif
164# ifndef M_2_SQRTPI((double)1.12837916709551257390)
165# define M_2_SQRTPI((double)1.12837916709551257390) FLOAT_C(1.12837916709551257389615890312154517)(1.12837916709551257389615890312154517)
166# endif
167# ifndef M_SQRT2((double)1.41421356237309504880)
168# define M_SQRT2((double)1.41421356237309504880) FLOAT_C(1.41421356237309504880168872420969808)(1.41421356237309504880168872420969808)
169# endif
170# ifndef M_SQRT1_2((double)0.70710678118654752440)
171# define M_SQRT1_2((double)0.70710678118654752440) FLOAT_C(0.707106781186547524400844362104849039)(0.707106781186547524400844362104849039)
172# endif
173
174#endif
175
176#if !defined(INFINITY__builtin_inff()) && defined(NV_INFPL_inf.nv)
177# define INFINITY__builtin_inff() NV_INFPL_inf.nv
178#endif
179
180#if !defined(NAN__builtin_nanf("")) && defined(NV_NANPL_nan.nv)
181# define NAN__builtin_nanf("") NV_NANPL_nan.nv
182#endif
183
184#if !defined(InfPL_inf.nv) && defined(NV_INFPL_inf.nv)
185# define InfPL_inf.nv NV_INFPL_inf.nv
186#endif
187
188#if !defined(NaNPL_nan.nv) && defined(NV_NANPL_nan.nv)
189# define NaNPL_nan.nv NV_NANPL_nan.nv
190#endif
191
192/* We will have an emulation. */
193#ifndef FP_INFINITE0x01
194# define FP_INFINITE0x01 0
195# define FP_NAN0x02 1
196# define FP_NORMAL0x04 2
197# define FP_SUBNORMAL0x08 3
198# define FP_ZERO0x10 4
199#endif
200
201/* We will have an emulation. */
202#ifndef FE_TONEAREST0x000
203# define FE_TOWARDZERO0xc00 0
204# define FE_TONEAREST0x000 1
205# define FE_UPWARD0x800 2
206# define FE_DOWNWARD0x400 3
207#endif
208
209/* C89 math.h:
210
211 acos asin atan atan2 ceil cos cosh exp fabs floor fmod frexp ldexp
212 log log10 modf pow sin sinh sqrt tan tanh
213
214 * Implemented in core:
215
216 atan2 cos exp log pow sin sqrt
217
218 * C99 math.h added:
219
220 acosh asinh atanh cbrt copysign erf erfc exp2 expm1 fdim fma fmax
221 fmin fpclassify hypot ilogb isfinite isgreater isgreaterequal isinf
222 isless islessequal islessgreater isnan isnormal isunordered lgamma
223 log1p log2 logb lrint lround nan nearbyint nextafter nexttoward remainder
224 remquo rint round scalbn signbit tgamma trunc
225
226 See:
227 http://pubs.opengroup.org/onlinepubs/009695399/basedefs/math.h.html
228
229 * Berkeley/SVID extensions:
230
231 j0 j1 jn y0 y1 yn
232
233 * Configure already (5.21.5) scans for:
234
235 copysign*l* fpclassify isfinite isinf isnan isnan*l* ilogb*l* signbit scalbn*l*
236
237 * For floating-point round mode (which matters for e.g. lrint and rint)
238
239 fegetround fesetround
240
241*/
242
243/* XXX Constant FP_FAST_FMA (if true, FMA is faster) */
244
245/* XXX Add ldiv(), lldiv()? It's C99, but from stdlib.h, not math.h */
246
247/* XXX Beware old gamma() -- one cannot know whether that is the
248 * gamma or the log of gamma, that's why the new tgamma and lgamma.
249 * Though also remember lgamma_r. */
250
251/* Certain AIX releases have the C99 math, but not in long double.
252 * The <math.h> has them, e.g. __expl128, but no library has them!
253 *
254 * Also see the comments in hints/aix.sh about long doubles. */
255
256#if defined(USE_QUADMATH) && defined(I_QUADMATH)
257# define c99_acoshacosh acoshq
258# define c99_asinhasinh asinhq
259# define c99_atanhatanh atanhq
260# define c99_cbrtcbrt cbrtq
261# define c99_copysigncopysign copysignq
262# define c99_erferf erfq
263# define c99_erfcerfc erfcq
264/* no exp2q */
265# define c99_expm1expm1 expm1q
266# define c99_fdimfdim fdimq
267# define c99_fmafma fmaq
268# define c99_fmaxfmax fmaxq
269# define c99_fminfmin fminq
270# define c99_hypothypot hypotq
271# define c99_ilogbilogb ilogbq
272# define c99_lgammalgamma lgammaq
273# define c99_log1plog1p log1pq
274# define c99_log2log2 log2q
275/* no logbq */
276# if defined(USE_64_BIT_INT) && QUADKIND2 == QUAD_IS_LONG_LONG3
277# define c99_lrintlrint llrintq
278# define c99_lroundlround llroundq
279# else
280# define c99_lrintlrint lrintq
281# define c99_lroundlround lroundq
282# endif
283# define c99_nannan nanq
284# define c99_nearbyintnearbyint nearbyintq
285# define c99_nextafternextafter nextafterq
286/* no nexttowardq */
287# define c99_remainderremainder remainderq
288# define c99_remquoremquo remquoq
289# define c99_rintrint rintq
290# define c99_roundround roundq
291# define c99_scalbnscalbn scalbnq
292# define c99_signbitsignbit signbitq
293# define c99_tgammatgamma tgammaq
294# define c99_trunctrunc truncq
295# define bessel_j0j0 j0q
296# define bessel_j1j1 j1q
297# define bessel_jnjn jnq
298# define bessel_y0y0 y0q
299# define bessel_y1y1 y1q
300# define bessel_ynyn ynq
301#elif defined(USE_LONG_DOUBLE) && \
302 (defined(HAS_FREXPL) || defined(HAS_ILOGBL)) && defined(HAS_SQRTL)
303/* Use some of the Configure scans for long double math functions
304 * as the canary for all the C99 *l variants being defined. */
305# define c99_acoshacosh acoshl
306# define c99_asinhasinh asinhl
307# define c99_atanhatanh atanhl
308# define c99_cbrtcbrt cbrtl
309# define c99_copysigncopysign copysignl
310# define c99_erferf erfl
311# define c99_erfcerfc erfcl
312# define c99_exp2exp2 exp2l
313# define c99_expm1expm1 expm1l
314# define c99_fdimfdim fdiml
315# define c99_fmafma fmal
316# define c99_fmaxfmax fmaxl
317# define c99_fminfmin fminl
318# define c99_hypothypot hypotl
319# define c99_ilogbilogb ilogbl
320# define c99_lgammalgamma lgammal
321# define c99_log1plog1p log1pl
322# define c99_log2log2 log2l
323# define c99_logblogb logbl
324# if defined(USE_64_BIT_INT) && QUADKIND2 == QUAD_IS_LONG_LONG3 && defined(HAS_LLRINTL)
325# define c99_lrintlrint llrintl
326# elif defined(HAS_LRINTL)
327# define c99_lrintlrint lrintl
328# endif
329# if defined(USE_64_BIT_INT) && QUADKIND2 == QUAD_IS_LONG_LONG3 && defined(HAS_LLROUNDL)
330# define c99_lroundlround llroundl
331# elif defined(HAS_LROUNDL)
332# define c99_lroundlround lroundl
333# endif
334# define c99_nannan nanl
335# define c99_nearbyintnearbyint nearbyintl
336# define c99_nextafternextafter nextafterl
337# define c99_nexttowardnexttoward nexttowardl
338# define c99_remainderremainder remainderl
339# define c99_remquoremquo remquol
340# define c99_rintrint rintl
341# define c99_roundround roundl
342# define c99_scalbnscalbn scalbnl
343# ifdef HAS_SIGNBIT /* possibly bad assumption */
344# define c99_signbitsignbit signbitl
345# endif
346# define c99_tgammatgamma tgammal
347# define c99_trunctrunc truncl
348#else
349# define c99_acoshacosh acosh
350# define c99_asinhasinh asinh
351# define c99_atanhatanh atanh
352# define c99_cbrtcbrt cbrt
353# define c99_copysigncopysign copysign
354# define c99_erferf erf
355# define c99_erfcerfc erfc
356# define c99_exp2exp2 exp2
357# define c99_expm1expm1 expm1
358# define c99_fdimfdim fdim
359# define c99_fmafma fma
360# define c99_fmaxfmax fmax
361# define c99_fminfmin fmin
362# define c99_hypothypot hypot
363# define c99_ilogbilogb ilogb
364# define c99_lgammalgamma lgamma
365# define c99_log1plog1p log1p
366# define c99_log2log2 log2
367# define c99_logblogb logb
368# if defined(USE_64_BIT_INT) && QUADKIND2 == QUAD_IS_LONG_LONG3 && defined(HAS_LLRINT)
369# define c99_lrintlrint llrint
370# else
371# define c99_lrintlrint lrint
372# endif
373# if defined(USE_64_BIT_INT) && QUADKIND2 == QUAD_IS_LONG_LONG3 && defined(HAS_LLROUND)
374# define c99_lroundlround llround
375# else
376# define c99_lroundlround lround
377# endif
378# define c99_nannan nan
379# define c99_nearbyintnearbyint nearbyint
380# define c99_nextafternextafter nextafter
381# define c99_nexttowardnexttoward nexttoward
382# define c99_remainderremainder remainder
383# define c99_remquoremquo remquo
384# define c99_rintrint rint
385# define c99_roundround round
386# define c99_scalbnscalbn scalbn
387/* We already define Perl_signbit in perl.h. */
388# ifdef HAS_SIGNBIT
389# define c99_signbitsignbit signbit
390# endif
391# define c99_tgammatgamma tgamma
392# define c99_trunctrunc trunc
393#endif
394
395/* AIX xlc (__IBMC__) really doesn't have the following long double
396 * math interfaces (no __acoshl128 aka acoshl, etc.), see
397 * hints/aix.sh. These are in the -lc128 but fail to be found
398 * during dynamic linking/loading.
399 *
400 * XXX1 Better Configure scans
401 * XXX2 Is this xlc version dependent? */
402#if defined(USE_LONG_DOUBLE) && defined(__IBMC__)
403# undef c99_acoshacosh
404# undef c99_asinhasinh
405# undef c99_atanhatanh
406# undef c99_cbrtcbrt
407# undef c99_copysigncopysign
408# undef c99_exp2exp2
409# undef c99_expm1expm1
410# undef c99_fdimfdim
411# undef c99_fmafma
412# undef c99_fmaxfmax
413# undef c99_fminfmin
414# undef c99_hypothypot
415# undef c99_ilogbilogb
416# undef c99_lrintlrint
417# undef c99_lroundlround
418# undef c99_log1plog1p
419# undef c99_log2log2
420# undef c99_logblogb
421# undef c99_nannan
422# undef c99_nearbyintnearbyint
423# undef c99_nextafternextafter
424# undef c99_nexttowardnexttoward
425# undef c99_remainderremainder
426# undef c99_remquoremquo
427# undef c99_rintrint
428# undef c99_roundround
429# undef c99_scalbnscalbn
430# undef c99_tgammatgamma
431# undef c99_trunctrunc
432#endif
433
434#ifndef isunordered
435# ifdef Perl_isnan
436# define isunordered(x, y)(((sizeof (x) == sizeof (float)) ? __isnanf(x) : (sizeof (x) ==
sizeof (double)) ? __isnan(x) : __isnanl(x)) || ((sizeof (y)
== sizeof (float)) ? __isnanf(y) : (sizeof (y) == sizeof (double
)) ? __isnan(y) : __isnanl(y)))
(Perl_isnan(x)((sizeof (x) == sizeof (float)) ? __isnanf(x) : (sizeof (x) ==
sizeof (double)) ? __isnan(x) : __isnanl(x))
|| Perl_isnan(y)((sizeof (y) == sizeof (float)) ? __isnanf(y) : (sizeof (y) ==
sizeof (double)) ? __isnan(y) : __isnanl(y))
)
437# elif defined(HAS_UNORDERED)
438# define isunordered(x, y)(((sizeof (x) == sizeof (float)) ? __isnanf(x) : (sizeof (x) ==
sizeof (double)) ? __isnan(x) : __isnanl(x)) || ((sizeof (y)
== sizeof (float)) ? __isnanf(y) : (sizeof (y) == sizeof (double
)) ? __isnan(y) : __isnanl(y)))
unordered(x, y)
439# endif
440#endif
441
442/* XXX these isgreater/isnormal/isunordered macros definitions should
443 * be moved further in the file to be part of the emulations, so that
444 * platforms can e.g. #undef c99_isunordered and have it work like
445 * it does for the other interfaces. */
446
447#if !defined(isgreater) && defined(isunordered)
448# define isgreater(x, y)(!(((sizeof ((x)) == sizeof (float)) ? __isnanf((x)) : (sizeof
((x)) == sizeof (double)) ? __isnan((x)) : __isnanl((x))) ||
((sizeof ((y)) == sizeof (float)) ? __isnanf((y)) : (sizeof (
(y)) == sizeof (double)) ? __isnan((y)) : __isnanl((y)))) &&
(x) > (y))
(!isunordered((x), (y))(((sizeof ((x)) == sizeof (float)) ? __isnanf((x)) : (sizeof (
(x)) == sizeof (double)) ? __isnan((x)) : __isnanl((x))) || (
(sizeof ((y)) == sizeof (float)) ? __isnanf((y)) : (sizeof ((
y)) == sizeof (double)) ? __isnan((y)) : __isnanl((y))))
&& (x) > (y))
449# define isgreaterequal(x, y)(!(((sizeof ((x)) == sizeof (float)) ? __isnanf((x)) : (sizeof
((x)) == sizeof (double)) ? __isnan((x)) : __isnanl((x))) ||
((sizeof ((y)) == sizeof (float)) ? __isnanf((y)) : (sizeof (
(y)) == sizeof (double)) ? __isnan((y)) : __isnanl((y)))) &&
(x) >= (y))
(!isunordered((x), (y))(((sizeof ((x)) == sizeof (float)) ? __isnanf((x)) : (sizeof (
(x)) == sizeof (double)) ? __isnan((x)) : __isnanl((x))) || (
(sizeof ((y)) == sizeof (float)) ? __isnanf((y)) : (sizeof ((
y)) == sizeof (double)) ? __isnan((y)) : __isnanl((y))))
&& (x) >= (y))
450# define isless(x, y)(!(((sizeof ((x)) == sizeof (float)) ? __isnanf((x)) : (sizeof
((x)) == sizeof (double)) ? __isnan((x)) : __isnanl((x))) ||
((sizeof ((y)) == sizeof (float)) ? __isnanf((y)) : (sizeof (
(y)) == sizeof (double)) ? __isnan((y)) : __isnanl((y)))) &&
(x) < (y))
(!isunordered((x), (y))(((sizeof ((x)) == sizeof (float)) ? __isnanf((x)) : (sizeof (
(x)) == sizeof (double)) ? __isnan((x)) : __isnanl((x))) || (
(sizeof ((y)) == sizeof (float)) ? __isnanf((y)) : (sizeof ((
y)) == sizeof (double)) ? __isnan((y)) : __isnanl((y))))
&& (x) < (y))
451# define islessequal(x, y)(!(((sizeof ((x)) == sizeof (float)) ? __isnanf((x)) : (sizeof
((x)) == sizeof (double)) ? __isnan((x)) : __isnanl((x))) ||
((sizeof ((y)) == sizeof (float)) ? __isnanf((y)) : (sizeof (
(y)) == sizeof (double)) ? __isnan((y)) : __isnanl((y)))) &&
(x) <= (y))
(!isunordered((x), (y))(((sizeof ((x)) == sizeof (float)) ? __isnanf((x)) : (sizeof (
(x)) == sizeof (double)) ? __isnan((x)) : __isnanl((x))) || (
(sizeof ((y)) == sizeof (float)) ? __isnanf((y)) : (sizeof ((
y)) == sizeof (double)) ? __isnan((y)) : __isnanl((y))))
&& (x) <= (y))
452# define islessgreater(x, y)(!(((sizeof ((x)) == sizeof (float)) ? __isnanf((x)) : (sizeof
((x)) == sizeof (double)) ? __isnan((x)) : __isnanl((x))) ||
((sizeof ((y)) == sizeof (float)) ? __isnanf((y)) : (sizeof (
(y)) == sizeof (double)) ? __isnan((y)) : __isnanl((y)))) &&
((x) > (y) || (y) > (x)))
(!isunordered((x), (y))(((sizeof ((x)) == sizeof (float)) ? __isnanf((x)) : (sizeof (
(x)) == sizeof (double)) ? __isnan((x)) : __isnanl((x))) || (
(sizeof ((y)) == sizeof (float)) ? __isnanf((y)) : (sizeof ((
y)) == sizeof (double)) ? __isnan((y)) : __isnanl((y))))
&& \
453 ((x) > (y) || (y) > (x)))
454#endif
455
456/* Check both the Configure symbol and the macro-ness (like C99 promises). */
457#if defined(HAS_FPCLASSIFY) && defined(fpclassify)
458# define c99_fpclassifyfpclassify fpclassify
459#endif
460/* Like isnormal(), the isfinite(), isinf(), and isnan() are also C99
461 and also (sizeof-arg-aware) macros, but they are already well taken
462 care of by Configure et al, and defined in perl.h as
463 Perl_isfinite(), Perl_isinf(), and Perl_isnan(). */
464#ifdef isnormal
465# define c99_isnormalisnormal isnormal
466#endif
467#ifdef isgreater /* canary for all the C99 is*<cmp>* macros. */
468# define c99_isgreaterisgreater isgreater
469# define c99_isgreaterequalisgreaterequal isgreaterequal
470# define c99_islessisless isless
471# define c99_islessequalislessequal islessequal
472# define c99_islessgreaterislessgreater islessgreater
473# define c99_isunorderedisunordered isunordered
474#endif
475
476/* The Great Wall of Undef where according to the definedness of HAS_FOO symbols
477 * the corresponding c99_foo wrappers are undefined. This list doesn't include
478 * the isfoo() interfaces because they are either type-aware macros, or dealt
479 * separately, already in perl.h */
480
481#ifndef HAS_ACOSH
482# undef c99_acoshacosh
483#endif
484#ifndef HAS_ASINH
485# undef c99_asinhasinh
486#endif
487#ifndef HAS_ATANH
488# undef c99_atanhatanh
489#endif
490#ifndef HAS_CBRT
491# undef c99_cbrtcbrt
492#endif
493#ifndef HAS_COPYSIGN
494# undef c99_copysigncopysign
495#endif
496#ifndef HAS_ERF
497# undef c99_erferf
498#endif
499#ifndef HAS_ERFC
500# undef c99_erfcerfc
501#endif
502#ifndef HAS_EXP2
503# undef c99_exp2exp2
504#endif
505#ifndef HAS_EXPM1
506# undef c99_expm1expm1
507#endif
508#ifndef HAS_FDIM
509# undef c99_fdimfdim
510#endif
511#ifndef HAS_FMA
512# undef c99_fmafma
513#endif
514#ifndef HAS_FMAX
515# undef c99_fmaxfmax
516#endif
517#ifndef HAS_FMIN
518# undef c99_fminfmin
519#endif
520#ifndef HAS_FPCLASSIFY
521# undef c99_fpclassifyfpclassify
522#endif
523#ifndef HAS_HYPOT
524# undef c99_hypothypot
525#endif
526#ifndef HAS_ILOGB
527# undef c99_ilogbilogb
528#endif
529#ifndef HAS_LGAMMA
530# undef c99_lgammalgamma
531#endif
532#ifndef HAS_LOG1P
533# undef c99_log1plog1p
534#endif
535#ifndef HAS_LOG2
536# undef c99_log2log2
537#endif
538#ifndef HAS_LOGB
539# undef c99_logblogb
540#endif
541#ifndef HAS_LRINT
542# undef c99_lrintlrint
543#endif
544#ifndef HAS_LROUND
545# undef c99_lroundlround
546#endif
547#ifndef HAS_NAN
548# undef c99_nannan
549#endif
550#ifndef HAS_NEARBYINT
551# undef c99_nearbyintnearbyint
552#endif
553#ifndef HAS_NEXTAFTER
554# undef c99_nextafternextafter
555#endif
556#ifndef HAS_NEXTTOWARD
557# undef c99_nexttowardnexttoward
558#endif
559#ifndef HAS_REMAINDER
560# undef c99_remainderremainder
561#endif
562#ifndef HAS_REMQUO
563# undef c99_remquoremquo
564#endif
565#ifndef HAS_RINT
566# undef c99_rintrint
567#endif
568#ifndef HAS_ROUND
569# undef c99_roundround
570#endif
571#ifndef HAS_SCALBN
572# undef c99_scalbnscalbn
573#endif
574#ifndef HAS_SIGNBIT
575# undef c99_signbitsignbit
576#endif
577#ifndef HAS_TGAMMA
578# undef c99_tgammatgamma
579#endif
580#ifndef HAS_TRUNC
581# undef c99_trunctrunc
582#endif
583
584#ifdef _MSC_VER
585
586/* Some APIs exist under Win32 with "underbar" names. */
587# undef c99_hypothypot
588# undef c99_logblogb
589# undef c99_nextafternextafter
590# define c99_hypothypot _hypot
591# define c99_logblogb _logb
592# define c99_nextafternextafter _nextafter
593
594# define bessel_j0j0 _j0
595# define bessel_j1j1 _j1
596# define bessel_jnjn _jn
597# define bessel_y0y0 _y0
598# define bessel_y1y1 _y1
599# define bessel_ynyn _yn
600
601#endif
602
603/* The Bessel functions: BSD, SVID, XPG4, and POSIX. But not C99. */
604#if defined(HAS_J0) && !defined(bessel_j0j0)
605# if defined(USE_LONG_DOUBLE) && defined(HAS_J0L)
606# define bessel_j0j0 j0l
607# define bessel_j1j1 j1l
608# define bessel_jnjn jnl
609# define bessel_y0y0 y0l
610# define bessel_y1y1 y1l
611# define bessel_ynyn ynl
612# else
613# define bessel_j0j0 j0
614# define bessel_j1j1 j1
615# define bessel_jnjn jn
616# define bessel_y0y0 y0
617# define bessel_y1y1 y1
618# define bessel_ynyn yn
619# endif
620#endif
621
622/* Emulations for missing math APIs.
623 *
624 * Keep in mind that the point of many of these functions is that
625 * they, if available, are supposed to give more precise/more
626 * numerically stable results.
627 *
628 * See e.g. http://www.johndcook.com/math_h.html
629 */
630
631#ifndef c99_acoshacosh
632static NV my_acosh(NV x)
633{
634 return Perl_loglog(x + Perl_sqrtsqrt(x * x - 1));
635}
636# define c99_acoshacosh my_acosh
637#endif
638
639#ifndef c99_asinhasinh
640static NV my_asinh(NV x)
641{
642 return Perl_loglog(x + Perl_sqrtsqrt(x * x + 1));
643}
644# define c99_asinhasinh my_asinh
645#endif
646
647#ifndef c99_atanhatanh
648static NV my_atanh(NV x)
649{
650 return (Perl_loglog(1 + x) - Perl_loglog(1 - x)) / 2;
651}
652# define c99_atanhatanh my_atanh
653#endif
654
655#ifndef c99_cbrtcbrt
656static NV my_cbrt(NV x)
657{
658 static const NV one_third = (NV)1.0/3;
659 return x >= 0.0 ? Perl_powpow(x, one_third) : -Perl_powpow(-x, one_third);
660}
661# define c99_cbrtcbrt my_cbrt
662#endif
663
664#ifndef c99_copysigncopysign
665static NV my_copysign(NV x, NV y)
666{
667 return y >= 0 ? (x < 0 ? -x : x) : (x < 0 ? x : -x);
668}
669# define c99_copysigncopysign my_copysign
670#endif
671
672/* XXX cosh (though c89) */
673
674#ifndef c99_erferf
675static NV my_erf(NV x)
676{
677 /* http://www.johndcook.com/cpp_erf.html -- public domain */
678 NV a1 = 0.254829592;
679 NV a2 = -0.284496736;
680 NV a3 = 1.421413741;
681 NV a4 = -1.453152027;
682 NV a5 = 1.061405429;
683 NV p = 0.3275911;
684 NV t, y;
685 int sign = x < 0 ? -1 : 1; /* Save the sign. */
686 x = PERL_ABS(x)((x) < 0 ? -(x) : (x));
687
688 /* Abramowitz and Stegun formula 7.1.26 */
689 t = 1.0 / (1.0 + p * x);
690 y = 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1) * t * Perl_expexp(-x*x);
691
692 return sign * y;
693}
694# define c99_erferf my_erf
695#endif
696
697#ifndef c99_erfcerfc
698static NV my_erfc(NV x) {
699 /* This is not necessarily numerically stable, but better than nothing. */
700 return 1.0 - c99_erferf(x);
701}
702# define c99_erfcerfc my_erfc
703#endif
704
705#ifndef c99_exp2exp2
706static NV my_exp2(NV x)
707{
708 return Perl_powpow((NV)2.0, x);
709}
710# define c99_exp2exp2 my_exp2
711#endif
712
713#ifndef c99_expm1expm1
714static NV my_expm1(NV x)
715{
716 if (PERL_ABS(x)((x) < 0 ? -(x) : (x)) < 1e-5)
717 /* http://www.johndcook.com/cpp_expm1.html -- public domain.
718 * Taylor series, the first four terms (the last term quartic). */
719 /* Probably not enough for long doubles. */
720 return x * (1.0 + x * (1/2.0 + x * (1/6.0 + x/24.0)));
721 else
722 return Perl_expexp(x) - 1;
723}
724# define c99_expm1expm1 my_expm1
725#endif
726
727#ifndef c99_fdimfdim
728static NV my_fdim(NV x, NV y)
729{
730#ifdef NV_NANPL_nan.nv
731 return (Perl_isnan(x)((sizeof (x) == sizeof (float)) ? __isnanf(x) : (sizeof (x) ==
sizeof (double)) ? __isnan(x) : __isnanl(x))
|| Perl_isnan(y)((sizeof (y) == sizeof (float)) ? __isnanf(y) : (sizeof (y) ==
sizeof (double)) ? __isnan(y) : __isnanl(y))
) ? NV_NANPL_nan.nv : (x > y ? x - y : 0);
732#else
733 return (x > y ? x - y : 0);
734#endif
735}
736# define c99_fdimfdim my_fdim
737#endif
738
739#ifndef c99_fmafma
740static NV my_fma(NV x, NV y, NV z)
741{
742 return (x * y) + z;
743}
744# define c99_fmafma my_fma
745#endif
746
747#ifndef c99_fmaxfmax
748static NV my_fmax(NV x, NV y)
749{
750#ifdef NV_NANPL_nan.nv
751 if (Perl_isnan(x)((sizeof (x) == sizeof (float)) ? __isnanf(x) : (sizeof (x) ==
sizeof (double)) ? __isnan(x) : __isnanl(x))
) {
752 return Perl_isnan(y)((sizeof (y) == sizeof (float)) ? __isnanf(y) : (sizeof (y) ==
sizeof (double)) ? __isnan(y) : __isnanl(y))
? NV_NANPL_nan.nv : y;
753 } else if (Perl_isnan(y)((sizeof (y) == sizeof (float)) ? __isnanf(y) : (sizeof (y) ==
sizeof (double)) ? __isnan(y) : __isnanl(y))
) {
754 return x;
755 }
756#endif
757 return x > y ? x : y;
758}
759# define c99_fmaxfmax my_fmax
760#endif
761
762#ifndef c99_fminfmin
763static NV my_fmin(NV x, NV y)
764{
765#ifdef NV_NANPL_nan.nv
766 if (Perl_isnan(x)((sizeof (x) == sizeof (float)) ? __isnanf(x) : (sizeof (x) ==
sizeof (double)) ? __isnan(x) : __isnanl(x))
) {
767 return Perl_isnan(y)((sizeof (y) == sizeof (float)) ? __isnanf(y) : (sizeof (y) ==
sizeof (double)) ? __isnan(y) : __isnanl(y))
? NV_NANPL_nan.nv : y;
768 } else if (Perl_isnan(y)((sizeof (y) == sizeof (float)) ? __isnanf(y) : (sizeof (y) ==
sizeof (double)) ? __isnan(y) : __isnanl(y))
) {
769 return x;
770 }
771#endif
772 return x < y ? x : y;
773}
774# define c99_fminfmin my_fmin
775#endif
776
777#ifndef c99_fpclassifyfpclassify
778
779static IV my_fpclassify(NV x)
780{
781#ifdef Perl_fp_class_inf
782 if (Perl_fp_class_inf(x)(((sizeof (x) == sizeof (float)) ? __fpclassifyf(x) : (sizeof
(x) == sizeof (double)) ? __fpclassify(x) : __fpclassifyl(x)
)==0x01)
) return FP_INFINITE0x01;
783 if (Perl_fp_class_nan(x)(((sizeof (x) == sizeof (float)) ? __fpclassifyf(x) : (sizeof
(x) == sizeof (double)) ? __fpclassify(x) : __fpclassifyl(x)
)==0x02)
) return FP_NAN0x02;
784 if (Perl_fp_class_norm(x)(((sizeof (x) == sizeof (float)) ? __fpclassifyf(x) : (sizeof
(x) == sizeof (double)) ? __fpclassify(x) : __fpclassifyl(x)
)==0x04)
) return FP_NORMAL0x04;
785 if (Perl_fp_class_denorm(x)(((sizeof (x) == sizeof (float)) ? __fpclassifyf(x) : (sizeof
(x) == sizeof (double)) ? __fpclassify(x) : __fpclassifyl(x)
)==0x08)
) return FP_SUBNORMAL0x08;
786 if (Perl_fp_class_zero(x)(((sizeof (x) == sizeof (float)) ? __fpclassifyf(x) : (sizeof
(x) == sizeof (double)) ? __fpclassify(x) : __fpclassifyl(x)
)==0x10)
) return FP_ZERO0x10;
787# define c99_fpclassifyfpclassify my_fpclassify
788#endif
789 return -1;
790}
791
792#endif
793
794#ifndef c99_hypothypot
795static NV my_hypot(NV x, NV y)
796{
797 /* http://en.wikipedia.org/wiki/Hypot */
798 NV t;
799 x = PERL_ABS(x)((x) < 0 ? -(x) : (x)); /* Take absolute values. */
800 if (y == 0)
801 return x;
802#ifdef NV_INFPL_inf.nv
803 if (Perl_isnan(y)((sizeof (y) == sizeof (float)) ? __isnanf(y) : (sizeof (y) ==
sizeof (double)) ? __isnan(y) : __isnanl(y))
)
804 return NV_INFPL_inf.nv;
805#endif
806 y = PERL_ABS(y)((y) < 0 ? -(y) : (y));
807 if (x < y) { /* Swap so that y is less. */
808 t = x;
809 x = y;
810 y = t;
811 }
812 t = y / x;
813 return x * Perl_sqrtsqrt(1.0 + t * t);
814}
815# define c99_hypothypot my_hypot
816#endif
817
818#ifndef c99_ilogbilogb
819static IV my_ilogb(NV x)
820{
821 return (IV)(Perl_loglog(x) * M_LOG2E((double)1.4426950408889634074));
822}
823# define c99_ilogbilogb my_ilogb
824#endif
825
826/* tgamma and lgamma emulations based on
827 * http://www.johndcook.com/cpp_gamma.html,
828 * code placed in public domain.
829 *
830 * Note that these implementations (neither the johndcook originals
831 * nor these) do NOT set the global signgam variable. This is not
832 * necessarily a bad thing. */
833
834/* Note that the tgamma() and lgamma() implementations
835 * here depend on each other. */
836
837#if !defined(HAS_TGAMMA) || !defined(c99_tgammatgamma)
838static NV my_tgamma(NV x);
839# define c99_tgammatgamma my_tgamma
840# define USE_MY_TGAMMA
841#endif
842#if !defined(HAS_LGAMMA) || !defined(c99_lgammalgamma)
843static NV my_lgamma(NV x);
844# define c99_lgammalgamma my_lgamma
845# define USE_MY_LGAMMA
846#endif
847
848#ifdef USE_MY_TGAMMA
849static NV my_tgamma(NV x)
850{
851 const NV gamma = 0.577215664901532860606512090; /* Euler's gamma constant. */
852#ifdef NV_NANPL_nan.nv
853 if (Perl_isnan(x)((sizeof (x) == sizeof (float)) ? __isnanf(x) : (sizeof (x) ==
sizeof (double)) ? __isnan(x) : __isnanl(x))
|| x < 0.0)
854 return NV_NANPL_nan.nv;
855#endif
856#ifdef NV_INFPL_inf.nv
857 if (x == 0.0 || x == NV_INFPL_inf.nv)
858#ifdef DOUBLE_IS_IEEE_FORMAT
859 return x == -0.0 ? -NV_INFPL_inf.nv : NV_INFPL_inf.nv;
860#else
861 return NV_INFPL_inf.nv;
862#endif
863#endif
864
865 /* The function domain is split into three intervals:
866 * (0, 0.001), [0.001, 12), and (12, infinity) */
867
868 /* First interval: (0, 0.001)
869 * For small values, 1/tgamma(x) has power series x + gamma x^2,
870 * so in this range, 1/tgamma(x) = x + gamma x^2 with error on the order of x^3.
871 * The relative error over this interval is less than 6e-7. */
872 if (x < 0.001)
873 return 1.0 / (x * (1.0 + gamma * x));
874
875 /* Second interval: [0.001, 12) */
876 if (x < 12.0) {
877 double y = x; /* Working copy. */
878 int n = 0;
879 /* Numerator coefficients for approximation over the interval (1,2) */
880 static const NV p[] = {
881 -1.71618513886549492533811E+0,
882 2.47656508055759199108314E+1,
883 -3.79804256470945635097577E+2,
884 6.29331155312818442661052E+2,
885 8.66966202790413211295064E+2,
886 -3.14512729688483675254357E+4,
887 -3.61444134186911729807069E+4,
888 6.64561438202405440627855E+4
889 };
890 /* Denominator coefficients for approximation over the interval (1, 2) */
891 static const NV q[] = {
892 -3.08402300119738975254353E+1,
893 3.15350626979604161529144E+2,
894 -1.01515636749021914166146E+3,
895 -3.10777167157231109440444E+3,
896 2.25381184209801510330112E+4,
897 4.75584627752788110767815E+3,
898 -1.34659959864969306392456E+5,
899 -1.15132259675553483497211E+5
900 };
901 NV num = 0.0;
902 NV den = 1.0;
903 NV z;
904 NV result;
905 int i;
906
907 if (x < 1.0)
908 y += 1.0;
909 else {
910 n = (int)Perl_floorfloor(y) - 1;
911 y -= n;
912 }
913 z = y - 1;
914 for (i = 0; i < 8; i++) {
915 num = (num + p[i]) * z;
916 den = den * z + q[i];
917 }
918 result = num / den + 1.0;
919
920 if (x < 1.0) {
921 /* Use the identity tgamma(z) = tgamma(z+1)/z
922 * The variable "result" now holds tgamma of the original y + 1
923 * Thus we use y - 1 to get back the original y. */
924 result /= (y - 1.0);
925 }
926 else {
927 /* Use the identity tgamma(z+n) = z*(z+1)* ... *(z+n-1)*tgamma(z) */
928 for (i = 0; i < n; i++)
929 result *= y++;
930 }
931
932 return result;
933 }
934
935#ifdef NV_INFPL_inf.nv
936 /* Third interval: [12, +Inf) */
937#if LDBL_MANT_DIG64 == 113 /* IEEE quad prec */
938 if (x > 1755.548) {
939 return NV_INFPL_inf.nv;
940 }
941#else
942 if (x > 171.624) {
943 return NV_INFPL_inf.nv;
944 }
945#endif
946#endif
947
948 return Perl_expexp(c99_lgammalgamma(x));
949}
950#endif
951
952#ifdef USE_MY_LGAMMA
953static NV my_lgamma(NV x)
954{
955#ifdef NV_NANPL_nan.nv
956 if (Perl_isnan(x)((sizeof (x) == sizeof (float)) ? __isnanf(x) : (sizeof (x) ==
sizeof (double)) ? __isnan(x) : __isnanl(x))
)
957 return NV_NANPL_nan.nv;
958#endif
959#ifdef NV_INFPL_inf.nv
960 if (x <= 0 || x == NV_INFPL_inf.nv)
961 return NV_INFPL_inf.nv;
962#endif
963 if (x == 1.0 || x == 2.0)
964 return 0;
965 if (x < 12.0)
966 return Perl_loglog(PERL_ABS(c99_tgamma(x))((tgamma(x)) < 0 ? -(tgamma(x)) : (tgamma(x))));
967 /* Abramowitz and Stegun 6.1.41
968 * Asymptotic series should be good to at least 11 or 12 figures
969 * For error analysis, see Whittiker and Watson
970 * A Course in Modern Analysis (1927), page 252 */
971 {
972 static const NV c[8] = {
973 1.0/12.0,
974 -1.0/360.0,
975 1.0/1260.0,
976 -1.0/1680.0,
977 1.0/1188.0,
978 -691.0/360360.0,
979 1.0/156.0,
980 -3617.0/122400.0
981 };
982 NV z = 1.0 / (x * x);
983 NV sum = c[7];
984 static const NV half_log_of_two_pi =
985 0.91893853320467274178032973640562;
986 NV series;
987 int i;
988 for (i = 6; i >= 0; i--) {
989 sum *= z;
990 sum += c[i];
991 }
992 series = sum / x;
993 return (x - 0.5) * Perl_loglog(x) - x + half_log_of_two_pi + series;
994 }
995}
996#endif
997
998#ifndef c99_log1plog1p
999static NV my_log1p(NV x)
1000{
1001 /* http://www.johndcook.com/cpp_log_one_plus_x.html -- public domain.
1002 * Taylor series, the first four terms (the last term quartic). */
1003#ifdef NV_NANPL_nan.nv
1004 if (x < -1.0)
1005 return NV_NANPL_nan.nv;
1006#endif
1007#ifdef NV_INFPL_inf.nv
1008 if (x == -1.0)
1009 return -NV_INFPL_inf.nv;
1010#endif
1011 if (PERL_ABS(x)((x) < 0 ? -(x) : (x)) > 1e-4)
1012 return Perl_loglog(1.0 + x);
1013 else
1014 /* Probably not enough for long doubles. */
1015 return x * (1.0 + x * (-1/2.0 + x * (1/3.0 - x/4.0)));
1016}
1017# define c99_log1plog1p my_log1p
1018#endif
1019
1020#ifndef c99_log2log2
1021static NV my_log2(NV x)
1022{
1023 return Perl_loglog(x) * M_LOG2E((double)1.4426950408889634074);
1024}
1025# define c99_log2log2 my_log2
1026#endif
1027
1028/* XXX nextafter */
1029
1030/* XXX nexttoward */
1031
1032static int my_fegetround()
1033{
1034#ifdef HAS_FEGETROUND
1035 return fegetround();
1036#elif defined(HAS_FPGETROUND)
1037 switch (fpgetround()) {
1038 case FP_RN: return FE_TONEAREST0x000;
1039 case FP_RZ: return FE_TOWARDZERO0xc00;
1040 case FP_RM: return FE_DOWNWARD0x400;
1041 case FP_RP: return FE_UPWARD0x800;
1042 default: return -1;
1043 }
1044#elif defined(FLT_ROUNDS(__builtin_flt_rounds()))
1045 switch (FLT_ROUNDS(__builtin_flt_rounds())) {
1046 case 0: return FE_TOWARDZERO0xc00;
1047 case 1: return FE_TONEAREST0x000;
1048 case 2: return FE_UPWARD0x800;
1049 case 3: return FE_DOWNWARD0x400;
1050 default: return -1;
1051 }
1052#elif defined(__osf__) /* Tru64 */
1053 switch (read_rnd()) {
1054 case FP_RND_RN: return FE_TONEAREST0x000;
1055 case FP_RND_RZ: return FE_TOWARDZERO0xc00;
1056 case FP_RND_RM: return FE_DOWNWARD0x400;
1057 case FP_RND_RP: return FE_UPWARD0x800;
1058 default: return -1;
1059 }
1060#else
1061 return -1;
1062#endif
1063}
1064
1065/* Toward closest integer. */
1066#define MY_ROUND_NEAREST(x)((NV)((IV)((x) >= 0.0 ? (x) + 0.5 : (x) - 0.5))) ((NV)((IV)((x) >= 0.0 ? (x) + 0.5 : (x) - 0.5)))
1067
1068/* Toward zero. */
1069#define MY_ROUND_TRUNC(x)((NV)((IV)(x))) ((NV)((IV)(x)))
1070
1071/* Toward minus infinity. */
1072#define MY_ROUND_DOWN(x)((NV)((IV)((x) >= 0.0 ? (x) : (x) - 0.5))) ((NV)((IV)((x) >= 0.0 ? (x) : (x) - 0.5)))
1073
1074/* Toward plus infinity. */
1075#define MY_ROUND_UP(x)((NV)((IV)((x) >= 0.0 ? (x) + 0.5 : (x)))) ((NV)((IV)((x) >= 0.0 ? (x) + 0.5 : (x))))
1076
1077#if (!defined(c99_nearbyintnearbyint) || !defined(c99_lrintlrint)) && defined(FE_TONEAREST0x000)
1078static NV my_rint(NV x)
1079{
1080#ifdef FE_TONEAREST0x000
1081 switch (my_fegetround()) {
1082 case FE_TONEAREST0x000: return MY_ROUND_NEAREST(x)((NV)((IV)((x) >= 0.0 ? (x) + 0.5 : (x) - 0.5)));
1083 case FE_TOWARDZERO0xc00: return MY_ROUND_TRUNC(x)((NV)((IV)(x)));
1084 case FE_DOWNWARD0x400: return MY_ROUND_DOWN(x)((NV)((IV)((x) >= 0.0 ? (x) : (x) - 0.5)));
1085 case FE_UPWARD0x800: return MY_ROUND_UP(x)((NV)((IV)((x) >= 0.0 ? (x) + 0.5 : (x))));
1086 default: break;
1087 }
1088#elif defined(HAS_FPGETROUND)
1089 switch (fpgetround()) {
1090 case FP_RN: return MY_ROUND_NEAREST(x)((NV)((IV)((x) >= 0.0 ? (x) + 0.5 : (x) - 0.5)));
1091 case FP_RZ: return MY_ROUND_TRUNC(x)((NV)((IV)(x)));
1092 case FP_RM: return MY_ROUND_DOWN(x)((NV)((IV)((x) >= 0.0 ? (x) : (x) - 0.5)));
1093 case FE_RP: return MY_ROUND_UP(x)((NV)((IV)((x) >= 0.0 ? (x) + 0.5 : (x))));
1094 default: break;
1095 }
1096#endif
1097 not_here("rint");
1098 NOT_REACHED((!"UNREACHABLE") ? (void) 0 : __builtin_unreachable()); /* NOTREACHED */
1099}
1100#endif
1101
1102/* XXX nearbyint() and rint() are not really identical -- but the difference
1103 * is messy: nearbyint is defined NOT to raise FE_INEXACT floating point
1104 * exceptions, while rint() is defined to MAYBE raise them. At the moment
1105 * Perl is blissfully unaware of such fine detail of floating point. */
1106#ifndef c99_nearbyintnearbyint
1107# ifdef FE_TONEAREST0x000
1108# define c99_nearbyrint my_rint
1109# endif
1110#endif
1111
1112#ifndef c99_lrintlrint
1113# ifdef FE_TONEAREST0x000
1114static IV my_lrint(NV x)
1115{
1116 return (IV)my_rint(x);
1117}
1118# define c99_lrintlrint my_lrint
1119# endif
1120#endif
1121
1122#ifndef c99_lroundlround
1123static IV my_lround(NV x)
1124{
1125 return (IV)MY_ROUND_NEAREST(x)((NV)((IV)((x) >= 0.0 ? (x) + 0.5 : (x) - 0.5)));
1126}
1127# define c99_lroundlround my_lround
1128#endif
1129
1130/* XXX remainder */
1131
1132/* XXX remquo */
1133
1134#ifndef c99_rintrint
1135# ifdef FE_TONEAREST0x000
1136# define c99_rintrint my_rint
1137# endif
1138#endif
1139
1140#ifndef c99_roundround
1141static NV my_round(NV x)
1142{
1143 return MY_ROUND_NEAREST(x)((NV)((IV)((x) >= 0.0 ? (x) + 0.5 : (x) - 0.5)));
1144}
1145# define c99_roundround my_round
1146#endif
1147
1148#ifndef c99_scalbnscalbn
1149# if defined(Perl_ldexp) && FLT_RADIX2 == 2
1150static NV my_scalbn(NV x, int y)
1151{
1152 return Perl_ldexp(x, y)ldexp(x,y);
1153}
1154# define c99_scalbnscalbn my_scalbn
1155# endif
1156#endif
1157
1158/* XXX sinh (though c89) */
1159
1160/* tgamma -- see lgamma */
1161
1162/* XXX tanh (though c89) */
1163
1164#ifndef c99_trunctrunc
1165static NV my_trunc(NV x)
1166{
1167 return MY_ROUND_TRUNC(x)((NV)((IV)(x)));
1168}
1169# define c99_trunctrunc my_trunc
1170#endif
1171
1172#ifdef NV_NANPL_nan.nv
1173
1174#undef NV_PAYLOAD_DEBUG
1175
1176/* NOTE: the NaN payload API implementation is hand-rolled, since the
1177 * APIs are only proposed ones as of June 2015, so very few, if any,
1178 * platforms have implementations yet, so HAS_SETPAYLOAD and such are
1179 * unlikely to be helpful.
1180 *
1181 * XXX - if the core numification wants to actually generate
1182 * the nan payload in "nan(123)", and maybe "nans(456)", for
1183 * signaling payload", this needs to be moved to e.g. numeric.c
1184 * (look for grok_infnan)
1185 *
1186 * Conversely, if the core stringification wants the nan payload
1187 * and/or the nan quiet/signaling distinction, S_getpayload()
1188 * from this file needs to be moved, to e.g. sv.c (look for S_infnan_2pv),
1189 * and the (trivial) functionality of issignaling() copied
1190 * (for generating "NaNS", or maybe even "NaNQ") -- or maybe there
1191 * are too many formatting parameters for simple stringification?
1192 */
1193
1194/* While it might make sense for the payload to be UV or IV,
1195 * to avoid conversion loss, the proposed ISO interfaces use
1196 * a floating point input, which is then truncated to integer,
1197 * and only the integer part being used. This is workable,
1198 * except for: (1) the conversion loss (2) suboptimal for
1199 * 32-bit integer platforms. A workaround API for (2) and
1200 * in general for bit-honesty would be an array of integers
1201 * as the payload... but the proposed C API does nothing of
1202 * the kind. */
1203#if NVSIZE8 == UVSIZE8
1204# define NV_PAYLOAD_TYPEUV UV
1205#else
1206# define NV_PAYLOAD_TYPEUV NV
1207#endif
1208
1209#if defined(USE_LONG_DOUBLE) && defined(LONGDOUBLE_DOUBLEDOUBLE)
1210# define NV_PAYLOAD_SIZEOF_ASSERT(a)do { _Static_assert(sizeof(a) == 8, "sizeof(a) == 8"); } while
(0)
\
1211 STATIC_ASSERT_STMT(sizeof(a) == NVSIZE / 2)do { _Static_assert(sizeof(a) == 8 / 2, "sizeof(a) == 8 / 2")
; } while (0)
1212#else
1213# define NV_PAYLOAD_SIZEOF_ASSERT(a)do { _Static_assert(sizeof(a) == 8, "sizeof(a) == 8"); } while
(0)
\
1214 STATIC_ASSERT_STMT(sizeof(a) == NVSIZE)do { _Static_assert(sizeof(a) == 8, "sizeof(a) == 8"); } while
(0)
1215#endif
1216
1217static void S_setpayload(NV* nvp, NV_PAYLOAD_TYPEUV payload, bool_Bool signaling)
1218{
1219 dTHXstruct Perl___notused_struct;
1220 static const U8 m[] = { NV_NAN_PAYLOAD_MASK0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00 };
1221 static const U8 p[] = { NV_NAN_PAYLOAD_PERM0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0xFF };
1222 UV a[(NVSIZE8 + UVSIZE8 - 1) / UVSIZE8] = { 0 };
1223 int i;
1224 NV_PAYLOAD_SIZEOF_ASSERT(m)do { _Static_assert(sizeof(m) == 8, "sizeof(m) == 8"); } while
(0)
;
1225 NV_PAYLOAD_SIZEOF_ASSERT(p)do { _Static_assert(sizeof(p) == 8, "sizeof(p) == 8"); } while
(0)
;
1226 *nvp = NV_NANPL_nan.nv;
1227 /* Divide the input into the array in "base unsigned integer" in
1228 * little-endian order. Note that the integer might be smaller than
1229 * an NV (if UV is U32, for example). */
1230#if NVSIZE8 == UVSIZE8
1231 a[0] = payload; /* The trivial case. */
1232#else
1233 {
1234 NV t1 = c99_trunctrunc(payload); /* towards zero (drop fractional) */
1235#ifdef NV_PAYLOAD_DEBUG
1236 Perl_warn(aTHX_ "t1 = %" NVgf"g" " (payload %" NVgf"g" ")\n", t1, payload);
1237#endif
1238 if (t1 <= UV_MAX(~(UV)0)) {
1239 a[0] = (UV)t1; /* Fast path, also avoids rounding errors (right?) */
1240 } else {
1241 /* UVSIZE < NVSIZE or payload > UV_MAX.
1242 *
1243 * This may happen for example if:
1244 * (1) UVSIZE == 32 and common 64-bit double NV
1245 * (32-bit system not using -Duse64bitint)
1246 * (2) UVSIZE == 64 and the x86-style 80-bit long double NV
1247 * (note that here the room for payload is actually the 64 bits)
1248 * (3) UVSIZE == 64 and the 128-bit IEEE 764 quadruple NV
1249 * (112 bits in mantissa, 111 bits room for payload)
1250 *
1251 * NOTE: this is very sensitive to correctly functioning
1252 * fmod()/fmodl(), and correct casting of big-unsigned-integer to NV.
1253 * If these don't work right, especially the low order bits
1254 * are in danger. For example Solaris and AIX seem to have issues
1255 * here, especially if using 32-bit UVs. */
1256 NV t2;
1257 for (i = 0, t2 = t1; i < (int)C_ARRAY_LENGTH(a)(sizeof(a)/sizeof((a)[0])); i++) {
1258 a[i] = (UV)Perl_fmodfmod(t2, (NV)UV_MAX(~(UV)0));
1259 t2 = Perl_floorfloor(t2 / (NV)UV_MAX(~(UV)0));
1260 }
1261 }
1262 }
1263#endif
1264#ifdef NV_PAYLOAD_DEBUG
1265 for (i = 0; i < (int)C_ARRAY_LENGTH(a)(sizeof(a)/sizeof((a)[0])); i++) {
1266 Perl_warn(aTHX_ "a[%d] = 0x%" UVxf"lx" "\n", i, a[i]);
1267 }
1268#endif
1269 for (i = 0; i < (int)sizeof(p); i++) {
1270 if (m[i] && p[i] < sizeof(p)) {
1271 U8 s = (p[i] % UVSIZE8) << 3;
1272 UV u = a[p[i] / UVSIZE8] & ((UV)0xFF << s);
1273 U8 b = (U8)((u >> s) & m[i]);
1274 ((U8 *)(nvp))[i] &= ~m[i]; /* For NaNs with non-zero payload bits. */
1275 ((U8 *)(nvp))[i] |= b;
1276#ifdef NV_PAYLOAD_DEBUG
1277 Perl_warn(aTHX_
1278 "set p[%2d] = %02x (i = %d, m = %02x, s = %2d, b = %02x, u = %08"
1279 UVxf"lx" ")\n", i, ((U8 *)(nvp))[i], i, m[i], s, b, u);
1280#endif
1281 a[p[i] / UVSIZE8] &= ~u;
1282 }
1283 }
1284 if (signaling) {
1285 NV_NAN_SET_SIGNALING(nvp)((((((U8*)(PL_nan.u8))[6]) & (1 << ((((52 - 1)) % 8
)))) == (1 << ((((52 - 1)) % 8)))) ? ((((U8*)(nvp))[6])
&= ~(1 << ((((52 - 1)) % 8)))) : ((((U8*)(nvp))[6]
) |= (1 << ((((52 - 1)) % 8)))))
;
1286 }
1287#ifdef USE_LONG_DOUBLE
1288# if LONG_DOUBLEKIND3 == 3 || LONG_DOUBLEKIND3 == 4
1289# if LONG_DOUBLESIZE16 > 10
1290 memset((char *)nvp + 10, '\0', LONG_DOUBLESIZE16 - 10); /* x86 long double */
1291# endif
1292# endif
1293#endif
1294 for (i = 0; i < (int)C_ARRAY_LENGTH(a)(sizeof(a)/sizeof((a)[0])); i++) {
1295 if (a[i]) {
1296 Perl_warn(aTHX_ "payload lost bits (%" UVxf"lx" ")", a[i]);
1297 break;
1298 }
1299 }
1300#ifdef NV_PAYLOAD_DEBUG
1301 for (i = 0; i < NVSIZE8; i++) {
1302 PerlIO_printf(Perl_debug_logPerl_PerlIO_stderr(), "%02x ", ((U8 *)(nvp))[i]);
1303 }
1304 PerlIO_printf(Perl_debug_logPerl_PerlIO_stderr(), "\n");
1305#endif
1306}
1307
1308static NV_PAYLOAD_TYPEUV S_getpayload(NV nv)
1309{
1310 dTHXstruct Perl___notused_struct;
1311 static const U8 m[] = { NV_NAN_PAYLOAD_MASK0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00 };
1312 static const U8 p[] = { NV_NAN_PAYLOAD_PERM0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0xFF };
1313 UV a[(NVSIZE8 + UVSIZE8 - 1) / UVSIZE8] = { 0 };
1314 int i;
1315 NV payload;
1316 NV_PAYLOAD_SIZEOF_ASSERT(m)do { _Static_assert(sizeof(m) == 8, "sizeof(m) == 8"); } while
(0)
;
1317 NV_PAYLOAD_SIZEOF_ASSERT(p)do { _Static_assert(sizeof(p) == 8, "sizeof(p) == 8"); } while
(0)
;
1318 payload = 0;
1319 for (i = 0; i < (int)sizeof(p); i++) {
1320 if (m[i] && p[i] < NVSIZE8) {
1321 U8 s = (p[i] % UVSIZE8) << 3;
1322 a[p[i] / UVSIZE8] |= (UV)(((U8 *)(&nv))[i] & m[i]) << s;
1323 }
1324 }
1325 for (i = (int)C_ARRAY_LENGTH(a)(sizeof(a)/sizeof((a)[0])) - 1; i >= 0; i--) {
1326#ifdef NV_PAYLOAD_DEBUG
1327 Perl_warn(aTHX_ "a[%d] = %" UVxf"lx" "\n", i, a[i]);
1328#endif
1329 payload *= UV_MAX(~(UV)0);
1330 payload += a[i];
1331 }
1332#ifdef NV_PAYLOAD_DEBUG
1333 for (i = 0; i < NVSIZE8; i++) {
1334 PerlIO_printf(Perl_debug_logPerl_PerlIO_stderr(), "%02x ", ((U8 *)(&nv))[i]);
1335 }
1336 PerlIO_printf(Perl_debug_logPerl_PerlIO_stderr(), "\n");
1337#endif
1338 return payload;
1339}
1340
1341#endif /* #ifdef NV_NAN */
1342
1343/* XXX This comment is just to make I_TERMIO and I_SGTTY visible to
1344 metaconfig for future extension writers. We don't use them in POSIX.
1345 (This is really sneaky :-) --AD
1346*/
1347#if defined(I_TERMIOS)
1348#include <termios.h>
1349#endif
1350#include <stdlib.h>
1351#ifndef __ultrix__
1352#include <string.h>
1353#endif
1354#include <sys/stat.h>
1355#include <sys/types.h>
1356#include <time.h>
1357#ifdef I_UNISTD
1358#include <unistd.h>
1359#endif
1360#include <fcntl.h>
1361
1362#ifdef HAS_TZNAME
1363# if !defined(WIN32) && !defined(__CYGWIN__) && !defined(NETWARE) && !defined(__UWIN__)
1364extern char *tzname[];
1365# endif
1366#else
1367#if !defined(WIN32) && !defined(__UWIN__) || (defined(__MINGW32__) && !defined(tzname))
1368char *tzname[] = { "" , "" };
1369#endif
1370#endif
1371
1372#if defined(__VMS) && !defined(__POSIX_SOURCE)
1373
1374# include <utsname.h>
1375
1376# undef mkfifo
1377# define mkfifo(a,b) (not_here("mkfifo"),-1)
1378
1379 /* The POSIX notion of ttyname() is better served by getname() under VMS */
1380 static char ttnambuf[64];
1381# define ttyname(fd) (isatty(fd) > 0 ? getname(fd,ttnambuf,0) : NULL((void*)0))
1382
1383#else
1384#if defined (__CYGWIN__)
1385# define tzname _tzname
1386#endif
1387#if defined (WIN32) || defined (NETWARE)
1388# undef mkfifo
1389# define mkfifo(a,b) not_here("mkfifo")
1390# define ttyname(a) (char*)not_here("ttyname")
1391# define sigset_t long
1392# define pid_t long
1393# ifdef _MSC_VER
1394# define mode_t short
1395# endif
1396# ifdef __MINGW32__
1397# define mode_t short
1398# ifndef tzset
1399# define tzset() not_here("tzset")
1400# endif
1401# ifndef _POSIX_OPEN_MAX20
1402# define _POSIX_OPEN_MAX20 FOPEN_MAX20 /* XXX bogus ? */
1403# endif
1404# endif
1405# define sigaction(a,b,c) not_here("sigaction")
1406# define sigpending(a) not_here("sigpending")
1407# define sigprocmask(a,b,c) not_here("sigprocmask")
1408# define sigsuspend(a) not_here("sigsuspend")
1409# define sigemptyset(a) not_here("sigemptyset")
1410# define sigaddset(a,b) not_here("sigaddset")
1411# define sigdelset(a,b) not_here("sigdelset")
1412# define sigfillset(a) not_here("sigfillset")
1413# define sigismember(a,b) not_here("sigismember")
1414#ifndef NETWARE
1415# undef setuid
1416# undef setgid
1417# define setuid(a) not_here("setuid")
1418# define setgid(a) not_here("setgid")
1419#endif /* NETWARE */
1420#ifndef USE_LONG_DOUBLE
1421# define strtold(s1,s2) not_here("strtold")
1422#endif /* USE_LONG_DOUBLE */
1423#else
1424
1425# ifndef HAS_MKFIFO
1426# if defined(OS2) || defined(__amigaos4__)
1427# define mkfifo(a,b) not_here("mkfifo")
1428# else /* !( defined OS2 ) */
1429# ifndef mkfifo
1430# define mkfifo(path, mode) (mknod((path), (mode) | S_IFIFO0010000, 0))
1431# endif
1432# endif
1433# endif /* !HAS_MKFIFO */
1434
1435# ifdef I_GRP
1436# include <grp.h>
1437# endif
1438# include <sys/times.h>
1439# ifdef HAS_UNAME
1440# include <sys/utsname.h>
1441# endif
1442# ifndef __amigaos4__
1443# include <sys/wait.h>
1444# endif
1445# ifdef I_UTIME
1446# include <utime.h>
1447# endif
1448#endif /* WIN32 || NETWARE */
1449#endif /* __VMS */
1450
1451typedef int SysRet;
1452typedef long SysRetLong;
1453typedef sigset_t* POSIX__SigSet;
1454typedef HV* POSIX__SigAction;
1455typedef int POSIX__SigNo;
1456typedef int POSIX__Fd;
1457#ifdef I_TERMIOS
1458typedef struct termios* POSIX__Termios;
1459#else /* Define termios types to int, and call not_here for the functions.*/
1460#define POSIX__Termios int
1461#define speed_t int
1462#define tcflag_t int
1463#define cc_t int
1464#define cfgetispeed(x) not_here("cfgetispeed")
1465#define cfgetospeed(x) not_here("cfgetospeed")
1466#define tcdrain(x) not_here("tcdrain")
1467#define tcflush(x,y) not_here("tcflush")
1468#define tcsendbreak(x,y) not_here("tcsendbreak")
1469#define cfsetispeed(x,y) not_here("cfsetispeed")
1470#define cfsetospeed(x,y) not_here("cfsetospeed")
1471#define ctermid(x) (char *) not_here("ctermid")
1472#define tcflow(x,y) not_here("tcflow")
1473#define tcgetattr(x,y) not_here("tcgetattr")
1474#define tcsetattr(x,y,z) not_here("tcsetattr")
1475#endif
1476
1477/* Possibly needed prototypes */
1478#ifndef WIN32
1479START_EXTERN_C
1480double strtod (const char *, char **);
1481long strtol (const char *, char **, int);
1482unsigned long strtoul (const char *, char **, int);
1483#ifdef HAS_STRTOLD
1484long double strtold (const char *, char **);
1485#endif
1486END_EXTERN_C
1487#endif
1488
1489#ifndef HAS_DIFFTIME
1490#ifndef difftime
1491#define difftime(a,b) not_here("difftime")
1492#endif
1493#endif
1494#ifndef HAS_FPATHCONF
1495#define fpathconf(f,n) (SysRetLong) not_here("fpathconf")
1496#endif
1497#ifndef HAS_MKTIME
1498#define mktime(a) not_here("mktime")
1499#endif
1500#ifndef HAS_NICE
1501#define nice(a) not_here("nice")
1502#endif
1503#ifndef HAS_PATHCONF
1504#define pathconf(f,n) (SysRetLong) not_here("pathconf")
1505#endif
1506#ifndef HAS_SYSCONF
1507#define sysconf(n) (SysRetLong) not_here("sysconf")
1508#endif
1509#ifndef HAS_READLINK
1510#define readlink(a,b,c) not_here("readlink")
1511#endif
1512#ifndef HAS_SETPGID
1513#define setpgid(a,b) not_here("setpgid")
1514#endif
1515#ifndef HAS_SETSID
1516#define setsid() not_here("setsid")
1517#endif
1518#ifndef HAS_STRCOLL
1519#define strcoll(s1,s2) not_here("strcoll")
1520#endif
1521#ifndef HAS_STRTOD
1522#define strtod(s1,s2) not_here("strtod")
1523#endif
1524#ifndef HAS_STRTOLD
1525#define strtold(s1,s2) not_here("strtold")
1526#endif
1527#ifndef HAS_STRTOL
1528#define strtol(s1,s2,b) not_here("strtol")
1529#endif
1530#ifndef HAS_STRTOUL
1531#define strtoul(s1,s2,b) not_here("strtoul")
1532#endif
1533#ifndef HAS_STRXFRM
1534#define strxfrm(s1,s2,n) not_here("strxfrm")
1535#endif
1536#ifndef HAS_TCGETPGRP
1537#define tcgetpgrp(a) not_here("tcgetpgrp")
1538#endif
1539#ifndef HAS_TCSETPGRP
1540#define tcsetpgrp(a,b) not_here("tcsetpgrp")
1541#endif
1542#ifndef HAS_TIMES
1543#ifndef NETWARE
1544#define times(a) not_here("times")
1545#endif /* NETWARE */
1546#endif
1547#ifndef HAS_UNAME
1548#define uname(a) not_here("uname")
1549#endif
1550#ifndef HAS_WAITPID
1551#define waitpid(a,b,c) not_here("waitpid")
1552#endif
1553
1554#if ! defined(HAS_MBLEN) && ! defined(HAS_MBRLEN)
1555#define mblen(a,b) not_here("mblen")
1556#endif
1557#if ! defined(HAS_MBTOWC) && ! defined(HAS_MBRTOWC)
1558#define mbtowc(pwc, s, n) not_here("mbtowc")
1559#endif
1560#ifndef HAS_WCTOMB
1561#define wctomb(s, wchar) not_here("wctomb")
1562#endif
1563#if !defined(HAS_MBLEN) && !defined(HAS_MBSTOWCS) && !defined(HAS_MBTOWC) && !defined(HAS_WCSTOMBS) && !defined(HAS_WCTOMB)
1564/* If we don't have these functions, then we wouldn't have gotten a typedef
1565 for wchar_t, the wide character type. Defining wchar_t allows the
1566 functions referencing it to compile. Its actual type is then meaningless,
1567 since without the above functions, all sections using it end up calling
1568 not_here() and croak. --Kaveh Ghazi (ghazi@noc.rutgers.edu) 9/18/94. */
1569#ifndef wchar_t
1570#define wchar_t char
1571#endif
1572#endif
1573
1574#ifndef HAS_LOCALECONV
1575# define localeconv() not_here("localeconv")
1576#else
1577struct lconv_offset {
1578 const char *name;
1579 size_t offset;
1580};
1581
1582static const struct lconv_offset lconv_strings[] = {
1583#ifdef USE_LOCALE_NUMERIC
1584 {"decimal_point", STRUCT_OFFSET(struct lconv, decimal_point)__builtin_offsetof(struct lconv, decimal_point)},
1585 {"thousands_sep", STRUCT_OFFSET(struct lconv, thousands_sep)__builtin_offsetof(struct lconv, thousands_sep)},
1586# ifndef NO_LOCALECONV_GROUPING
1587 {"grouping", STRUCT_OFFSET(struct lconv, grouping)__builtin_offsetof(struct lconv, grouping)},
1588# endif
1589#endif
1590#ifdef USE_LOCALE_MONETARY
1591 {"int_curr_symbol", STRUCT_OFFSET(struct lconv, int_curr_symbol)__builtin_offsetof(struct lconv, int_curr_symbol)},
1592 {"currency_symbol", STRUCT_OFFSET(struct lconv, currency_symbol)__builtin_offsetof(struct lconv, currency_symbol)},
1593 {"mon_decimal_point", STRUCT_OFFSET(struct lconv, mon_decimal_point)__builtin_offsetof(struct lconv, mon_decimal_point)},
1594# ifndef NO_LOCALECONV_MON_THOUSANDS_SEP
1595 {"mon_thousands_sep", STRUCT_OFFSET(struct lconv, mon_thousands_sep)__builtin_offsetof(struct lconv, mon_thousands_sep)},
1596# endif
1597# ifndef NO_LOCALECONV_MON_GROUPING
1598 {"mon_grouping", STRUCT_OFFSET(struct lconv, mon_grouping)__builtin_offsetof(struct lconv, mon_grouping)},
1599# endif
1600 {"positive_sign", STRUCT_OFFSET(struct lconv, positive_sign)__builtin_offsetof(struct lconv, positive_sign)},
1601 {"negative_sign", STRUCT_OFFSET(struct lconv, negative_sign)__builtin_offsetof(struct lconv, negative_sign)},
1602#endif
1603 {NULL((void*)0), 0}
1604};
1605
1606#ifdef USE_LOCALE_NUMERIC
1607
1608/* The Linux man pages say these are the field names for the structure
1609 * components that are LC_NUMERIC; the rest being LC_MONETARY */
1610# define isLC_NUMERIC_STRING(name)(0) ( strEQ(name, "decimal_point")(strcmp(name,"decimal_point") == 0) \
1611 || strEQ(name, "thousands_sep")(strcmp(name,"thousands_sep") == 0) \
1612 \
1613 /* There should be no harm done \
1614 * checking for this, even if \
1615 * NO_LOCALECONV_GROUPING */ \
1616 || strEQ(name, "grouping")(strcmp(name,"grouping") == 0))
1617#else
1618# define isLC_NUMERIC_STRING(name)(0) (0)
1619#endif
1620
1621static const struct lconv_offset lconv_integers[] = {
1622#ifdef USE_LOCALE_MONETARY
1623 {"int_frac_digits", STRUCT_OFFSET(struct lconv, int_frac_digits)__builtin_offsetof(struct lconv, int_frac_digits)},
1624 {"frac_digits", STRUCT_OFFSET(struct lconv, frac_digits)__builtin_offsetof(struct lconv, frac_digits)},
1625 {"p_cs_precedes", STRUCT_OFFSET(struct lconv, p_cs_precedes)__builtin_offsetof(struct lconv, p_cs_precedes)},
1626 {"p_sep_by_space", STRUCT_OFFSET(struct lconv, p_sep_by_space)__builtin_offsetof(struct lconv, p_sep_by_space)},
1627 {"n_cs_precedes", STRUCT_OFFSET(struct lconv, n_cs_precedes)__builtin_offsetof(struct lconv, n_cs_precedes)},
1628 {"n_sep_by_space", STRUCT_OFFSET(struct lconv, n_sep_by_space)__builtin_offsetof(struct lconv, n_sep_by_space)},
1629 {"p_sign_posn", STRUCT_OFFSET(struct lconv, p_sign_posn)__builtin_offsetof(struct lconv, p_sign_posn)},
1630 {"n_sign_posn", STRUCT_OFFSET(struct lconv, n_sign_posn)__builtin_offsetof(struct lconv, n_sign_posn)},
1631#ifdef HAS_LC_MONETARY_2008
1632 {"int_p_cs_precedes", STRUCT_OFFSET(struct lconv, int_p_cs_precedes)__builtin_offsetof(struct lconv, int_p_cs_precedes)},
1633 {"int_p_sep_by_space", STRUCT_OFFSET(struct lconv, int_p_sep_by_space)__builtin_offsetof(struct lconv, int_p_sep_by_space)},
1634 {"int_n_cs_precedes", STRUCT_OFFSET(struct lconv, int_n_cs_precedes)__builtin_offsetof(struct lconv, int_n_cs_precedes)},
1635 {"int_n_sep_by_space", STRUCT_OFFSET(struct lconv, int_n_sep_by_space)__builtin_offsetof(struct lconv, int_n_sep_by_space)},
1636 {"int_p_sign_posn", STRUCT_OFFSET(struct lconv, int_p_sign_posn)__builtin_offsetof(struct lconv, int_p_sign_posn)},
1637 {"int_n_sign_posn", STRUCT_OFFSET(struct lconv, int_n_sign_posn)__builtin_offsetof(struct lconv, int_n_sign_posn)},
1638#endif
1639#endif
1640 {NULL((void*)0), 0}
1641};
1642
1643#endif /* HAS_LOCALECONV */
1644
1645#ifdef HAS_LONG_DOUBLE
1646# if LONG_DOUBLESIZE16 > NVSIZE8
1647# undef HAS_LONG_DOUBLE /* XXX until we figure out how to use them */
1648# endif
1649#endif
1650
1651#ifndef HAS_LONG_DOUBLE
1652#ifdef LDBL_MAX
1653#undef LDBL_MAX
1654#endif
1655#ifdef LDBL_MIN
1656#undef LDBL_MIN
1657#endif
1658#ifdef LDBL_EPSILON
1659#undef LDBL_EPSILON
1660#endif
1661#endif
1662
1663/* Background: in most systems the low byte of the wait status
1664 * is the signal (the lowest 7 bits) and the coredump flag is
1665 * the eight bit, and the second lowest byte is the exit status.
1666 * BeOS bucks the trend and has the bytes in different order.
1667 * See beos/beos.c for how the reality is bent even in BeOS
1668 * to follow the traditional. However, to make the POSIX
1669 * wait W*() macros to work in BeOS, we need to unbend the
1670 * reality back in place. --jhi */
1671/* In actual fact the code below is to blame here. Perl has an internal
1672 * representation of the exit status ($?), which it re-composes from the
1673 * OS's representation using the W*() POSIX macros. The code below
1674 * incorrectly uses the W*() macros on the internal representation,
1675 * which fails for OSs that have a different representation (namely BeOS
1676 * and Haiku). WMUNGE() is a hack that converts the internal
1677 * representation into the OS specific one, so that the W*() macros work
1678 * as expected. The better solution would be not to use the W*() macros
1679 * in the first place, though. -- Ingo Weinhold
1680 */
1681#if defined(__HAIKU__)
1682# define WMUNGE(x)(x) (((x) & 0xFF00) >> 8 | ((x) & 0x00FF) << 8)
1683#else
1684# define WMUNGE(x)(x) (x)
1685#endif
1686
1687static int
1688not_here(const char *s)
1689{
1690 croakPerl_croak("POSIX::%s not implemented on this architecture", s);
1691 return -1;
1692}
1693
1694#include "const-c.inc"
1695
1696static void
1697restore_sigmask(pTHX_ SV *osset_sv)
1698{
1699 /* Fortunately, restoring the signal mask can't fail, because
1700 * there's nothing we can do about it if it does -- we're not
1701 * supposed to return -1 from sigaction unless the disposition
1702 * was unaffected.
1703 */
1704#if !(defined(__amigaos4__) && defined(__NEWLIB__))
1705 sigset_t *ossetp = (sigset_t *) SvPV_nolen( osset_sv )((((osset_sv)->sv_flags & (0x00000400|0x00200000)) == 0x00000400
) ? ((osset_sv)->sv_u.svu_pv) : Perl_sv_2pv_flags( osset_sv
,0,2))
;
1706 (void)sigprocmask(SIG_SETMASK3, ossetp, (sigset_t *)0);
1707#endif
1708}
1709
1710static void *
1711allocate_struct(pTHX_ SV *rv, const STRLEN size, const char *packname) {
1712 SV *const t = newSVrv(rv, packname)Perl_newSVrv( rv,packname);
1713 void *const p = sv_grow(t, size + 1)Perl_sv_grow( t,size + 1);
1714
1715 /* Ensure at least one use of not_here() to avoid "defined but not
1716 * used" warning. This is not at all related to allocate_struct(); I
1717 * just needed somewhere to dump it - DAPM */
1718 if (0) { not_here(""); }
1719
1720 SvCUR_set(t, size)do { ((void)0); ((void)0); ((void)0); (((XPV*) (t)->sv_any
)->xpv_cur = (size)); } while (0)
;
1721 SvPOK_on(t)( (t)->sv_flags |= (0x00000400|0x00004000));
1722 return p;
1723}
1724
1725#ifdef WIN32
1726
1727/*
1728 * (1) The CRT maintains its own copy of the environment, separate from
1729 * the Win32API copy.
1730 *
1731 * (2) CRT getenv() retrieves from this copy. CRT putenv() updates this
1732 * copy, and then calls SetEnvironmentVariableA() to update the Win32API
1733 * copy.
1734 *
1735 * (3) win32_getenv() and win32_putenv() call GetEnvironmentVariableA() and
1736 * SetEnvironmentVariableA() directly, bypassing the CRT copy of the
1737 * environment.
1738 *
1739 * (4) The CRT strftime() "%Z" implementation calls __tzset(). That
1740 * calls CRT tzset(), but only the first time it is called, and in turn
1741 * that uses CRT getenv("TZ") to retrieve the timezone info from the CRT
1742 * local copy of the environment and hence gets the original setting as
1743 * perl never updates the CRT copy when assigning to $ENV{TZ}.
1744 *
1745 * Therefore, we need to retrieve the value of $ENV{TZ} and call CRT
1746 * putenv() to update the CRT copy of the environment (if it is different)
1747 * whenever we're about to call tzset().
1748 *
1749 * In addition to all that, when perl is built with PERL_IMPLICIT_SYS
1750 * defined:
1751 *
1752 * (a) Each interpreter has its own copy of the environment inside the
1753 * perlhost structure. That allows applications that host multiple
1754 * independent Perl interpreters to isolate environment changes from
1755 * each other. (This is similar to how the perlhost mechanism keeps a
1756 * separate working directory for each Perl interpreter, so that calling
1757 * chdir() will not affect other interpreters.)
1758 *
1759 * (b) Only the first Perl interpreter instantiated within a process will
1760 * "write through" environment changes to the process environment.
1761 *
1762 * (c) Even the primary Perl interpreter won't update the CRT copy of the
1763 * environment, only the Win32API copy (it calls win32_putenv()).
1764 *
1765 * As with CPerlHost::Getenv() and CPerlHost::Putenv() themselves, it makes
1766 * sense to only update the process environment when inside the main
1767 * interpreter, but we don't have access to CPerlHost's m_bTopLevel member
1768 * from here so we'll just have to check PL_curinterp instead.
1769 *
1770 * Therefore, we can simply #undef getenv() and putenv() so that those names
1771 * always refer to the CRT functions, and explicitly call win32_getenv() to
1772 * access perl's %ENV.
1773 *
1774 * We also #undef malloc() and free() to be sure we are using the CRT
1775 * functions otherwise under PERL_IMPLICIT_SYS they are redefined to calls
1776 * into VMem::Malloc() and VMem::Free() and all allocations will be freed
1777 * when the Perl interpreter is being destroyed so we'd end up with a pointer
1778 * into deallocated memory in environ[] if a program embedding a Perl
1779 * interpreter continues to operate even after the main Perl interpreter has
1780 * been destroyed.
1781 *
1782 * Note that we don't free() the malloc()ed memory unless and until we call
1783 * malloc() again ourselves because the CRT putenv() function simply puts its
1784 * pointer argument into the environ[] array (it doesn't make a copy of it)
1785 * so this memory must otherwise be leaked.
1786 */
1787
1788#undef getenv
1789#undef putenv
1790#undef malloc
1791#undef free
1792
1793static void
1794fix_win32_tzenv(void)
1795{
1796 static char* oldenv = NULL((void*)0);
1797 char* newenv;
1798 const char* perl_tz_env = win32_getenv("TZ");
1799 const char* crt_tz_env = getenv("TZ");
1800 if (perl_tz_env == NULL((void*)0))
1801 perl_tz_env = "";
1802 if (crt_tz_env == NULL((void*)0))
1803 crt_tz_env = "";
1804 if (strNE(perl_tz_env, crt_tz_env)(strcmp(perl_tz_env,crt_tz_env) != 0)) {
1805 newenv = (char*)malloc((strlen(perl_tz_env) + 4) * sizeof(char));
1806 if (newenv != NULL((void*)0)) {
1807 sprintf(newenv, "TZ=%s", perl_tz_env);
1808 putenv(newenv);
1809 if (oldenv != NULL((void*)0))
1810 free(oldenv);
1811 oldenv = newenv;
1812 }
1813 }
1814}
1815
1816#endif
1817
1818/*
1819 * my_tzset - wrapper to tzset() with a fix to make it work (better) on Win32.
1820 * This code is duplicated in the Time-Piece module, so any changes made here
1821 * should be made there too.
1822 */
1823static void
1824my_tzset(pTHXvoid)
1825{
1826#ifdef WIN32
1827#if defined(USE_ITHREADS) && defined(PERL_IMPLICIT_SYS)
1828 if (PL_curinterp == aTHX)
1829#endif
1830 fix_win32_tzenv();
1831#endif
1832 tzset();
1833}
1834
1835#line 1836 "POSIX.c"
1836#ifndef PERL_UNUSED_VAR
1837# define PERL_UNUSED_VAR(var)((void)sizeof(var)) if (0) var = var
1838#endif
1839
1840#ifndef dVARstruct Perl___notused_struct
1841# define dVARstruct Perl___notused_struct dNOOPstruct Perl___notused_struct
1842#endif
1843
1844
1845/* This stuff is not part of the API! You have been warned. */
1846#ifndef PERL_VERSION_DECIMAL
1847# define PERL_VERSION_DECIMAL(r,v,s)(r*1000000 + v*1000 + s) (r*1000000 + v*1000 + s)
1848#endif
1849#ifndef PERL_DECIMAL_VERSION(5*1000000 + 32*1000 + 1)
1850# define PERL_DECIMAL_VERSION(5*1000000 + 32*1000 + 1) \
1851 PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)(5*1000000 + 32*1000 + 1)
1852#endif
1853#ifndef PERL_VERSION_GE
1854# define PERL_VERSION_GE(r,v,s)((5*1000000 + 32*1000 + 1) >= (r*1000000 + v*1000 + s)) \
1855 (PERL_DECIMAL_VERSION(5*1000000 + 32*1000 + 1) >= PERL_VERSION_DECIMAL(r,v,s)(r*1000000 + v*1000 + s))
1856#endif
1857#ifndef PERL_VERSION_LE
1858# define PERL_VERSION_LE(r,v,s)((5*1000000 + 32*1000 + 1) <= (r*1000000 + v*1000 + s)) \
1859 (PERL_DECIMAL_VERSION(5*1000000 + 32*1000 + 1) <= PERL_VERSION_DECIMAL(r,v,s)(r*1000000 + v*1000 + s))
1860#endif
1861
1862/* XS_INTERNAL is the explicit static-linkage variant of the default
1863 * XS macro.
1864 *
1865 * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
1866 * "STATIC", ie. it exports XSUB symbols. You probably don't want that
1867 * for anything but the BOOT XSUB.
1868 *
1869 * See XSUB.h in core!
1870 */
1871
1872
1873/* TODO: This might be compatible further back than 5.10.0. */
1874#if PERL_VERSION_GE(5, 10, 0)((5*1000000 + 32*1000 + 1) >= (5*1000000 + 10*1000 + 0)) && PERL_VERSION_LE(5, 15, 1)((5*1000000 + 32*1000 + 1) <= (5*1000000 + 15*1000 + 1))
1875# undef XS_EXTERNAL
1876# undef XS_INTERNAL
1877# if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
1878# define XS_EXTERNAL(name)void name( CV* cv __attribute__((unused))) __declspec(dllexport) XSPROTO(name)void name( CV* cv __attribute__((unused)))
1879# define XS_INTERNAL(name)static void name( CV* cv __attribute__((unused))) STATICstatic XSPROTO(name)void name( CV* cv __attribute__((unused)))
1880# endif
1881# if defined(__SYMBIAN32__)
1882# define XS_EXTERNAL(name)void name( CV* cv __attribute__((unused))) EXPORT_C XSPROTO(name)void name( CV* cv __attribute__((unused)))
1883# define XS_INTERNAL(name)static void name( CV* cv __attribute__((unused))) EXPORT_C STATICstatic XSPROTO(name)void name( CV* cv __attribute__((unused)))
1884# endif
1885# ifndef XS_EXTERNAL
1886# if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
1887# define XS_EXTERNAL(name)void name( CV* cv __attribute__((unused))) void name(pTHX_ CV* cv __attribute__unused____attribute__((unused)))
1888# define XS_INTERNAL(name)static void name( CV* cv __attribute__((unused))) STATICstatic void name(pTHX_ CV* cv __attribute__unused____attribute__((unused)))
1889# else
1890# ifdef __cplusplus
1891# define XS_EXTERNAL(name)void name( CV* cv __attribute__((unused))) extern "C" XSPROTO(name)void name( CV* cv __attribute__((unused)))
1892# define XS_INTERNAL(name)static void name( CV* cv __attribute__((unused))) static XSPROTO(name)void name( CV* cv __attribute__((unused)))
1893# else
1894# define XS_EXTERNAL(name)void name( CV* cv __attribute__((unused))) XSPROTO(name)void name( CV* cv __attribute__((unused)))
1895# define XS_INTERNAL(name)static void name( CV* cv __attribute__((unused))) STATICstatic XSPROTO(name)void name( CV* cv __attribute__((unused)))
1896# endif
1897# endif
1898# endif
1899#endif
1900
1901/* perl >= 5.10.0 && perl <= 5.15.1 */
1902
1903
1904/* The XS_EXTERNAL macro is used for functions that must not be static
1905 * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
1906 * macro defined, the best we can do is assume XS is the same.
1907 * Dito for XS_INTERNAL.
1908 */
1909#ifndef XS_EXTERNAL
1910# define XS_EXTERNAL(name)void name( CV* cv __attribute__((unused))) XS(name)void name( CV* cv __attribute__((unused)))
1911#endif
1912#ifndef XS_INTERNAL
1913# define XS_INTERNAL(name)static void name( CV* cv __attribute__((unused))) XS(name)void name( CV* cv __attribute__((unused)))
1914#endif
1915
1916/* Now, finally, after all this mess, we want an ExtUtils::ParseXS
1917 * internal macro that we're free to redefine for varying linkage due
1918 * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
1919 * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
1920 */
1921
1922#undef XS_EUPXS
1923#if defined(PERL_EUPXS_ALWAYS_EXPORT)
1924# define XS_EUPXS(name)static void name( CV* cv __attribute__((unused))) XS_EXTERNAL(name)void name( CV* cv __attribute__((unused)))
1925#else
1926 /* default to internal */
1927# define XS_EUPXS(name)static void name( CV* cv __attribute__((unused))) XS_INTERNAL(name)static void name( CV* cv __attribute__((unused)))
1928#endif
1929
1930#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE((void)0); ((void)0)
1931#define PERL_ARGS_ASSERT_CROAK_XS_USAGE((void)0); ((void)0) assert(cv)((void)0); assert(params)((void)0)
1932
1933/* prototype to pass -Wmissing-prototypes */
1934STATICstatic void
1935S_croak_xs_usage(const CV *const cv, const char *const params);
1936
1937STATICstatic void
1938S_croak_xs_usage(const CV *const cv, const char *const params)
1939{
1940 const GV *const gv = CvGV(cv)Perl_CvGV( (CV *)(cv));
1941
1942 PERL_ARGS_ASSERT_CROAK_XS_USAGE((void)0); ((void)0);
1943
1944 if (gv) {
1945 const char *const gvname = GvNAME(gv)((((XPVGV*)(gv)->sv_any)->xiv_u.xivu_namehek))->hek_key;
1946 const HV *const stash = GvSTASH(gv)(((XPVGV*)(gv)->sv_any)->xnv_u.xgv_stash);
1947 const char *const hvname = stash ? HvNAME(stash)((((stash)->sv_flags & 0x02000000) && ((struct
xpvhv_aux*)&(((stash)->sv_u.svu_hash)[((XPVHV*) (stash
)->sv_any)->xhv_max+1]))->xhv_name_u.xhvnameu_name &&
( ((struct xpvhv_aux*)&(((stash)->sv_u.svu_hash)[((XPVHV
*) (stash)->sv_any)->xhv_max+1]))->xhv_name_count ? *
((struct xpvhv_aux*)&(((stash)->sv_u.svu_hash)[((XPVHV
*) (stash)->sv_any)->xhv_max+1]))->xhv_name_u.xhvnameu_names
: ((struct xpvhv_aux*)&(((stash)->sv_u.svu_hash)[((XPVHV
*) (stash)->sv_any)->xhv_max+1]))->xhv_name_u.xhvnameu_name
)) ? (( ((struct xpvhv_aux*)&(((stash)->sv_u.svu_hash
)[((XPVHV*) (stash)->sv_any)->xhv_max+1]))->xhv_name_count
? *((struct xpvhv_aux*)&(((stash)->sv_u.svu_hash)[((XPVHV
*) (stash)->sv_any)->xhv_max+1]))->xhv_name_u.xhvnameu_names
: ((struct xpvhv_aux*)&(((stash)->sv_u.svu_hash)[((XPVHV
*) (stash)->sv_any)->xhv_max+1]))->xhv_name_u.xhvnameu_name
))->hek_key : ((void*)0))
: NULL((void*)0);
1948
1949 if (hvname)
1950 Perl_croak_nocontextPerl_croak("Usage: %s::%s(%s)", hvname, gvname, params);
1951 else
1952 Perl_croak_nocontextPerl_croak("Usage: %s(%s)", gvname, params);
1953 } else {
1954 /* Pants. I don't think that it should be possible to get here. */
1955 Perl_croak_nocontextPerl_croak("Usage: CODE(0x%" UVxf"lx" ")(%s)", PTR2UV(cv)(UV)(cv), params);
1956 }
1957}
1958#undef PERL_ARGS_ASSERT_CROAK_XS_USAGE((void)0); ((void)0)
1959
1960#define croak_xs_usagePerl_croak_xs_usage S_croak_xs_usage
1961
1962#endif
1963
1964/* NOTE: the prototype of newXSproto() is different in versions of perls,
1965 * so we define a portable version of newXSproto()
1966 */
1967#ifdef newXS_flags
1968#define newXSproto_portable(name, c_impl, file, proto)Perl_newXS_flags( name,c_impl,file,proto,0) newXS_flags(name, c_impl, file, proto, 0)Perl_newXS_flags( name,c_impl,file,proto,0)
1969#else
1970#define newXSproto_portable(name, c_impl, file, proto)Perl_newXS_flags( name,c_impl,file,proto,0) (PL_Sv=(SV*)newXS(name, c_impl, file)Perl_newXS( name,c_impl,file), sv_setpv(PL_Sv, proto)Perl_sv_setpv( PL_Sv,proto), (CV*)PL_Sv)
1971#endif /* !defined(newXS_flags) */
1972
1973#if PERL_VERSION_LE(5, 21, 5)((5*1000000 + 32*1000 + 1) <= (5*1000000 + 21*1000 + 5))
1974# define newXS_deffile(a,b)Perl_newXS_deffile( a,b) Perl_newXS(aTHX_ a,b,file)
1975#else
1976# define newXS_deffile(a,b)Perl_newXS_deffile( a,b) Perl_newXS_deffile(aTHX_ a,b)
1977#endif
1978
1979#line 1980 "POSIX.c"
1980
1981XS_EUPXS(XS_POSIX__SigSet_new)static void XS_POSIX__SigSet_new( CV* cv __attribute__((unused
)))
; /* prototype to pass -Wmissing-prototypes */
1982XS_EUPXS(XS_POSIX__SigSet_new)static void XS_POSIX__SigSet_new( CV* cv __attribute__((unused
)))
1983{
1984 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
1985 PERL_UNUSED_VAR(cv)((void)sizeof(cv)); /* -W */
1986 PERL_UNUSED_VAR(items)((void)sizeof(items)); /* -W */
1987 {
1988 const char * packname;
1989
1990 if (items < 1)
1991 packname = "POSIX::SigSet";
1992 else {
1993 packname = (const char *)SvPV_nolen(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((PL_stack_base[ax + (0)])->sv_u.svu_pv
) : Perl_sv_2pv_flags( PL_stack_base[ax + (0)],0,2))
1994;
1995 }
1996#line 1832 "POSIX.xs"
1997 {
1998 int i;
1999 sigset_t *const s
2000 = (sigset_t *) allocate_struct(aTHX_ (ST(0)PL_stack_base[ax + (0)] = sv_newmortal()Perl_sv_newmortal()),
2001 sizeof(sigset_t),
2002 packname);
2003 sigemptyset(s);
2004 for (i = 1; i < items; i++) {
2005 IV sig = SvIV(ST(i))((((PL_stack_base[ax + (i)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (i)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
i)],2))
;
2006 if (sigaddset(s, sig) < 0)
2007 croakPerl_croak("POSIX::Sigset->new: failed to add signal %" IVdf"ld", sig);
2008 }
2009 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
2010 }
2011#line 2012 "POSIX.c"
2012 }
2013 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
2014}
2015
2016
2017XS_EUPXS(XS_POSIX__SigSet_addset)static void XS_POSIX__SigSet_addset( CV* cv __attribute__((unused
)))
; /* prototype to pass -Wmissing-prototypes */
2018XS_EUPXS(XS_POSIX__SigSet_addset)static void XS_POSIX__SigSet_addset( CV* cv __attribute__((unused
)))
2019{
2020 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
2021 dXSI32I32 ix = ((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->
xcv_start_u.xcv_xsubany.any_i32
;
2022 if (items != 2)
2023 croak_xs_usagePerl_croak_xs_usage(cv, "sigset, sig");
2024 {
2025 POSIX__SigSet sigset;
2026 POSIX__SigNo sig;
2027 SysRet RETVAL;
2028
2029 {
2030 SV * sv = ST(0)PL_stack_base[ax + (0)];
2031 if (SvROK(sv)((sv)->sv_flags & 0x00000800) && sv_derived_from(sv, "POSIX::SigSet")Perl_sv_derived_from( sv,"POSIX::SigSet"))
2032 sigset = (POSIX__SigSet)SvPV_nolen(SvRV(sv))((((((sv)->sv_u.svu_rv))->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((((sv)->sv_u.svu_rv))->sv_u.svu_pv
) : Perl_sv_2pv_flags( ((sv)->sv_u.svu_rv),0,2))
;
2033 else
2034 croakPerl_croak("%s: %s is not of type %s",
2035 GvNAME(CvGV(cv))((((XPVGV*)(Perl_CvGV( (CV *)(cv)))->sv_any)->xiv_u.xivu_namehek
))->hek_key
,
2036 "sigset", "POSIX::SigSet");
2037 }
2038;
2039
2040 if ((sig = SvIV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (1)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
1)],2))
) < 0) {
2041 croakPerl_croak("%s: Negative signals are not allowed %d",
2042 GvNAME(CvGV(cv))((((XPVGV*)(Perl_CvGV( (CV *)(cv)))->sv_any)->xiv_u.xivu_namehek
))->hek_key
,
2043 sig);
2044 }
2045;
2046#line 1854 "POSIX.xs"
2047 RETVAL = ix ? sigdelset(sigset, sig) : sigaddset(sigset, sig);
2048#line 2049 "POSIX.c"
2049 {
2050 SV * RETVALSV;
2051 RETVALSV = sv_newmortal()Perl_sv_newmortal();
2052 if (RETVAL != -1) {
2053 if (RETVAL == 0)
2054 sv_setpvn(RETVALSV, "0 but true", 10)Perl_sv_setpvn( RETVALSV,"0 but true",10);
2055 else
2056 sv_setiv(RETVALSV, (IV)RETVAL)Perl_sv_setiv( RETVALSV,(IV)RETVAL);
2057 }
2058 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
2059 }
2060 }
2061 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
2062}
2063
2064
2065XS_EUPXS(XS_POSIX__SigSet_emptyset)static void XS_POSIX__SigSet_emptyset( CV* cv __attribute__((
unused)))
; /* prototype to pass -Wmissing-prototypes */
2066XS_EUPXS(XS_POSIX__SigSet_emptyset)static void XS_POSIX__SigSet_emptyset( CV* cv __attribute__((
unused)))
2067{
2068 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
2069 dXSI32I32 ix = ((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->
xcv_start_u.xcv_xsubany.any_i32
;
2070 if (items != 1)
2071 croak_xs_usagePerl_croak_xs_usage(cv, "sigset");
2072 {
2073 POSIX__SigSet sigset;
2074 SysRet RETVAL;
2075
2076 {
2077 SV * sv = ST(0)PL_stack_base[ax + (0)];
2078 if (SvROK(sv)((sv)->sv_flags & 0x00000800) && sv_derived_from(sv, "POSIX::SigSet")Perl_sv_derived_from( sv,"POSIX::SigSet"))
2079 sigset = (POSIX__SigSet)SvPV_nolen(SvRV(sv))((((((sv)->sv_u.svu_rv))->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((((sv)->sv_u.svu_rv))->sv_u.svu_pv
) : Perl_sv_2pv_flags( ((sv)->sv_u.svu_rv),0,2))
;
2080 else
2081 croakPerl_croak("%s: %s is not of type %s",
2082 GvNAME(CvGV(cv))((((XPVGV*)(Perl_CvGV( (CV *)(cv)))->sv_any)->xiv_u.xivu_namehek
))->hek_key
,
2083 "sigset", "POSIX::SigSet");
2084 }
2085;
2086#line 1864 "POSIX.xs"
2087 RETVAL = ix ? sigfillset(sigset) : sigemptyset(sigset);
2088#line 2089 "POSIX.c"
2089 {
2090 SV * RETVALSV;
2091 RETVALSV = sv_newmortal()Perl_sv_newmortal();
2092 if (RETVAL != -1) {
2093 if (RETVAL == 0)
2094 sv_setpvn(RETVALSV, "0 but true", 10)Perl_sv_setpvn( RETVALSV,"0 but true",10);
2095 else
2096 sv_setiv(RETVALSV, (IV)RETVAL)Perl_sv_setiv( RETVALSV,(IV)RETVAL);
2097 }
2098 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
2099 }
2100 }
2101 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
2102}
2103
2104
2105XS_EUPXS(XS_POSIX__SigSet_ismember)static void XS_POSIX__SigSet_ismember( CV* cv __attribute__((
unused)))
; /* prototype to pass -Wmissing-prototypes */
2106XS_EUPXS(XS_POSIX__SigSet_ismember)static void XS_POSIX__SigSet_ismember( CV* cv __attribute__((
unused)))
2107{
2108 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
2109 if (items != 2)
2110 croak_xs_usagePerl_croak_xs_usage(cv, "sigset, sig");
2111 {
2112 POSIX__SigSet sigset;
2113 POSIX__SigNo sig;
2114 int RETVAL;
2115 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
2116
2117 {
2118 SV * sv = ST(0)PL_stack_base[ax + (0)];
2119 if (SvROK(sv)((sv)->sv_flags & 0x00000800) && sv_derived_from(sv, "POSIX::SigSet")Perl_sv_derived_from( sv,"POSIX::SigSet"))
2120 sigset = (POSIX__SigSet)SvPV_nolen(SvRV(sv))((((((sv)->sv_u.svu_rv))->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((((sv)->sv_u.svu_rv))->sv_u.svu_pv
) : Perl_sv_2pv_flags( ((sv)->sv_u.svu_rv),0,2))
;
2121 else
2122 croakPerl_croak("%s: %s is not of type %s",
2123 "POSIX::SigSet::ismember",
2124 "sigset", "POSIX::SigSet");
2125 }
2126;
2127
2128 if ((sig = SvIV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (1)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
1)],2))
) < 0) {
2129 croakPerl_croak("%s: Negative signals are not allowed %d",
2130 "POSIX::SigSet::ismember",
2131 sig);
2132 }
2133;
2134
2135 RETVAL = sigismember(sigset, sig);
2136 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHi((IV)RETVAL)do { do { IV TARGi_iv = (IV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000)|0x80000000)) == SVt_IV) &
(1 ? !(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)
0),(0))) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0)
,(1))) { ((void)0); (targ)->sv_flags |= (0x00000100|0x00001000
); targ->sv_u.svu_iv = TARGi_iv; } else Perl_sv_setiv_mg( targ
,TARGi_iv); } while (0); (*++sp = (targ)); } while (0)
;
2137 }
2138 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
2139}
2140
2141
2142XS_EUPXS(XS_POSIX__Termios_new)static void XS_POSIX__Termios_new( CV* cv __attribute__((unused
)))
; /* prototype to pass -Wmissing-prototypes */
2143XS_EUPXS(XS_POSIX__Termios_new)static void XS_POSIX__Termios_new( CV* cv __attribute__((unused
)))
2144{
2145 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
2146 PERL_UNUSED_VAR(cv)((void)sizeof(cv)); /* -W */
2147 PERL_UNUSED_VAR(items)((void)sizeof(items)); /* -W */
2148 {
2149 const char * packname;
2150
2151 if (items < 1)
2152 packname = "POSIX::Termios";
2153 else {
2154 packname = (const char *)SvPV_nolen(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((PL_stack_base[ax + (0)])->sv_u.svu_pv
) : Perl_sv_2pv_flags( PL_stack_base[ax + (0)],0,2))
2155;
2156 }
2157#line 1879 "POSIX.xs"
2158 {
2159#ifdef I_TERMIOS
2160 void *const p = allocate_struct(aTHX_ (ST(0)PL_stack_base[ax + (0)] = sv_newmortal()Perl_sv_newmortal()),
2161 sizeof(struct termios), packname);
2162 /* The previous implementation stored a pointer to an uninitialised
2163 struct termios. Seems safer to initialise it, particularly as
2164 this implementation exposes the struct to prying from perl-space.
2165 */
2166 memset(p, 0, 1 + sizeof(struct termios));
2167 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
2168#else
2169 not_here("termios");
2170#endif
2171 }
2172#line 2173 "POSIX.c"
2173 }
2174 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
2175}
2176
2177
2178XS_EUPXS(XS_POSIX__Termios_getattr)static void XS_POSIX__Termios_getattr( CV* cv __attribute__((
unused)))
; /* prototype to pass -Wmissing-prototypes */
2179XS_EUPXS(XS_POSIX__Termios_getattr)static void XS_POSIX__Termios_getattr( CV* cv __attribute__((
unused)))
2180{
2181 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
2182 if (items < 1 || items > 2)
2183 croak_xs_usagePerl_croak_xs_usage(cv, "termios_ref, fd = 0");
2184 {
2185 POSIX__Termios termios_ref;
2186 POSIX__Fd fd;
2187 SysRet RETVAL;
2188
2189 {
2190 SV * sv = ST(0)PL_stack_base[ax + (0)];
2191 if (SvROK(sv)((sv)->sv_flags & 0x00000800) && sv_derived_from(sv, "POSIX::Termios")Perl_sv_derived_from( sv,"POSIX::Termios"))
2192 termios_ref = (POSIX__Termios)SvPV_nolen(SvRV(sv))((((((sv)->sv_u.svu_rv))->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((((sv)->sv_u.svu_rv))->sv_u.svu_pv
) : Perl_sv_2pv_flags( ((sv)->sv_u.svu_rv),0,2))
;
2193 else
2194 croakPerl_croak("%s: %s is not of type %s",
2195 "POSIX::Termios::getattr",
2196 "termios_ref", "POSIX::Termios");
2197 }
2198;
2199
2200 if (items < 2)
2201 fd = 0;
2202 else {
2203 if ((fd = (int)SvIV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (1)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
1)],2))
) < 0) {
2204 SETERRNO(EBADF, RMS_IFI)((*__errno()) = (9));
2205 XSRETURN_IV(-1)do { (PL_stack_base[ax + (0)] = Perl_sv_2mortal( Perl_newSViv
( -1)) ); do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp
= PL_stack_base + ax + (tmpXSoff - 1); return; } while (0); }
while (0)
;
2206 }
2207;
2208 }
2209#line 1899 "POSIX.xs"
2210 RETVAL = tcgetattr(fd, termios_ref);
2211#line 2212 "POSIX.c"
2212 {
2213 SV * RETVALSV;
2214 RETVALSV = sv_newmortal()Perl_sv_newmortal();
2215 if (RETVAL != -1) {
2216 if (RETVAL == 0)
2217 sv_setpvn(RETVALSV, "0 but true", 10)Perl_sv_setpvn( RETVALSV,"0 but true",10);
2218 else
2219 sv_setiv(RETVALSV, (IV)RETVAL)Perl_sv_setiv( RETVALSV,(IV)RETVAL);
2220 }
2221 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
2222 }
2223 }
2224 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
2225}
2226
2227#ifndef TCSANOW0
2228# define DEF_SETATTR_ACTION0 0
2229#else
2230# define DEF_SETATTR_ACTION0 TCSANOW0
2231#endif
2232
2233XS_EUPXS(XS_POSIX__Termios_setattr)static void XS_POSIX__Termios_setattr( CV* cv __attribute__((
unused)))
; /* prototype to pass -Wmissing-prototypes */
2234XS_EUPXS(XS_POSIX__Termios_setattr)static void XS_POSIX__Termios_setattr( CV* cv __attribute__((
unused)))
2235{
2236 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
2237 if (items < 1 || items > 3)
2238 croak_xs_usagePerl_croak_xs_usage(cv, "termios_ref, fd = 0, optional_actions = DEF_SETATTR_ACTION");
2239 {
2240 POSIX__Termios termios_ref;
2241 POSIX__Fd fd;
2242 int optional_actions;
2243 SysRet RETVAL;
2244
2245 {
2246 SV * sv = ST(0)PL_stack_base[ax + (0)];
2247 if (SvROK(sv)((sv)->sv_flags & 0x00000800) && sv_derived_from(sv, "POSIX::Termios")Perl_sv_derived_from( sv,"POSIX::Termios"))
2248 termios_ref = (POSIX__Termios)SvPV_nolen(SvRV(sv))((((((sv)->sv_u.svu_rv))->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((((sv)->sv_u.svu_rv))->sv_u.svu_pv
) : Perl_sv_2pv_flags( ((sv)->sv_u.svu_rv),0,2))
;
2249 else
2250 croakPerl_croak("%s: %s is not of type %s",
2251 "POSIX::Termios::setattr",
2252 "termios_ref", "POSIX::Termios");
2253 }
2254;
2255
2256 if (items < 2)
2257 fd = 0;
2258 else {
2259 if ((fd = (int)SvIV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (1)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
1)],2))
) < 0) {
2260 SETERRNO(EBADF, RMS_IFI)((*__errno()) = (9));
2261 XSRETURN_IV(-1)do { (PL_stack_base[ax + (0)] = Perl_sv_2mortal( Perl_newSViv
( -1)) ); do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp
= PL_stack_base + ax + (tmpXSoff - 1); return; } while (0); }
while (0)
;
2262 }
2263;
2264 }
2265
2266 if (items < 3)
2267 optional_actions = DEF_SETATTR_ACTION0;
2268 else {
2269 optional_actions = (int)SvIV(ST(2))((((PL_stack_base[ax + (2)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (2)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
2)],2))
2270;
2271 }
2272#line 1917 "POSIX.xs"
2273 /* The second argument to the call is mandatory, but we'd like to give
2274 it a useful default. 0 isn't valid on all operating systems - on
2275 Solaris (at least) TCSANOW, TCSADRAIN and TCSAFLUSH have the same
2276 values as the equivalent ioctls, TCSETS, TCSETSW and TCSETSF. */
2277 if (optional_actions < 0) {
2278 SETERRNO(EINVAL, LIB_INVARG)((*__errno()) = (22));
2279 RETVAL = -1;
2280 } else {
2281 RETVAL = tcsetattr(fd, optional_actions, termios_ref);
2282 }
2283#line 2284 "POSIX.c"
2284 {
2285 SV * RETVALSV;
2286 RETVALSV = sv_newmortal()Perl_sv_newmortal();
2287 if (RETVAL != -1) {
2288 if (RETVAL == 0)
2289 sv_setpvn(RETVALSV, "0 but true", 10)Perl_sv_setpvn( RETVALSV,"0 but true",10);
2290 else
2291 sv_setiv(RETVALSV, (IV)RETVAL)Perl_sv_setiv( RETVALSV,(IV)RETVAL);
2292 }
2293 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
2294 }
2295 }
2296 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
2297}
2298
2299
2300XS_EUPXS(XS_POSIX__Termios_getispeed)static void XS_POSIX__Termios_getispeed( CV* cv __attribute__
((unused)))
; /* prototype to pass -Wmissing-prototypes */
2301XS_EUPXS(XS_POSIX__Termios_getispeed)static void XS_POSIX__Termios_getispeed( CV* cv __attribute__
((unused)))
2302{
2303 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
2304 dXSI32I32 ix = ((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->
xcv_start_u.xcv_xsubany.any_i32
;
2305 if (items != 1)
2306 croak_xs_usagePerl_croak_xs_usage(cv, "termios_ref");
2307 {
2308 POSIX__Termios termios_ref;
2309 speed_t RETVAL;
2310 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
2311
2312 {
2313 SV * sv = ST(0)PL_stack_base[ax + (0)];
2314 if (SvROK(sv)((sv)->sv_flags & 0x00000800) && sv_derived_from(sv, "POSIX::Termios")Perl_sv_derived_from( sv,"POSIX::Termios"))
2315 termios_ref = (POSIX__Termios)SvPV_nolen(SvRV(sv))((((((sv)->sv_u.svu_rv))->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((((sv)->sv_u.svu_rv))->sv_u.svu_pv
) : Perl_sv_2pv_flags( ((sv)->sv_u.svu_rv),0,2))
;
2316 else
2317 croakPerl_croak("%s: %s is not of type %s",
2318 GvNAME(CvGV(cv))((((XPVGV*)(Perl_CvGV( (CV *)(cv)))->sv_any)->xiv_u.xivu_namehek
))->hek_key
,
2319 "termios_ref", "POSIX::Termios");
2320 }
2321;
2322#line 1936 "POSIX.xs"
2323 RETVAL = ix ? cfgetospeed(termios_ref) : cfgetispeed(termios_ref);
2324#line 2325 "POSIX.c"
2325 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHi((IV)RETVAL)do { do { IV TARGi_iv = (IV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000)|0x80000000)) == SVt_IV) &
(1 ? !(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)
0),(0))) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0)
,(1))) { ((void)0); (targ)->sv_flags |= (0x00000100|0x00001000
); targ->sv_u.svu_iv = TARGi_iv; } else Perl_sv_setiv_mg( targ
,TARGi_iv); } while (0); (*++sp = (targ)); } while (0)
;
2326 }
2327 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
2328}
2329
2330
2331XS_EUPXS(XS_POSIX__Termios_getiflag)static void XS_POSIX__Termios_getiflag( CV* cv __attribute__(
(unused)))
; /* prototype to pass -Wmissing-prototypes */
2332XS_EUPXS(XS_POSIX__Termios_getiflag)static void XS_POSIX__Termios_getiflag( CV* cv __attribute__(
(unused)))
2333{
2334 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
2335 dXSI32I32 ix = ((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->
xcv_start_u.xcv_xsubany.any_i32
;
2336 if (items != 1)
2337 croak_xs_usagePerl_croak_xs_usage(cv, "termios_ref");
2338 {
2339 POSIX__Termios termios_ref;
2340 tcflag_t RETVAL;
2341 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
2342
2343 {
2344 SV * sv = ST(0)PL_stack_base[ax + (0)];
2345 if (SvROK(sv)((sv)->sv_flags & 0x00000800) && sv_derived_from(sv, "POSIX::Termios")Perl_sv_derived_from( sv,"POSIX::Termios"))
2346 termios_ref = (POSIX__Termios)SvPV_nolen(SvRV(sv))((((((sv)->sv_u.svu_rv))->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((((sv)->sv_u.svu_rv))->sv_u.svu_pv
) : Perl_sv_2pv_flags( ((sv)->sv_u.svu_rv),0,2))
;
2347 else
2348 croakPerl_croak("%s: %s is not of type %s",
2349 GvNAME(CvGV(cv))((((XPVGV*)(Perl_CvGV( (CV *)(cv)))->sv_any)->xiv_u.xivu_namehek
))->hek_key
,
2350 "termios_ref", "POSIX::Termios");
2351 }
2352;
2353#line 1948 "POSIX.xs"
2354#ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2355 switch(ix) {
2356 case 0:
2357 RETVAL = termios_ref->c_iflag;
2358 break;
2359 case 1:
2360 RETVAL = termios_ref->c_oflag;
2361 break;
2362 case 2:
2363 RETVAL = termios_ref->c_cflag;
2364 break;
2365 case 3:
2366 RETVAL = termios_ref->c_lflag;
2367 break;
2368 default:
2369 RETVAL = 0; /* silence compiler warning */
2370 }
2371#else
2372 not_here(GvNAME(CvGV(cv))((((XPVGV*)(Perl_CvGV( (CV *)(cv)))->sv_any)->xiv_u.xivu_namehek
))->hek_key
);
2373 RETVAL = 0;
2374#endif
2375#line 2376 "POSIX.c"
2376 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHi((IV)RETVAL)do { do { IV TARGi_iv = (IV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000)|0x80000000)) == SVt_IV) &
(1 ? !(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)
0),(0))) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0)
,(1))) { ((void)0); (targ)->sv_flags |= (0x00000100|0x00001000
); targ->sv_u.svu_iv = TARGi_iv; } else Perl_sv_setiv_mg( targ
,TARGi_iv); } while (0); (*++sp = (targ)); } while (0)
;
2377 }
2378 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
2379}
2380
2381
2382XS_EUPXS(XS_POSIX__Termios_getcc)static void XS_POSIX__Termios_getcc( CV* cv __attribute__((unused
)))
; /* prototype to pass -Wmissing-prototypes */
2383XS_EUPXS(XS_POSIX__Termios_getcc)static void XS_POSIX__Termios_getcc( CV* cv __attribute__((unused
)))
2384{
2385 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
2386 if (items != 2)
2387 croak_xs_usagePerl_croak_xs_usage(cv, "termios_ref, ccix");
2388 {
2389 POSIX__Termios termios_ref;
2390 unsigned int ccix = (unsigned int)SvUV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000100|0x80000000
|0x00200000)) == (0x00000100|0x80000000)) ? ((XPVUV*) (PL_stack_base
[ax + (1)])->sv_any)->xuv_u.xivu_uv : Perl_sv_2uv_flags
( PL_stack_base[ax + (1)],2))
2391;
2392 cc_t RETVAL;
2393 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
2394
2395 {
2396 SV * sv = ST(0)PL_stack_base[ax + (0)];
2397 if (SvROK(sv)((sv)->sv_flags & 0x00000800) && sv_derived_from(sv, "POSIX::Termios")Perl_sv_derived_from( sv,"POSIX::Termios"))
2398 termios_ref = (POSIX__Termios)SvPV_nolen(SvRV(sv))((((((sv)->sv_u.svu_rv))->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((((sv)->sv_u.svu_rv))->sv_u.svu_pv
) : Perl_sv_2pv_flags( ((sv)->sv_u.svu_rv),0,2))
;
2399 else
2400 croakPerl_croak("%s: %s is not of type %s",
2401 "POSIX::Termios::getcc",
2402 "termios_ref", "POSIX::Termios");
2403 }
2404;
2405#line 1977 "POSIX.xs"
2406#ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2407 if (ccix >= NCCS20)
2408 croakPerl_croak("Bad getcc subscript");
2409 RETVAL = termios_ref->c_cc[ccix];
2410#else
2411 not_here("getcc");
2412 RETVAL = 0;
2413#endif
2414#line 2415 "POSIX.c"
2415 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHi((IV)RETVAL)do { do { IV TARGi_iv = (IV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000)|0x80000000)) == SVt_IV) &
(1 ? !(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)
0),(0))) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0)
,(1))) { ((void)0); (targ)->sv_flags |= (0x00000100|0x00001000
); targ->sv_u.svu_iv = TARGi_iv; } else Perl_sv_setiv_mg( targ
,TARGi_iv); } while (0); (*++sp = (targ)); } while (0)
;
2416 }
2417 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
2418}
2419
2420
2421XS_EUPXS(XS_POSIX__Termios_setispeed)static void XS_POSIX__Termios_setispeed( CV* cv __attribute__
((unused)))
; /* prototype to pass -Wmissing-prototypes */
2422XS_EUPXS(XS_POSIX__Termios_setispeed)static void XS_POSIX__Termios_setispeed( CV* cv __attribute__
((unused)))
2423{
2424 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
2425 dXSI32I32 ix = ((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->
xcv_start_u.xcv_xsubany.any_i32
;
2426 if (items != 2)
2427 croak_xs_usagePerl_croak_xs_usage(cv, "termios_ref, speed");
2428 {
2429 POSIX__Termios termios_ref;
2430 speed_t speed = (speed_t)SvIV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (1)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
1)],2))
2431;
2432 SysRet RETVAL;
2433
2434 {
2435 SV * sv = ST(0)PL_stack_base[ax + (0)];
2436 if (SvROK(sv)((sv)->sv_flags & 0x00000800) && sv_derived_from(sv, "POSIX::Termios")Perl_sv_derived_from( sv,"POSIX::Termios"))
2437 termios_ref = (POSIX__Termios)SvPV_nolen(SvRV(sv))((((((sv)->sv_u.svu_rv))->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((((sv)->sv_u.svu_rv))->sv_u.svu_pv
) : Perl_sv_2pv_flags( ((sv)->sv_u.svu_rv),0,2))
;
2438 else
2439 croakPerl_croak("%s: %s is not of type %s",
2440 GvNAME(CvGV(cv))((((XPVGV*)(Perl_CvGV( (CV *)(cv)))->sv_any)->xiv_u.xivu_namehek
))->hek_key
,
2441 "termios_ref", "POSIX::Termios");
2442 }
2443;
2444#line 1995 "POSIX.xs"
2445 RETVAL = ix
2446 ? cfsetospeed(termios_ref, speed) : cfsetispeed(termios_ref, speed);
2447#line 2448 "POSIX.c"
2448 {
2449 SV * RETVALSV;
2450 RETVALSV = sv_newmortal()Perl_sv_newmortal();
2451 if (RETVAL != -1) {
2452 if (RETVAL == 0)
2453 sv_setpvn(RETVALSV, "0 but true", 10)Perl_sv_setpvn( RETVALSV,"0 but true",10);
2454 else
2455 sv_setiv(RETVALSV, (IV)RETVAL)Perl_sv_setiv( RETVALSV,(IV)RETVAL);
2456 }
2457 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
2458 }
2459 }
2460 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
2461}
2462
2463
2464XS_EUPXS(XS_POSIX__Termios_setiflag)static void XS_POSIX__Termios_setiflag( CV* cv __attribute__(
(unused)))
; /* prototype to pass -Wmissing-prototypes */
2465XS_EUPXS(XS_POSIX__Termios_setiflag)static void XS_POSIX__Termios_setiflag( CV* cv __attribute__(
(unused)))
2466{
2467 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
2468 dXSI32I32 ix = ((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->
xcv_start_u.xcv_xsubany.any_i32
;
2469 if (items != 2)
2470 croak_xs_usagePerl_croak_xs_usage(cv, "termios_ref, flag");
2471 {
2472 POSIX__Termios termios_ref;
2473 tcflag_t flag = (tcflag_t)SvIV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (1)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
1)],2))
2474;
2475
2476 {
2477 SV * sv = ST(0)PL_stack_base[ax + (0)];
2478 if (SvROK(sv)((sv)->sv_flags & 0x00000800) && sv_derived_from(sv, "POSIX::Termios")Perl_sv_derived_from( sv,"POSIX::Termios"))
2479 termios_ref = (POSIX__Termios)SvPV_nolen(SvRV(sv))((((((sv)->sv_u.svu_rv))->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((((sv)->sv_u.svu_rv))->sv_u.svu_pv
) : Perl_sv_2pv_flags( ((sv)->sv_u.svu_rv),0,2))
;
2480 else
2481 croakPerl_croak("%s: %s is not of type %s",
2482 GvNAME(CvGV(cv))((((XPVGV*)(Perl_CvGV( (CV *)(cv)))->sv_any)->xiv_u.xivu_namehek
))->hek_key
,
2483 "termios_ref", "POSIX::Termios");
2484 }
2485;
2486#line 2009 "POSIX.xs"
2487#ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2488 switch(ix) {
2489 case 0:
2490 termios_ref->c_iflag = flag;
2491 break;
2492 case 1:
2493 termios_ref->c_oflag = flag;
2494 break;
2495 case 2:
2496 termios_ref->c_cflag = flag;
2497 break;
2498 case 3:
2499 termios_ref->c_lflag = flag;
2500 break;
2501 }
2502#else
2503 not_here(GvNAME(CvGV(cv))((((XPVGV*)(Perl_CvGV( (CV *)(cv)))->sv_any)->xiv_u.xivu_namehek
))->hek_key
);
2504#endif
2505#line 2506 "POSIX.c"
2506 }
2507 XSRETURN_EMPTYdo { do { const IV tmpXSoff = (0); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0); } while (0)
;
2508}
2509
2510
2511XS_EUPXS(XS_POSIX__Termios_setcc)static void XS_POSIX__Termios_setcc( CV* cv __attribute__((unused
)))
; /* prototype to pass -Wmissing-prototypes */
2512XS_EUPXS(XS_POSIX__Termios_setcc)static void XS_POSIX__Termios_setcc( CV* cv __attribute__((unused
)))
2513{
2514 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
2515 if (items != 3)
2516 croak_xs_usagePerl_croak_xs_usage(cv, "termios_ref, ccix, cc");
2517 {
2518 POSIX__Termios termios_ref;
2519 unsigned int ccix = (unsigned int)SvUV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000100|0x80000000
|0x00200000)) == (0x00000100|0x80000000)) ? ((XPVUV*) (PL_stack_base
[ax + (1)])->sv_any)->xuv_u.xivu_uv : Perl_sv_2uv_flags
( PL_stack_base[ax + (1)],2))
2520;
2521 cc_t cc = (cc_t)SvIV(ST(2))((((PL_stack_base[ax + (2)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (2)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
2)],2))
2522;
2523
2524 {
2525 SV * sv = ST(0)PL_stack_base[ax + (0)];
2526 if (SvROK(sv)((sv)->sv_flags & 0x00000800) && sv_derived_from(sv, "POSIX::Termios")Perl_sv_derived_from( sv,"POSIX::Termios"))
2527 termios_ref = (POSIX__Termios)SvPV_nolen(SvRV(sv))((((((sv)->sv_u.svu_rv))->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((((sv)->sv_u.svu_rv))->sv_u.svu_pv
) : Perl_sv_2pv_flags( ((sv)->sv_u.svu_rv),0,2))
;
2528 else
2529 croakPerl_croak("%s: %s is not of type %s",
2530 "POSIX::Termios::setcc",
2531 "termios_ref", "POSIX::Termios");
2532 }
2533;
2534#line 2034 "POSIX.xs"
2535#ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2536 if (ccix >= NCCS20)
2537 croakPerl_croak("Bad setcc subscript");
2538 termios_ref->c_cc[ccix] = cc;
2539#else
2540 not_here("setcc");
2541#endif
2542#line 2543 "POSIX.c"
2543 }
2544 XSRETURN_EMPTYdo { do { const IV tmpXSoff = (0); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0); } while (0)
;
2545}
2546
2547
2548/* INCLUDE: Including 'const-xs.inc' from 'POSIX.xs' */
2549
2550
2551XS_EUPXS(XS_POSIX_constant)static void XS_POSIX_constant( CV* cv __attribute__((unused))
)
; /* prototype to pass -Wmissing-prototypes */
2552XS_EUPXS(XS_POSIX_constant)static void XS_POSIX_constant( CV* cv __attribute__((unused))
)
2553{
2554 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
2555 if (items != 1)
2556 croak_xs_usagePerl_croak_xs_usage(cv, "sv");
2557 PERL_UNUSED_VAR(ax)((void)sizeof(ax)); /* -Wall */
2558 SPsp -= items;
2559 {
2560 SV * sv = ST(0)PL_stack_base[ax + (0)]
2561;
2562#line 1572 "./const-xs.inc"
2563 const PERL_CONTEXT *cx = caller_cx(0, NULL)Perl_caller_cx( 0,((void*)0));
2564 /* cx is NULL if we've been called from the top level. PL_curcop isn't
2565 ideal, but it's much cheaper than other ways of not going SEGV. */
2566 const COP *cop = cx ? cx->blk_oldcopcx_u.cx_blk.blku_oldcop : PL_curcop;
2567#line 2568 "POSIX.c"
2568#line 1577 "./const-xs.inc"
2569#ifndef SYMBIAN
2570 /* It's not obvious how to calculate this at C pre-processor time.
2571 However, any compiler optimiser worth its salt should be able to
2572 remove the dead code, and hopefully the now-obviously-unused static
2573 function too. */
2574 HV *constant_missing = (C_ARRAY_LENGTH(values_for_notfound)(sizeof(values_for_notfound)/sizeof((values_for_notfound)[0])
)
> 1)
2575 ? get_missing_hash(aTHX) : NULL((void*)0);
2576 if ((C_ARRAY_LENGTH(values_for_notfound)(sizeof(values_for_notfound)/sizeof((values_for_notfound)[0])
)
> 1)
2577 ? hv_exists_ent(constant_missing, sv, 0)((Perl_hv_common( (constant_missing),(sv),((void*)0),0,0,0x08
,0,(0))) ? (_Bool)1 : (_Bool)0)
: 0) {
2578 sv = newSVpvfPerl_newSVpvf("Your vendor has not defined POSIX macro %" SVf"-p"
2579 ", used at %" COP_FILE_F"-p" " line %" UVuf"lu" "\n",
2580 sv, COP_FILE(cop)(((cop)->cop_filegv) ? ((0+(((cop)->cop_filegv))->sv_u
.svu_gp)->gp_sv) : ((void*)0))
, (UV)CopLINE(cop)((cop)->cop_line));
2581 } else
2582#endif
2583 {
2584 sv = newSVpvfPerl_newSVpvf("%" SVf"-p"
2585 " is not a valid POSIX macro at %"
2586 COP_FILE_F"-p" " line %" UVuf"lu" "\n",
2587 sv, COP_FILE(cop)(((cop)->cop_filegv) ? ((0+(((cop)->cop_filegv))->sv_u
.svu_gp)->gp_sv) : ((void*)0))
, (UV)CopLINE(cop)((cop)->cop_line));
2588 }
2589 croak_sv(sv_2mortal(sv))Perl_croak_sv( Perl_sv_2mortal( sv));
2590#line 2591 "POSIX.c"
2591 PUTBACKPL_stack_sp = sp;
2592 return;
2593 }
2594}
2595
2596
2597/* INCLUDE: Returning to 'POSIX.xs' from 'const-xs.inc' */
2598
2599
2600XS_EUPXS(XS_POSIX_WEXITSTATUS)static void XS_POSIX_WEXITSTATUS( CV* cv __attribute__((unused
)))
; /* prototype to pass -Wmissing-prototypes */
2601XS_EUPXS(XS_POSIX_WEXITSTATUS)static void XS_POSIX_WEXITSTATUS( CV* cv __attribute__((unused
)))
2602{
2603 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
2604 dXSI32I32 ix = ((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->
xcv_start_u.xcv_xsubany.any_i32
;
2605 if (items != 1)
2606 croak_xs_usagePerl_croak_xs_usage(cv, "status");
2607 {
2608 int status = (int)SvIV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (0)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
0)],2))
2609;
2610 int RETVAL;
2611 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
2612#line 2057 "POSIX.xs"
2613#if !defined(WEXITSTATUS) || !defined(WIFEXITED) || !defined(WIFSIGNALED) \
2614 || !defined(WIFSTOPPED) || !defined(WSTOPSIG) || !defined(WTERMSIG)
2615 RETVAL = 0; /* Silence compilers that notice this, but don't realise
2616 that not_here() can't return. */
2617#endif
2618 switch(ix) {
2619 case 0:
2620#ifdef WEXITSTATUS
2621 RETVAL = WEXITSTATUS(WMUNGE(status))(int)(((unsigned)((status)) >> 8) & 0xff);
2622#else
2623 not_here("WEXITSTATUS");
2624#endif
2625 break;
2626 case 1:
2627#ifdef WIFEXITED
2628 RETVAL = WIFEXITED(WMUNGE(status))((((status)) & 0177) == 0);
2629#else
2630 not_here("WIFEXITED");
2631#endif
2632 break;
2633 case 2:
2634#ifdef WIFSIGNALED
2635 RETVAL = WIFSIGNALED(WMUNGE(status))((((status)) & 0177) != 0177 && (((status)) &
0177) != 0)
;
2636#else
2637 not_here("WIFSIGNALED");
2638#endif
2639 break;
2640 case 3:
2641#ifdef WIFSTOPPED
2642 RETVAL = WIFSTOPPED(WMUNGE(status))((((status)) & 0xff) == 0177);
2643#else
2644 not_here("WIFSTOPPED");
2645#endif
2646 break;
2647 case 4:
2648#ifdef WSTOPSIG
2649 RETVAL = WSTOPSIG(WMUNGE(status))(int)(((unsigned)((status)) >> 8) & 0xff);
2650#else
2651 not_here("WSTOPSIG");
2652#endif
2653 break;
2654 case 5:
2655#ifdef WTERMSIG
2656 RETVAL = WTERMSIG(WMUNGE(status))((((status)) & 0177));
2657#else
2658 not_here("WTERMSIG");
2659#endif
2660 break;
2661 default:
2662 croakPerl_croak("Illegal alias %d for POSIX::W*", (int)ix);
2663 }
2664#line 2665 "POSIX.c"
2665 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHi((IV)RETVAL)do { do { IV TARGi_iv = (IV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000)|0x80000000)) == SVt_IV) &
(1 ? !(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)
0),(0))) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0)
,(1))) { ((void)0); (targ)->sv_flags |= (0x00000100|0x00001000
); targ->sv_u.svu_iv = TARGi_iv; } else Perl_sv_setiv_mg( targ
,TARGi_iv); } while (0); (*++sp = (targ)); } while (0)
;
2666 }
2667 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
2668}
2669
2670
2671XS_EUPXS(XS_POSIX_open)static void XS_POSIX_open( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
2672XS_EUPXS(XS_POSIX_open)static void XS_POSIX_open( CV* cv __attribute__((unused)))
2673{
2674 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
2675 if (items < 1 || items > 3)
2676 croak_xs_usagePerl_croak_xs_usage(cv, "filename, flags = O_RDONLY, mode = 0666");
2677 {
2678 char * filename = (char *)SvPV_nolen(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((PL_stack_base[ax + (0)])->sv_u.svu_pv
) : Perl_sv_2pv_flags( PL_stack_base[ax + (0)],0,2))
2679;
2680 int flags;
2681 Mode_tmode_t mode;
2682 SysRet RETVAL;
2683
2684 if (items < 2)
2685 flags = O_RDONLY0x0000;
2686 else {
2687 flags = (int)SvIV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (1)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
1)],2))
2688;
2689 }
2690
2691 if (items < 3)
2692 mode = 0666;
2693 else {
2694 mode = (Mode_tmode_t)SvNV(ST(2))((((PL_stack_base[ax + (2)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (2)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (2
)],2))
2695;
2696 }
2697#line 2117 "POSIX.xs"
2698 if (flags & (O_APPEND0x0008|O_CREAT0x0200|O_TRUNC0x0400|O_RDWR0x0002|O_WRONLY0x0001|O_EXCL0x0800))
2699 TAINT_PROPER("open")if (__builtin_expect(((PL_tainting) ? (_Bool)1 : (_Bool)0),(0
))) { Perl_taint_proper( ((void*)0),"open"); }
;
2700 RETVAL = open(filename, flags, mode);
2701#line 2702 "POSIX.c"
2702 {
2703 SV * RETVALSV;
2704 RETVALSV = sv_newmortal()Perl_sv_newmortal();
2705 if (RETVAL != -1) {
2706 if (RETVAL == 0)
2707 sv_setpvn(RETVALSV, "0 but true", 10)Perl_sv_setpvn( RETVALSV,"0 but true",10);
2708 else
2709 sv_setiv(RETVALSV, (IV)RETVAL)Perl_sv_setiv( RETVALSV,(IV)RETVAL);
2710 }
2711 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
2712 }
2713 }
2714 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
2715}
2716
2717
2718XS_EUPXS(XS_POSIX_localeconv)static void XS_POSIX_localeconv( CV* cv __attribute__((unused
)))
; /* prototype to pass -Wmissing-prototypes */
2719XS_EUPXS(XS_POSIX_localeconv)static void XS_POSIX_localeconv( CV* cv __attribute__((unused
)))
2720{
2721 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
2722 if (items != 0)
2723 croak_xs_usagePerl_croak_xs_usage(cv, "");
2724 {
2725 HV * RETVAL;
2726#line 2127 "POSIX.xs"
2727#ifndef HAS_LOCALECONV
2728 localeconv(); /* A stub to call not_here(). */
2729#else
2730 struct lconv *lcbuf;
2731# if defined(USE_ITHREADS) \
2732 && defined(HAS_POSIX_2008_LOCALE) \
2733 && defined(HAS_LOCALECONV_L) /* Prefer this thread-safe version */
2734 bool_Bool do_free = FALSE(0);
2735 locale_t cur = NULL((void*)0);
2736# elif defined(TS_W32_BROKEN_LOCALECONV)
2737 const char * save_global;
2738 const char * save_thread;
2739# endif
2740 DECLARATION_FOR_LC_NUMERIC_MANIPULATIONstruct Perl___notused_struct;
2741
2742 /* localeconv() deals with both LC_NUMERIC and LC_MONETARY, but
2743 * LC_MONETARY is already in the correct locale */
2744# ifdef USE_LOCALE_MONETARY
2745
2746 const bool_Bool is_monetary_utf8 = _is_cur_LC_category_utf8(LC_MONETARY)Perl__is_cur_LC_category_utf8( 3);
2747# endif
2748# ifdef USE_LOCALE_NUMERIC
2749
2750 bool_Bool is_numeric_utf8;
2751
2752 STORE_LC_NUMERIC_FORCE_TO_UNDERLYING();
2753
2754 is_numeric_utf8 = _is_cur_LC_category_utf8(LC_NUMERIC)Perl__is_cur_LC_category_utf8( 4);
2755# endif
2756
2757 RETVAL = newHV()((HV *)({ void *_p = (Perl_newSV_type( SVt_PVHV)); _p; }));
2758 sv_2mortal((SV*)RETVAL)Perl_sv_2mortal( (SV*)RETVAL);
2759# if defined(USE_ITHREADS) \
2760 && defined(HAS_POSIX_2008_LOCALE) \
2761 && defined(HAS_LOCALECONV_L) \
2762 && defined(HAS_DUPLOCALE)
2763
2764 cur = uselocale((locale_t) 0);
2765 if (cur == LC_GLOBAL_LOCALE((locale_t)-1)) {
2766 cur = duplocale(LC_GLOBAL_LOCALE((locale_t)-1));
2767 do_free = TRUE(1);
2768 }
2769
2770 lcbuf = localeconv_l(cur);
2771# else
2772 LOCALE_LOCK_V; /* Prevent interference with other threads using
2773 localeconv() */
2774# ifdef TS_W32_BROKEN_LOCALECONV
2775 /* This is a workaround for a Windows bug prior to VS 15, in which
2776 * localeconv only looks at the global locale. We toggle to the global
2777 * locale; populate the return; then toggle back. We have to use
2778 * LC_ALL instead of the individual ones because of another bug in
2779 * Windows */
2780
2781 save_thread = savepv(Perl_setlocale(LC_NUMERIC, NULL))Perl_savepv( Perl_setlocale(4, ((void*)0)));
2782
2783 _configthreadlocale(_DISABLE_PER_THREAD_LOCALE);
2784
2785 save_global = savepv(Perl_setlocale(LC_ALL, NULL))Perl_savepv( Perl_setlocale(0, ((void*)0)));
2786
2787 Perl_setlocale(LC_ALL0, save_thread);
2788# endif
2789 lcbuf = localeconv();
2790# endif
2791 if (lcbuf) {
2792 const struct lconv_offset *strings = lconv_strings;
2793 const struct lconv_offset *integers = lconv_integers;
2794 const char *ptr = (const char *) lcbuf;
2795
2796 while (strings->name) {
2797 /* This string may be controlled by either LC_NUMERIC, or
2798 * LC_MONETARY */
2799 const bool_Bool is_utf8_locale =
2800# if defined(USE_LOCALE_NUMERIC) && defined(USE_LOCALE_MONETARY)
2801 (isLC_NUMERIC_STRING(strings->name)(0))
2802 ? is_numeric_utf8
2803 : is_monetary_utf8;
2804# elif defined(USE_LOCALE_NUMERIC)
2805 is_numeric_utf8;
2806# elif defined(USE_LOCALE_MONETARY)
2807 is_monetary_utf8;
2808# else
2809 FALSE(0);
2810# endif
2811
2812 const char *value = *((const char **)(ptr + strings->offset));
2813
2814 if (value && *value) {
2815 const STRLEN value_len = strlen(value);
2816
2817 /* We mark it as UTF-8 if a utf8 locale and is valid and
2818 * variant under UTF-8 */
2819 const bool_Bool is_utf8 = is_utf8_locale
2820 && is_utf8_non_invariant_stringPerl_is_utf8_non_invariant_string(
2821 (U8*) value,
2822 value_len);
2823 (void) hv_store(RETVAL,((SV**) Perl_hv_common_key_len( (RETVAL),(strings->name),(
strlen(strings->name)),(0x04|0x20),(Perl_newSVpvn_flags( (
value),(value_len),(is_utf8) ? 0x20000000 : 0)),(0)))
2824 strings->name,((SV**) Perl_hv_common_key_len( (RETVAL),(strings->name),(
strlen(strings->name)),(0x04|0x20),(Perl_newSVpvn_flags( (
value),(value_len),(is_utf8) ? 0x20000000 : 0)),(0)))
2825 strlen(strings->name),((SV**) Perl_hv_common_key_len( (RETVAL),(strings->name),(
strlen(strings->name)),(0x04|0x20),(Perl_newSVpvn_flags( (
value),(value_len),(is_utf8) ? 0x20000000 : 0)),(0)))
2826 newSVpvn_utf8(value, value_len, is_utf8),((SV**) Perl_hv_common_key_len( (RETVAL),(strings->name),(
strlen(strings->name)),(0x04|0x20),(Perl_newSVpvn_flags( (
value),(value_len),(is_utf8) ? 0x20000000 : 0)),(0)))
2827 0)((SV**) Perl_hv_common_key_len( (RETVAL),(strings->name),(
strlen(strings->name)),(0x04|0x20),(Perl_newSVpvn_flags( (
value),(value_len),(is_utf8) ? 0x20000000 : 0)),(0)))
;
2828 }
2829 strings++;
2830 }
2831
2832 while (integers->name) {
2833 const char value = *((const char *)(ptr + integers->offset));
2834
2835 if (value != CHAR_MAX127)
2836 (void) hv_store(RETVAL, integers->name,((SV**) Perl_hv_common_key_len( (RETVAL),(integers->name),
(strlen(integers->name)),(0x04|0x20),(Perl_newSViv( value)
),(0)))
2837 strlen(integers->name), newSViv(value), 0)((SV**) Perl_hv_common_key_len( (RETVAL),(integers->name),
(strlen(integers->name)),(0x04|0x20),(Perl_newSViv( value)
),(0)))
;
2838 integers++;
2839 }
2840 }
2841# if defined(USE_ITHREADS) \
2842 && defined(HAS_POSIX_2008_LOCALE) \
2843 && defined(HAS_LOCALECONV_L)
2844 if (do_free) {
2845 freelocale(cur);
2846 }
2847# else
2848# ifdef TS_W32_BROKEN_LOCALECONV
2849 Perl_setlocale(LC_ALL0, save_global);
2850
2851 _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
2852
2853 Perl_setlocale(LC_ALL0, save_thread);
2854
2855 Safefree(save_global)Perl_safesysfree(((void *)(save_global)));
2856 Safefree(save_thread)Perl_safesysfree(((void *)(save_thread)));
2857# endif
2858 LOCALE_UNLOCK_V;
2859# endif
2860 RESTORE_LC_NUMERIC();
2861#endif /* HAS_LOCALECONV */
2862#line 2863 "POSIX.c"
2863 {
2864 SV * RETVALSV;
2865 RETVALSV = newRV((SV*)RETVAL)Perl_newRV( (SV*)RETVAL);
2866 RETVALSV = sv_2mortal(RETVALSV)Perl_sv_2mortal( RETVALSV);
2867 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
2868 }
2869 }
2870 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
2871}
2872
2873
2874XS_EUPXS(XS_POSIX_setlocale)static void XS_POSIX_setlocale( CV* cv __attribute__((unused)
))
; /* prototype to pass -Wmissing-prototypes */
2875XS_EUPXS(XS_POSIX_setlocale)static void XS_POSIX_setlocale( CV* cv __attribute__((unused)
))
2876{
2877 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
2878 if (items < 1 || items > 2)
2879 croak_xs_usagePerl_croak_xs_usage(cv, "category, locale = 0");
2880 {
2881 int category = (int)SvIV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (0)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
0)],2))
2882;
2883 const char * locale;
2884#line 2270 "POSIX.xs"
2885 char * retval;
2886#line 2887 "POSIX.c"
2887 char * RETVAL;
2888 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
2889
2890 if (items < 2)
2891 locale = 0;
2892 else {
2893 locale = (const char *)SvPV_nolen(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((PL_stack_base[ax + (1)])->sv_u.svu_pv
) : Perl_sv_2pv_flags( PL_stack_base[ax + (1)],0,2))
2894;
2895 }
2896#line 2272 "POSIX.xs"
2897 retval = (char *) Perl_setlocale(category, locale);
2898 if (! retval) {
2899 XSRETURN_UNDEFdo { (PL_stack_base[ax + (0)] = &(PL_sv_immortals[1])); do
{ const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0); } while (0)
;
2900 }
2901
2902 RETVAL = retval;
2903#line 2904 "POSIX.c"
2904 sv_setpv(TARG, RETVAL)Perl_sv_setpv( targ,RETVAL); XSprePUSH(sp = PL_stack_base + ax - 1); PUSHTARGdo { do { if (__builtin_expect(((((targ)->sv_flags & 0x00400000
)) ? (_Bool)1 : (_Bool)0),(0))) Perl_mg_set( targ); } while (
0); (*++sp = (targ)); } while (0)
;
2905 }
2906 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
2907}
2908
2909
2910XS_EUPXS(XS_POSIX_acos)static void XS_POSIX_acos( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
2911XS_EUPXS(XS_POSIX_acos)static void XS_POSIX_acos( CV* cv __attribute__((unused)))
2912{
2913 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
2914 dXSI32I32 ix = ((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->
xcv_start_u.xcv_xsubany.any_i32
;
2915 if (items != 1)
2916 croak_xs_usagePerl_croak_xs_usage(cv, "x");
2917 {
2918 NV x = (NV)SvNV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (0)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (0
)],2))
2919;
2920 NV RETVAL;
2921 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
2922#line 2316 "POSIX.xs"
2923 PERL_UNUSED_VAR(x)((void)sizeof(x));
2924#ifdef NV_NANPL_nan.nv
2925 RETVAL = NV_NANPL_nan.nv;
2926#else
2927 RETVAL = 0;
2928#endif
2929 switch (ix) {
2930 case 0:
2931 RETVAL = Perl_acosacos(x); /* C89 math */
2932 break;
2933 case 1:
2934#ifdef c99_acoshacosh
2935 RETVAL = c99_acoshacosh(x);
2936#else
2937 not_here("acosh");
2938#endif
2939 break;
2940 case 2:
2941 RETVAL = Perl_asinasin(x); /* C89 math */
2942 break;
2943 case 3:
2944#ifdef c99_asinhasinh
2945 RETVAL = c99_asinhasinh(x);
2946#else
2947 not_here("asinh");
2948#endif
2949 break;
2950 case 4:
2951 RETVAL = Perl_atanatan(x); /* C89 math */
2952 break;
2953 case 5:
2954#ifdef c99_atanhatanh
2955 RETVAL = c99_atanhatanh(x);
2956#else
2957 not_here("atanh");
2958#endif
2959 break;
2960 case 6:
2961#ifdef c99_cbrtcbrt
2962 RETVAL = c99_cbrtcbrt(x);
2963#else
2964 not_here("cbrt");
2965#endif
2966 break;
2967 case 7:
2968 RETVAL = Perl_ceilceil(x); /* C89 math */
2969 break;
2970 case 8:
2971 RETVAL = Perl_coshcosh(x); /* C89 math */
2972 break;
2973 case 9:
2974#ifdef c99_erferf
2975 RETVAL = c99_erferf(x);
2976#else
2977 not_here("erf");
2978#endif
2979 break;
2980 case 10:
2981#ifdef c99_erfcerfc
2982 RETVAL = c99_erfcerfc(x);
2983#else
2984 not_here("erfc");
2985#endif
2986 break;
2987 case 11:
2988#ifdef c99_exp2exp2
2989 RETVAL = c99_exp2exp2(x);
2990#else
2991 not_here("exp2");
2992#endif
2993 break;
2994 case 12:
2995#ifdef c99_expm1expm1
2996 RETVAL = c99_expm1expm1(x);
2997#else
2998 not_here("expm1");
2999#endif
3000 break;
3001 case 13:
3002 RETVAL = Perl_floorfloor(x); /* C89 math */
3003 break;
3004 case 14:
3005#ifdef bessel_j0j0
3006 RETVAL = bessel_j0j0(x);
3007#else
3008 not_here("j0");
3009#endif
3010 break;
3011 case 15:
3012#ifdef bessel_j1j1
3013 RETVAL = bessel_j1j1(x);
3014#else
3015 not_here("j1");
3016#endif
3017 break;
3018 case 16:
3019 /* XXX Note: the lgamma modifies a global variable (signgam),
3020 * which is evil. Some platforms have lgamma_r, which has
3021 * extra output parameter instead of the global variable. */
3022#ifdef c99_lgammalgamma
3023 RETVAL = c99_lgammalgamma(x);
3024#else
3025 not_here("lgamma");
3026#endif
3027 break;
3028 case 17:
3029 RETVAL = Perl_log10log10(x); /* C89 math */
3030 break;
3031 case 18:
3032#ifdef c99_log1plog1p
3033 RETVAL = c99_log1plog1p(x);
3034#else
3035 not_here("log1p");
3036#endif
3037 break;
3038 case 19:
3039#ifdef c99_log2log2
3040 RETVAL = c99_log2log2(x);
3041#else
3042 not_here("log2");
3043#endif
3044 break;
3045 case 20:
3046#ifdef c99_logblogb
3047 RETVAL = c99_logblogb(x);
3048#elif defined(c99_log2log2) && FLT_RADIX2 == 2
3049 RETVAL = Perl_floorfloor(c99_log2log2(PERL_ABS(x)((x) < 0 ? -(x) : (x))));
3050#else
3051 not_here("logb");
3052#endif
3053 break;
3054 case 21:
3055#ifdef c99_nearbyintnearbyint
3056 RETVAL = c99_nearbyintnearbyint(x);
3057#else
3058 not_here("nearbyint");
3059#endif
3060 break;
3061 case 22:
3062#ifdef c99_rintrint
3063 RETVAL = c99_rintrint(x);
3064#else
3065 not_here("rint");
3066#endif
3067 break;
3068 case 23:
3069#ifdef c99_roundround
3070 RETVAL = c99_roundround(x);
3071#else
3072 not_here("round");
3073#endif
3074 break;
3075 case 24:
3076 RETVAL = Perl_sinhsinh(x); /* C89 math */
3077 break;
3078 case 25:
3079 RETVAL = Perl_tantan(x); /* C89 math */
3080 break;
3081 case 26:
3082 RETVAL = Perl_tanhtanh(x); /* C89 math */
3083 break;
3084 case 27:
3085#ifdef c99_tgammatgamma
3086 RETVAL = c99_tgammatgamma(x);
3087#else
3088 not_here("tgamma");
3089#endif
3090 break;
3091 case 28:
3092#ifdef c99_trunctrunc
3093 RETVAL = c99_trunctrunc(x);
3094#else
3095 not_here("trunc");
3096#endif
3097 break;
3098 case 29:
3099#ifdef bessel_y0y0
3100 RETVAL = bessel_y0y0(x);
3101#else
3102 not_here("y0");
3103#endif
3104 break;
3105 case 30:
3106 default:
3107#ifdef bessel_y1y1
3108 RETVAL = bessel_y1y1(x);
3109#else
3110 not_here("y1");
3111#endif
3112 }
3113#line 3114 "POSIX.c"
3114 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHn((NV)RETVAL)do { do { NV TARGn_nv = (NV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000))) == SVt_NV) & (1 ? !
(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)0),(0))
) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0),(1))) {
((void)0); (targ)->sv_flags |= (0x00000200|0x00002000); do
{ ((void)0); ((void)0); (((XPVNV*)(targ)->sv_any)->xnv_u
.xnv_nv = (TARGn_nv)); } while (0); } else Perl_sv_setnv_mg( targ
,TARGn_nv); } while (0); (*++sp = (targ)); } while (0)
;
3115 }
3116 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
3117}
3118
3119
3120XS_EUPXS(XS_POSIX_fegetround)static void XS_POSIX_fegetround( CV* cv __attribute__((unused
)))
; /* prototype to pass -Wmissing-prototypes */
3121XS_EUPXS(XS_POSIX_fegetround)static void XS_POSIX_fegetround( CV* cv __attribute__((unused
)))
3122{
3123 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
3124 if (items != 0)
3125 croak_xs_usagePerl_croak_xs_usage(cv, "");
3126 {
3127 IV RETVAL;
3128 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
3129#line 2512 "POSIX.xs"
3130#ifdef HAS_FEGETROUND
3131 RETVAL = my_fegetround();
3132#else
3133 RETVAL = -1;
3134 not_here("fegetround");
3135#endif
3136#line 3137 "POSIX.c"
3137 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHi((IV)RETVAL)do { do { IV TARGi_iv = (IV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000)|0x80000000)) == SVt_IV) &
(1 ? !(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)
0),(0))) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0)
,(1))) { ((void)0); (targ)->sv_flags |= (0x00000100|0x00001000
); targ->sv_u.svu_iv = TARGi_iv; } else Perl_sv_setiv_mg( targ
,TARGi_iv); } while (0); (*++sp = (targ)); } while (0)
;
3138 }
3139 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
3140}
3141
3142
3143XS_EUPXS(XS_POSIX_fesetround)static void XS_POSIX_fesetround( CV* cv __attribute__((unused
)))
; /* prototype to pass -Wmissing-prototypes */
3144XS_EUPXS(XS_POSIX_fesetround)static void XS_POSIX_fesetround( CV* cv __attribute__((unused
)))
3145{
3146 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
3147 if (items != 1)
3148 croak_xs_usagePerl_croak_xs_usage(cv, "x");
3149 {
3150 IV x = (IV)SvIV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (0)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
0)],2))
3151;
3152 IV RETVAL;
3153 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
3154#line 2525 "POSIX.xs"
3155#ifdef HAS_FEGETROUND /* canary for fesetround */
3156 RETVAL = fesetround(x);
3157#elif defined(HAS_FPGETROUND) /* canary for fpsetround */
3158 switch (x) {
3159 case FE_TONEAREST0x000: RETVAL = fpsetround(FP_RN); break;
3160 case FE_TOWARDZERO0xc00: RETVAL = fpsetround(FP_RZ); break;
3161 case FE_DOWNWARD0x400: RETVAL = fpsetround(FP_RM); break;
3162 case FE_UPWARD0x800: RETVAL = fpsetround(FP_RP); break;
3163 default: RETVAL = -1; break;
3164 }
3165#elif defined(__osf__) /* Tru64 */
3166 switch (x) {
3167 case FE_TONEAREST0x000: RETVAL = write_rnd(FP_RND_RN); break;
3168 case FE_TOWARDZERO0xc00: RETVAL = write_rnd(FP_RND_RZ); break;
3169 case FE_DOWNWARD0x400: RETVAL = write_rnd(FP_RND_RM); break;
3170 case FE_UPWARD0x800: RETVAL = write_rnd(FP_RND_RP); break;
3171 default: RETVAL = -1; break;
3172 }
3173#else
3174 PERL_UNUSED_VAR(x)((void)sizeof(x));
3175 RETVAL = -1;
3176 not_here("fesetround");
3177#endif
3178#line 3179 "POSIX.c"
3179 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHi((IV)RETVAL)do { do { IV TARGi_iv = (IV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000)|0x80000000)) == SVt_IV) &
(1 ? !(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)
0),(0))) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0)
,(1))) { ((void)0); (targ)->sv_flags |= (0x00000100|0x00001000
); targ->sv_u.svu_iv = TARGi_iv; } else Perl_sv_setiv_mg( targ
,TARGi_iv); } while (0); (*++sp = (targ)); } while (0)
;
3180 }
3181 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
3182}
3183
3184
3185XS_EUPXS(XS_POSIX_fpclassify)static void XS_POSIX_fpclassify( CV* cv __attribute__((unused
)))
; /* prototype to pass -Wmissing-prototypes */
3186XS_EUPXS(XS_POSIX_fpclassify)static void XS_POSIX_fpclassify( CV* cv __attribute__((unused
)))
3187{
3188 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
3189 dXSI32I32 ix = ((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->
xcv_start_u.xcv_xsubany.any_i32
;
3190 if (items != 1)
3191 croak_xs_usagePerl_croak_xs_usage(cv, "x");
3192 {
3193 NV x = (NV)SvNV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (0)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (0
)],2))
3194;
3195 IV RETVAL;
3196 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
3197#line 2564 "POSIX.xs"
3198 PERL_UNUSED_VAR(x)((void)sizeof(x));
3199 RETVAL = -1;
3200 switch (ix) {
3201 case 0:
3202#ifdef c99_fpclassifyfpclassify
3203 RETVAL = c99_fpclassify(x)((sizeof (x) == sizeof (float)) ? __fpclassifyf(x) : (sizeof (
x) == sizeof (double)) ? __fpclassify(x) : __fpclassifyl(x))
;
3204#else
3205 not_here("fpclassify");
3206#endif
3207 break;
3208 case 1:
3209#ifdef c99_ilogbilogb
3210 RETVAL = c99_ilogbilogb(x);
3211#else
3212 not_here("ilogb");
3213#endif
3214 break;
3215 case 2:
3216 RETVAL = Perl_isfinite(x)((sizeof (x) == sizeof (float)) ? __isfinitef(x) : (sizeof (x
) == sizeof (double)) ? __isfinite(x) : __isfinitel(x))
;
3217 break;
3218 case 3:
3219 RETVAL = Perl_isinf(x)((sizeof (x) == sizeof (float)) ? __isinff(x) : (sizeof (x) ==
sizeof (double)) ? __isinf(x) : __isinfl(x))
;
3220 break;
3221 case 4:
3222 RETVAL = Perl_isnan(x)((sizeof (x) == sizeof (float)) ? __isnanf(x) : (sizeof (x) ==
sizeof (double)) ? __isnan(x) : __isnanl(x))
;
3223 break;
3224 case 5:
3225#ifdef c99_isnormalisnormal
3226 RETVAL = c99_isnormal(x)((sizeof (x) == sizeof (float)) ? __isnormalf(x) : (sizeof (x
) == sizeof (double)) ? __isnormal(x) : __isnormall(x))
;
3227#else
3228 not_here("isnormal");
3229#endif
3230 break;
3231 case 6:
3232#ifdef c99_lrintlrint
3233 RETVAL = c99_lrintlrint(x);
3234#else
3235 not_here("lrint");
3236#endif
3237 break;
3238 case 7:
3239#ifdef c99_lroundlround
3240 RETVAL = c99_lroundlround(x);
3241#else
3242 not_here("lround");
3243#endif
3244 break;
3245 case 8:
3246 default:
3247#ifdef Perl_signbitsignbit
3248 RETVAL = Perl_signbit(x)((sizeof (x) == sizeof (float)) ? __signbitf(x) : (sizeof (x)
== sizeof (double)) ? __signbit(x) : __signbitl(x))
;
3249#else
3250 RETVAL = (x < 0);
3251#ifdef DOUBLE_IS_IEEE_FORMAT
3252 if (x == -0.0) {
3253 RETVAL = TRUE(1);
3254 }
3255#endif
3256#endif
3257 break;
3258 }
3259#line 3260 "POSIX.c"
3260 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHi((IV)RETVAL)do { do { IV TARGi_iv = (IV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000)|0x80000000)) == SVt_IV) &
(1 ? !(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)
0),(0))) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0)
,(1))) { ((void)0); (targ)->sv_flags |= (0x00000100|0x00001000
); targ->sv_u.svu_iv = TARGi_iv; } else Perl_sv_setiv_mg( targ
,TARGi_iv); } while (0); (*++sp = (targ)); } while (0)
;
3261 }
3262 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
3263}
3264
3265
3266XS_EUPXS(XS_POSIX_getpayload)static void XS_POSIX_getpayload( CV* cv __attribute__((unused
)))
; /* prototype to pass -Wmissing-prototypes */
3267XS_EUPXS(XS_POSIX_getpayload)static void XS_POSIX_getpayload( CV* cv __attribute__((unused
)))
3268{
3269 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
3270 if (items != 1)
3271 croak_xs_usagePerl_croak_xs_usage(cv, "nv");
3272 {
3273 NV nv = (NV)SvNV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (0)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (0
)],2))
3274;
3275 NV RETVAL;
3276 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
3277#line 2632 "POSIX.xs"
3278#ifdef DOUBLE_HAS_NAN
3279 RETVAL = S_getpayload(nv);
3280#else
3281 PERL_UNUSED_VAR(nv)((void)sizeof(nv));
3282 RETVAL = 0.0;
3283 not_here("getpayload");
3284#endif
3285#line 3286 "POSIX.c"
3286 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHn((NV)RETVAL)do { do { NV TARGn_nv = (NV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000))) == SVt_NV) & (1 ? !
(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)0),(0))
) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0),(1))) {
((void)0); (targ)->sv_flags |= (0x00000200|0x00002000); do
{ ((void)0); ((void)0); (((XPVNV*)(targ)->sv_any)->xnv_u
.xnv_nv = (TARGn_nv)); } while (0); } else Perl_sv_setnv_mg( targ
,TARGn_nv); } while (0); (*++sp = (targ)); } while (0)
;
3287 }
3288 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
3289}
3290
3291
3292XS_EUPXS(XS_POSIX_setpayload)static void XS_POSIX_setpayload( CV* cv __attribute__((unused
)))
; /* prototype to pass -Wmissing-prototypes */
3293XS_EUPXS(XS_POSIX_setpayload)static void XS_POSIX_setpayload( CV* cv __attribute__((unused
)))
3294{
3295 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
3296 if (items != 2)
3297 croak_xs_usagePerl_croak_xs_usage(cv, "nv, payload");
3298 {
3299 NV nv = (NV)SvNV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (0)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (0
)],2))
3300;
3301 NV payload = (NV)SvNV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (1)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (1
)],2))
3302;
3303#line 2647 "POSIX.xs"
3304#ifdef DOUBLE_HAS_NAN
3305 S_setpayload(&nv, payload, FALSE(0));
3306#else
3307 PERL_UNUSED_VAR(nv)((void)sizeof(nv));
3308 PERL_UNUSED_VAR(payload)((void)sizeof(payload));
3309 not_here("setpayload");
3310#endif
3311#line 3312 "POSIX.c"
3312 sv_setnv(ST(0), (NV)nv)Perl_sv_setnv( PL_stack_base[ax + (0)],(NV)nv);
3313 SvSETMAGIC(ST(0))do { if (__builtin_expect(((((PL_stack_base[ax + (0)])->sv_flags
& 0x00400000)) ? (_Bool)1 : (_Bool)0),(0))) Perl_mg_set(
PL_stack_base[ax + (0)]); } while (0)
;
3314 }
3315 XSRETURN_EMPTYdo { do { const IV tmpXSoff = (0); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0); } while (0)
;
3316}
3317
3318
3319XS_EUPXS(XS_POSIX_setpayloadsig)static void XS_POSIX_setpayloadsig( CV* cv __attribute__((unused
)))
; /* prototype to pass -Wmissing-prototypes */
3320XS_EUPXS(XS_POSIX_setpayloadsig)static void XS_POSIX_setpayloadsig( CV* cv __attribute__((unused
)))
3321{
3322 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
3323 if (items != 2)
3324 croak_xs_usagePerl_croak_xs_usage(cv, "nv, payload");
3325 {
3326 NV nv = (NV)SvNV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (0)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (0
)],2))
3327;
3328 NV payload = (NV)SvNV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (1)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (1
)],2))
3329;
3330#line 2662 "POSIX.xs"
3331#ifdef DOUBLE_HAS_NAN
3332 nv = NV_NANPL_nan.nv;
3333 S_setpayload(&nv, payload, TRUE(1));
3334#else
3335 PERL_UNUSED_VAR(nv)((void)sizeof(nv));
3336 PERL_UNUSED_VAR(payload)((void)sizeof(payload));
3337 not_here("setpayloadsig");
3338#endif
3339#line 3340 "POSIX.c"
3340 sv_setnv(ST(0), (NV)nv)Perl_sv_setnv( PL_stack_base[ax + (0)],(NV)nv);
3341 SvSETMAGIC(ST(0))do { if (__builtin_expect(((((PL_stack_base[ax + (0)])->sv_flags
& 0x00400000)) ? (_Bool)1 : (_Bool)0),(0))) Perl_mg_set(
PL_stack_base[ax + (0)]); } while (0)
;
3342 }
3343 XSRETURN_EMPTYdo { do { const IV tmpXSoff = (0); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0); } while (0)
;
3344}
3345
3346
3347XS_EUPXS(XS_POSIX_issignaling)static void XS_POSIX_issignaling( CV* cv __attribute__((unused
)))
; /* prototype to pass -Wmissing-prototypes */
3348XS_EUPXS(XS_POSIX_issignaling)static void XS_POSIX_issignaling( CV* cv __attribute__((unused
)))
3349{
3350 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
3351 if (items != 1)
3352 croak_xs_usagePerl_croak_xs_usage(cv, "nv");
3353 {
3354 NV nv = (NV)SvNV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (0)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (0
)],2))
3355;
3356 int RETVAL;
3357 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
3358#line 2677 "POSIX.xs"
3359#ifdef DOUBLE_HAS_NAN
3360 RETVAL = Perl_isnan(nv)((sizeof (nv) == sizeof (float)) ? __isnanf(nv) : (sizeof (nv
) == sizeof (double)) ? __isnan(nv) : __isnanl(nv))
&& NV_NAN_IS_SIGNALING(&nv)(((((U8*)(&nv))[6]) & (1 << ((((52 - 1)) % 8)))
) == ((((((U8*)(PL_nan.u8))[6]) & (1 << ((((52 - 1)
) % 8)))) == (1 << ((((52 - 1)) % 8)))) ? 0 : (1 <<
((((52 - 1)) % 8)))))
;
3361#else
3362 PERL_UNUSED_VAR(nv)((void)sizeof(nv));
3363 RETVAL = 0.0;
3364 not_here("issignaling");
3365#endif
3366#line 3367 "POSIX.c"
3367 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHi((IV)RETVAL)do { do { IV TARGi_iv = (IV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000)|0x80000000)) == SVt_IV) &
(1 ? !(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)
0),(0))) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0)
,(1))) { ((void)0); (targ)->sv_flags |= (0x00000100|0x00001000
); targ->sv_u.svu_iv = TARGi_iv; } else Perl_sv_setiv_mg( targ
,TARGi_iv); } while (0); (*++sp = (targ)); } while (0)
;
3368 }
3369 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
3370}
3371
3372
3373XS_EUPXS(XS_POSIX_copysign)static void XS_POSIX_copysign( CV* cv __attribute__((unused))
)
; /* prototype to pass -Wmissing-prototypes */
3374XS_EUPXS(XS_POSIX_copysign)static void XS_POSIX_copysign( CV* cv __attribute__((unused))
)
3375{
3376 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
3377 dXSI32I32 ix = ((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->
xcv_start_u.xcv_xsubany.any_i32
;
3378 if (items != 2)
3379 croak_xs_usagePerl_croak_xs_usage(cv, "x, y");
3380 {
3381 NV x = (NV)SvNV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (0)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (0
)],2))
3382;
3383 NV y = (NV)SvNV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (1)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (1
)],2))
3384;
3385 NV RETVAL;
3386 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
3387#line 2707 "POSIX.xs"
3388 PERL_UNUSED_VAR(x)((void)sizeof(x));
3389 PERL_UNUSED_VAR(y)((void)sizeof(y));
3390#ifdef NV_NANPL_nan.nv
3391 RETVAL = NV_NANPL_nan.nv;
3392#else
3393 RETVAL = 0;
3394#endif
3395 switch (ix) {
3396 case 0:
3397#ifdef c99_copysigncopysign
3398 RETVAL = c99_copysigncopysign(x, y);
3399#else
3400 not_here("copysign");
3401#endif
3402 break;
3403 case 1:
3404#ifdef c99_fdimfdim
3405 RETVAL = c99_fdimfdim(x, y);
3406#else
3407 not_here("fdim");
3408#endif
3409 break;
3410 case 2:
3411#ifdef c99_fmaxfmax
3412 RETVAL = c99_fmaxfmax(x, y);
3413#else
3414 not_here("fmax");
3415#endif
3416 break;
3417 case 3:
3418#ifdef c99_fminfmin
3419 RETVAL = c99_fminfmin(x, y);
3420#else
3421 not_here("fmin");
3422#endif
3423 break;
3424 case 4:
3425 RETVAL = Perl_fmodfmod(x, y); /* C89 math */
3426 break;
3427 case 5:
3428#ifdef c99_hypothypot
3429 RETVAL = c99_hypothypot(x, y);
3430#else
3431 not_here("hypot");
3432#endif
3433 break;
3434 case 6:
3435#ifdef c99_isgreaterisgreater
3436 RETVAL = c99_isgreater(x, y)(!(((sizeof ((x)) == sizeof (float)) ? __isnanf((x)) : (sizeof
((x)) == sizeof (double)) ? __isnan((x)) : __isnanl((x))) ||
((sizeof ((y)) == sizeof (float)) ? __isnanf((y)) : (sizeof (
(y)) == sizeof (double)) ? __isnan((y)) : __isnanl((y)))) &&
(x) > (y))
;
3437#else
3438 not_here("isgreater");
3439#endif
3440 break;
3441 case 7:
3442#ifdef c99_isgreaterequalisgreaterequal
3443 RETVAL = c99_isgreaterequal(x, y)(!(((sizeof ((x)) == sizeof (float)) ? __isnanf((x)) : (sizeof
((x)) == sizeof (double)) ? __isnan((x)) : __isnanl((x))) ||
((sizeof ((y)) == sizeof (float)) ? __isnanf((y)) : (sizeof (
(y)) == sizeof (double)) ? __isnan((y)) : __isnanl((y)))) &&
(x) >= (y))
;
3444#else
3445 not_here("isgreaterequal");
3446#endif
3447 break;
3448 case 8:
3449#ifdef c99_islessisless
3450 RETVAL = c99_isless(x, y)(!(((sizeof ((x)) == sizeof (float)) ? __isnanf((x)) : (sizeof
((x)) == sizeof (double)) ? __isnan((x)) : __isnanl((x))) ||
((sizeof ((y)) == sizeof (float)) ? __isnanf((y)) : (sizeof (
(y)) == sizeof (double)) ? __isnan((y)) : __isnanl((y)))) &&
(x) < (y))
;
3451#else
3452 not_here("isless");
3453#endif
3454 break;
3455 case 9:
3456#ifdef c99_islessequalislessequal
3457 RETVAL = c99_islessequal(x, y)(!(((sizeof ((x)) == sizeof (float)) ? __isnanf((x)) : (sizeof
((x)) == sizeof (double)) ? __isnan((x)) : __isnanl((x))) ||
((sizeof ((y)) == sizeof (float)) ? __isnanf((y)) : (sizeof (
(y)) == sizeof (double)) ? __isnan((y)) : __isnanl((y)))) &&
(x) <= (y))
;
3458#else
3459 not_here("islessequal");
3460#endif
3461 break;
3462 case 10:
3463#ifdef c99_islessgreaterislessgreater
3464 RETVAL = c99_islessgreater(x, y)(!(((sizeof ((x)) == sizeof (float)) ? __isnanf((x)) : (sizeof
((x)) == sizeof (double)) ? __isnan((x)) : __isnanl((x))) ||
((sizeof ((y)) == sizeof (float)) ? __isnanf((y)) : (sizeof (
(y)) == sizeof (double)) ? __isnan((y)) : __isnanl((y)))) &&
((x) > (y) || (y) > (x)))
;
3465#else
3466 not_here("islessgreater");
3467#endif
3468 break;
3469 case 11:
3470#ifdef c99_isunorderedisunordered
3471 RETVAL = c99_isunordered(x, y)(((sizeof (x) == sizeof (float)) ? __isnanf(x) : (sizeof (x) ==
sizeof (double)) ? __isnan(x) : __isnanl(x)) || ((sizeof (y)
== sizeof (float)) ? __isnanf(y) : (sizeof (y) == sizeof (double
)) ? __isnan(y) : __isnanl(y)))
;
3472#else
3473 not_here("isunordered");
3474#endif
3475 break;
3476 case 12:
3477#ifdef c99_nextafternextafter
3478 RETVAL = c99_nextafternextafter(x, y);
3479#else
3480 not_here("nextafter");
3481#endif
3482 break;
3483 case 13:
3484#ifdef c99_nexttowardnexttoward
3485 RETVAL = c99_nexttowardnexttoward(x, y);
3486#else
3487 not_here("nexttoward");
3488#endif
3489 break;
3490 case 14:
3491 default:
3492#ifdef c99_remainderremainder
3493 RETVAL = c99_remainderremainder(x, y);
3494#else
3495 not_here("remainder");
3496#endif
3497 break;
3498 }
3499#line 3500 "POSIX.c"
3500 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHn((NV)RETVAL)do { do { NV TARGn_nv = (NV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000))) == SVt_NV) & (1 ? !
(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)0),(0))
) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0),(1))) {
((void)0); (targ)->sv_flags |= (0x00000200|0x00002000); do
{ ((void)0); ((void)0); (((XPVNV*)(targ)->sv_any)->xnv_u
.xnv_nv = (TARGn_nv)); } while (0); } else Perl_sv_setnv_mg( targ
,TARGn_nv); } while (0); (*++sp = (targ)); } while (0)
;
3501 }
3502 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
3503}
3504
3505
3506XS_EUPXS(XS_POSIX_frexp)static void XS_POSIX_frexp( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
3507XS_EUPXS(XS_POSIX_frexp)static void XS_POSIX_frexp( CV* cv __attribute__((unused)))
3508{
3509 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
3510 if (items != 1)
3511 croak_xs_usagePerl_croak_xs_usage(cv, "x");
3512 PERL_UNUSED_VAR(ax)((void)sizeof(ax)); /* -Wall */
3513 SPsp -= items;
3514 {
3515 NV x = (NV)SvNV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (0)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (0
)],2))
3516;
3517#line 2825 "POSIX.xs"
3518 int expvar;
3519 /* (We already know stack is long enough.) */
3520 PUSHs(sv_2mortal(newSVnv(Perl_frexp(x,&expvar))))(*++sp = (Perl_sv_2mortal( Perl_newSVnv( frexp(x,&expvar)
))))
; /* C89 math */
3521 PUSHs(sv_2mortal(newSViv(expvar)))(*++sp = (Perl_sv_2mortal( Perl_newSViv( expvar))));
3522#line 3523 "POSIX.c"
3523 PUTBACKPL_stack_sp = sp;
3524 return;
3525 }
3526}
3527
3528
3529XS_EUPXS(XS_POSIX_ldexp)static void XS_POSIX_ldexp( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
3530XS_EUPXS(XS_POSIX_ldexp)static void XS_POSIX_ldexp( CV* cv __attribute__((unused)))
3531{
3532 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
3533 if (items != 2)
3534 croak_xs_usagePerl_croak_xs_usage(cv, "x, exp");
3535 {
3536 NV x = (NV)SvNV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (0)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (0
)],2))
3537;
3538 int exp = (int)SvIV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (1)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
1)],2))
3539;
3540 NV RETVAL;
3541 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
3542#line 2835 "POSIX.xs"
3543 RETVAL = Perl_ldexp(x, exp)ldexp(x,exp);
3544#line 3545 "POSIX.c"
3545 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHn((NV)RETVAL)do { do { NV TARGn_nv = (NV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000))) == SVt_NV) & (1 ? !
(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)0),(0))
) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0),(1))) {
((void)0); (targ)->sv_flags |= (0x00000200|0x00002000); do
{ ((void)0); ((void)0); (((XPVNV*)(targ)->sv_any)->xnv_u
.xnv_nv = (TARGn_nv)); } while (0); } else Perl_sv_setnv_mg( targ
,TARGn_nv); } while (0); (*++sp = (targ)); } while (0)
;
3546 }
3547 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
3548}
3549
3550
3551XS_EUPXS(XS_POSIX_modf)static void XS_POSIX_modf( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
3552XS_EUPXS(XS_POSIX_modf)static void XS_POSIX_modf( CV* cv __attribute__((unused)))
3553{
3554 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
3555 if (items != 1)
3556 croak_xs_usagePerl_croak_xs_usage(cv, "x");
3557 PERL_UNUSED_VAR(ax)((void)sizeof(ax)); /* -Wall */
3558 SPsp -= items;
3559 {
3560 NV x = (NV)SvNV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (0)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (0
)],2))
3561;
3562#line 2843 "POSIX.xs"
3563 NV intvar;
3564 /* (We already know stack is long enough.) */
3565 PUSHs(sv_2mortal(newSVnv(Perl_modf(x,&intvar))))(*++sp = (Perl_sv_2mortal( Perl_newSVnv( modf(x,&intvar))
)))
; /* C89 math */
3566 PUSHs(sv_2mortal(newSVnv(intvar)))(*++sp = (Perl_sv_2mortal( Perl_newSVnv( intvar))));
3567#line 3568 "POSIX.c"
3568 PUTBACKPL_stack_sp = sp;
3569 return;
3570 }
3571}
3572
3573
3574XS_EUPXS(XS_POSIX_remquo)static void XS_POSIX_remquo( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
3575XS_EUPXS(XS_POSIX_remquo)static void XS_POSIX_remquo( CV* cv __attribute__((unused)))
3576{
3577 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
3578 if (items != 2)
3579 croak_xs_usagePerl_croak_xs_usage(cv, "x, y");
3580 PERL_UNUSED_VAR(ax)((void)sizeof(ax)); /* -Wall */
3581 SPsp -= items;
3582 {
3583 NV x = (NV)SvNV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (0)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (0
)],2))
3584;
3585 NV y = (NV)SvNV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (1)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (1
)],2))
3586;
3587#line 2853 "POSIX.xs"
3588#ifdef c99_remquoremquo
3589 int intvar;
3590 PUSHs(sv_2mortal(newSVnv(c99_remquo(x,y,&intvar))))(*++sp = (Perl_sv_2mortal( Perl_newSVnv( remquo(x,y,&intvar
)))))
;
3591 PUSHs(sv_2mortal(newSVnv(intvar)))(*++sp = (Perl_sv_2mortal( Perl_newSVnv( intvar))));
3592#else
3593 PERL_UNUSED_VAR(x)((void)sizeof(x));
3594 PERL_UNUSED_VAR(y)((void)sizeof(y));
3595 not_here("remquo");
3596#endif
3597#line 3598 "POSIX.c"
3598 PUTBACKPL_stack_sp = sp;
3599 return;
3600 }
3601}
3602
3603
3604XS_EUPXS(XS_POSIX_scalbn)static void XS_POSIX_scalbn( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
3605XS_EUPXS(XS_POSIX_scalbn)static void XS_POSIX_scalbn( CV* cv __attribute__((unused)))
3606{
3607 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
3608 if (items != 2)
3609 croak_xs_usagePerl_croak_xs_usage(cv, "x, y");
3610 {
3611 NV x = (NV)SvNV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (0)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (0
)],2))
3612;
3613 IV y = (IV)SvIV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (1)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
1)],2))
3614;
3615 NV RETVAL;
3616 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
3617#line 2868 "POSIX.xs"
3618#ifdef c99_scalbnscalbn
3619 RETVAL = c99_scalbnscalbn(x, y);
3620#else
3621 PERL_UNUSED_VAR(x)((void)sizeof(x));
3622 PERL_UNUSED_VAR(y)((void)sizeof(y));
3623 RETVAL = NV_NANPL_nan.nv;
3624 not_here("scalbn");
3625#endif
3626#line 3627 "POSIX.c"
3627 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHn((NV)RETVAL)do { do { NV TARGn_nv = (NV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000))) == SVt_NV) & (1 ? !
(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)0),(0))
) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0),(1))) {
((void)0); (targ)->sv_flags |= (0x00000200|0x00002000); do
{ ((void)0); ((void)0); (((XPVNV*)(targ)->sv_any)->xnv_u
.xnv_nv = (TARGn_nv)); } while (0); } else Perl_sv_setnv_mg( targ
,TARGn_nv); } while (0); (*++sp = (targ)); } while (0)
;
3628 }
3629 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
3630}
3631
3632
3633XS_EUPXS(XS_POSIX_fma)static void XS_POSIX_fma( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
3634XS_EUPXS(XS_POSIX_fma)static void XS_POSIX_fma( CV* cv __attribute__((unused)))
3635{
3636 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
3637 if (items != 3)
3638 croak_xs_usagePerl_croak_xs_usage(cv, "x, y, z");
3639 {
3640 NV x = (NV)SvNV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (0)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (0
)],2))
3641;
3642 NV y = (NV)SvNV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (1)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (1
)],2))
3643;
3644 NV z = (NV)SvNV(ST(2))((((PL_stack_base[ax + (2)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (2)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (2
)],2))
3645;
3646 NV RETVAL;
3647 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
3648#line 2885 "POSIX.xs"
3649#ifdef c99_fmafma
3650 RETVAL = c99_fmafma(x, y, z);
3651#else
3652 PERL_UNUSED_VAR(x)((void)sizeof(x));
3653 PERL_UNUSED_VAR(y)((void)sizeof(y));
3654 PERL_UNUSED_VAR(z)((void)sizeof(z));
3655 not_here("fma");
3656#endif
3657#line 3658 "POSIX.c"
3658 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHn((NV)RETVAL)do { do { NV TARGn_nv = (NV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000))) == SVt_NV) & (1 ? !
(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)0),(0))
) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0),(1))) {
((void)0); (targ)->sv_flags |= (0x00000200|0x00002000); do
{ ((void)0); ((void)0); (((XPVNV*)(targ)->sv_any)->xnv_u
.xnv_nv = (TARGn_nv)); } while (0); } else Perl_sv_setnv_mg( targ
,TARGn_nv); } while (0); (*++sp = (targ)); } while (0)
;
3659 }
3660 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
3661}
3662
3663
3664XS_EUPXS(XS_POSIX_nan)static void XS_POSIX_nan( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
3665XS_EUPXS(XS_POSIX_nan)static void XS_POSIX_nan( CV* cv __attribute__((unused)))
3666{
3667 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
3668 if (items < 0 || items > 1)
3669 croak_xs_usagePerl_croak_xs_usage(cv, "payload = 0");
3670 {
3671 NV payload;
3672 NV RETVAL;
3673 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
3674
3675 if (items < 1)
3676 payload = 0;
3677 else {
3678 payload = (NV)SvNV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (0)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (0
)],2))
3679;
3680 }
3681#line 2900 "POSIX.xs"
3682#ifdef NV_NANPL_nan.nv
3683 /* If no payload given, just return the default NaN.
3684 * This makes a difference in platforms where the default
3685 * NaN is not all zeros. */
3686 if (items == 0) {
3687 RETVAL = NV_NANPL_nan.nv;
3688 } else {
3689 S_setpayload(&RETVAL, payload, FALSE(0));
3690 }
3691#elif defined(c99_nannan)
3692 {
3693 STRLEN elen = my_snprintf(PL_efloatbuf, PL_efloatsize, "%g", payload)({ int len = snprintf(PL_efloatbuf, PL_efloatsize, "%g", payload
); do { if ((PL_efloatsize) > 0 && (size_t)len >
(PL_efloatsize)) Perl_croak("panic: %s buffer overflow", "snprintf"
); } while (0); len; })
;
3694 if ((IV)elen == -1) {
3695#ifdef NV_NANPL_nan.nv
3696 RETVAL = NV_NANPL_nan.nv;
3697#else
3698 RETVAL = 0.0;
3699 not_here("nan");
3700#endif
3701 } else {
3702 RETVAL = c99_nannan(PL_efloatbuf);
3703 }
3704 }
3705#else
3706 not_here("nan");
3707#endif
3708#line 3709 "POSIX.c"
3709 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHn((NV)RETVAL)do { do { NV TARGn_nv = (NV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000))) == SVt_NV) & (1 ? !
(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)0),(0))
) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0),(1))) {
((void)0); (targ)->sv_flags |= (0x00000200|0x00002000); do
{ ((void)0); ((void)0); (((XPVNV*)(targ)->sv_any)->xnv_u
.xnv_nv = (TARGn_nv)); } while (0); } else Perl_sv_setnv_mg( targ
,TARGn_nv); } while (0); (*++sp = (targ)); } while (0)
;
3710 }
3711 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
3712}
3713
3714
3715XS_EUPXS(XS_POSIX_jn)static void XS_POSIX_jn( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
3716XS_EUPXS(XS_POSIX_jn)static void XS_POSIX_jn( CV* cv __attribute__((unused)))
3717{
3718 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
3719 dXSI32I32 ix = ((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->
xcv_start_u.xcv_xsubany.any_i32
;
3720 if (items != 2)
3721 croak_xs_usagePerl_croak_xs_usage(cv, "x, y");
3722 {
3723 IV x = (IV)SvIV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (0)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
0)],2))
3724;
3725 NV y = (NV)SvNV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (1)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (1
)],2))
3726;
3727 NV RETVAL;
3728 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
3729#line 2936 "POSIX.xs"
3730#ifdef NV_NANPL_nan.nv
3731 RETVAL = NV_NANPL_nan.nv;
3732#else
3733 RETVAL = 0;
3734#endif
3735 switch (ix) {
3736 case 0:
3737#ifdef bessel_jnjn
3738 RETVAL = bessel_jnjn(x, y);
3739#else
3740 PERL_UNUSED_VAR(x)((void)sizeof(x));
3741 PERL_UNUSED_VAR(y)((void)sizeof(y));
3742 not_here("jn");
3743#endif
3744 break;
3745 case 1:
3746 default:
3747#ifdef bessel_ynyn
3748 RETVAL = bessel_ynyn(x, y);
3749#else
3750 PERL_UNUSED_VAR(x)((void)sizeof(x));
3751 PERL_UNUSED_VAR(y)((void)sizeof(y));
3752 not_here("yn");
3753#endif
3754 break;
3755 }
3756#line 3757 "POSIX.c"
3757 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHn((NV)RETVAL)do { do { NV TARGn_nv = (NV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000))) == SVt_NV) & (1 ? !
(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)0),(0))
) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0),(1))) {
((void)0); (targ)->sv_flags |= (0x00000200|0x00002000); do
{ ((void)0); ((void)0); (((XPVNV*)(targ)->sv_any)->xnv_u
.xnv_nv = (TARGn_nv)); } while (0); } else Perl_sv_setnv_mg( targ
,TARGn_nv); } while (0); (*++sp = (targ)); } while (0)
;
3758 }
3759 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
3760}
3761
3762
3763XS_EUPXS(XS_POSIX_sigaction)static void XS_POSIX_sigaction( CV* cv __attribute__((unused)
))
; /* prototype to pass -Wmissing-prototypes */
3764XS_EUPXS(XS_POSIX_sigaction)static void XS_POSIX_sigaction( CV* cv __attribute__((unused)
))
3765{
3766 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
3767 if (items < 2 || items > 3)
1
Assuming 'items' is >= 2
2
Assuming 'items' is <= 3
3
Taking false branch
3768 croak_xs_usagePerl_croak_xs_usage(cv, "sig, optaction, oldaction = 0");
3769 {
3770 int sig = (int)SvIV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (0)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
0)],2))
4
Assuming the condition is false
5
'?' condition is false
3771;
3772 SV * optaction = ST(1)PL_stack_base[ax + (1)]
3773;
3774 POSIX__SigAction oldaction;
3775 SysRet RETVAL;
3776
3777 if (items < 3)
6
Assuming 'items' is >= 3
7
Taking false branch
3778 oldaction = 0;
3779 else {
3780 STMT_STARTdo {
13
Loop condition is false. Exiting loop
3781 SV* const xsub_tmp_sv = ST(2)PL_stack_base[ax + (2)];
3782 SvGETMAGIC(xsub_tmp_sv)((void)(__builtin_expect(((((xsub_tmp_sv)->sv_flags & 0x00200000
)) ? (_Bool)1 : (_Bool)0),(0)) && Perl_mg_get( xsub_tmp_sv
)))
;
8
Assuming the condition is false
9
'?' condition is false
3783 if (SvROK(xsub_tmp_sv)((xsub_tmp_sv)->sv_flags & 0x00000800) && SvTYPE(SvRV(xsub_tmp_sv))((svtype)((((xsub_tmp_sv)->sv_u.svu_rv))->sv_flags &
0xff))
== SVt_PVHV
){
10
Assuming the condition is true
11
Assuming the condition is true
12
Taking true branch
3784 oldaction = (HV*)SvRV(xsub_tmp_sv)((xsub_tmp_sv)->sv_u.svu_rv);
3785 }
3786 else{
3787 Perl_croak_nocontextPerl_croak("%s: %s is not a HASH reference",
3788 "POSIX::sigaction",
3789 "oldaction");
3790 }
3791 } STMT_ENDwhile (0)
3792;
3793 }
3794#line 2971 "POSIX.xs"
3795#if defined(WIN32) || defined(NETWARE) || (defined(__amigaos4__) && defined(__NEWLIB__))
3796 RETVAL = not_here("sigaction");
3797#else
3798
3799 {
3800 dVARstruct Perl___notused_struct;
3801 POSIX__SigAction action;
3802 GV *siggv = gv_fetchpvs("SIG", GV_ADD, SVt_PVHV)Perl_gv_fetchpvn_flags( ("" "SIG" ""), (sizeof("SIG")-1), 0x01
, SVt_PVHV)
;
3803 struct sigaction act;
3804 struct sigaction oact;
3805 sigset_t sset;
3806 SV *osset_sv;
3807 sigset_t osset;
3808 POSIX__SigSet sigset;
3809 SV** svp;
3810 SV** sigsvp;
3811
3812 if (sig < 0) {
14
Assuming 'sig' is >= 0
15
Taking false branch
3813 croakPerl_croak("Negative signals are not allowed");
3814 }
3815
3816 if (sig == 0 && SvPOK(ST(0))((PL_stack_base[ax + (0)])->sv_flags & 0x00000400)) {
16
Assuming 'sig' is not equal to 0
3817 const char *s = SvPVX_const(ST(0))((const char*)(0 + (PL_stack_base[ax + (0)])->sv_u.svu_pv)
)
;
3818 int i = whichsig(s)Perl_whichsig_pv( s);
3819
3820 if (i < 0 && memBEGINs(s, SvCUR(ST(0)), "SIG")( (ptrdiff_t) (((XPV*) (PL_stack_base[ax + (0)])->sv_any)->
xpv_cur) >= (ptrdiff_t) sizeof("SIG") - 1 && (memcmp
(((const void *) (s)), ((const void *) ("" "SIG" "")), sizeof
("SIG")-1) == 0))
)
3821 i = whichsig(s + 3)Perl_whichsig_pv( s + 3);
3822 if (i < 0) {
3823 if (ckWARN(WARN_SIGNAL)Perl_ckwarn( (26 )))
3824 Perl_warner(aTHX_ packWARN(WARN_SIGNAL)(26 ),
3825 "No such signal: SIG%s", s);
3826 XSRETURN_UNDEFdo { (PL_stack_base[ax + (0)] = &(PL_sv_immortals[1])); do
{ const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0); } while (0)
;
3827 }
3828 else
3829 sig = i;
3830 }
3831#ifdef NSIG33
3832 if (sig > NSIG33) { /* NSIG - 1 is still okay. */
17
Assuming 'sig' is <= NSIG
18
Taking false branch
3833 Perl_warner(aTHX_ packWARN(WARN_SIGNAL)(26 ),
3834 "No such signal: %d", sig);
3835 XSRETURN_UNDEFdo { (PL_stack_base[ax + (0)] = &(PL_sv_immortals[1])); do
{ const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0); } while (0)
;
3836 }
3837#endif
3838 sigsvp = hv_fetch(GvHVn(siggv),((SV**) Perl_hv_common_key_len( (((0+(siggv)->sv_u.svu_gp)
->gp_hv ? (0+(siggv)->sv_u.svu_gp)->gp_hv : (0+(Perl_gv_add_by_type
( (siggv),SVt_PVHV))->sv_u.svu_gp)->gp_hv)),(PL_sig_name
[sig]),(strlen(PL_sig_name[sig])),((1)) ? (0x20 | 0x10) : 0x20
,((void*)0),0))
19
Assuming field 'gp_hv' is non-null
20
'?' condition is true
21
'?' condition is true
3839 PL_sig_name[sig],((SV**) Perl_hv_common_key_len( (((0+(siggv)->sv_u.svu_gp)
->gp_hv ? (0+(siggv)->sv_u.svu_gp)->gp_hv : (0+(Perl_gv_add_by_type
( (siggv),SVt_PVHV))->sv_u.svu_gp)->gp_hv)),(PL_sig_name
[sig]),(strlen(PL_sig_name[sig])),((1)) ? (0x20 | 0x10) : 0x20
,((void*)0),0))
3840 strlen(PL_sig_name[sig]),((SV**) Perl_hv_common_key_len( (((0+(siggv)->sv_u.svu_gp)
->gp_hv ? (0+(siggv)->sv_u.svu_gp)->gp_hv : (0+(Perl_gv_add_by_type
( (siggv),SVt_PVHV))->sv_u.svu_gp)->gp_hv)),(PL_sig_name
[sig]),(strlen(PL_sig_name[sig])),((1)) ? (0x20 | 0x10) : 0x20
,((void*)0),0))
3841 TRUE)((SV**) Perl_hv_common_key_len( (((0+(siggv)->sv_u.svu_gp)
->gp_hv ? (0+(siggv)->sv_u.svu_gp)->gp_hv : (0+(Perl_gv_add_by_type
( (siggv),SVt_PVHV))->sv_u.svu_gp)->gp_hv)),(PL_sig_name
[sig]),(strlen(PL_sig_name[sig])),((1)) ? (0x20 | 0x10) : 0x20
,((void*)0),0))
;
3842
3843 /* Check optaction and set action */
3844 if(SvTRUE(optaction)Perl_SvTRUE( optaction)) {
22
Calling 'Perl_SvTRUE'
31
Returning from 'Perl_SvTRUE'
32
Assuming the condition is true
33
Taking true branch
3845 if(sv_isa(optaction, "POSIX::SigAction")Perl_sv_isa( optaction,"POSIX::SigAction"))
34
Assuming the condition is true
35
Taking true branch
3846 action = (HV*)SvRV(optaction)((optaction)->sv_u.svu_rv);
3847 else
3848 croakPerl_croak("action is not of type POSIX::SigAction");
3849 }
3850 else {
3851 action=0;
3852 }
3853
3854 /* sigaction() is supposed to look atomic. In particular, any
3855 * signal handler invoked during a sigaction() call should
3856 * see either the old or the new disposition, and not something
3857 * in between. We use sigprocmask() to make it so.
3858 */
3859 sigfillset(&sset);
3860 RETVAL=sigprocmask(SIG_BLOCK1, &sset, &osset);
3861 if(RETVAL == -1)
36
Assuming the condition is false
37
Taking false branch
3862 XSRETURN_UNDEFdo { (PL_stack_base[ax + (0)] = &(PL_sv_immortals[1])); do
{ const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0); } while (0)
;
3863 ENTERPerl_push_scope();
3864 /* Restore signal mask no matter how we exit this block. */
3865 osset_sv = newSVpvn((char *)(&osset), sizeof(sigset_t))Perl_newSVpvn( (char *)(&osset),sizeof(sigset_t));
3866 SAVEFREESV( osset_sv )Perl_save_pushptr( (void *)(((SV *)({ void *_p = (osset_sv); _p
; }))),11)
;
3867 SAVEDESTRUCTOR_X(restore_sigmask, osset_sv)Perl_save_destructor_x( (DESTRUCTORFUNC_t)(restore_sigmask),(
void*)(osset_sv))
;
3868
3869 RETVAL=-1; /* In case both oldaction and action are 0. */
3870
3871 /* Remember old disposition if desired. */
3872 if (oldaction
37.1
'oldaction' is non-null
37.1
'oldaction' is non-null
) {
38
Taking true branch
3873 int safe;
3874
3875 svp = hv_fetchs(oldaction, "HANDLER", TRUE)((SV**) Perl_hv_common_key_len( ((oldaction)),(("" "HANDLER" ""
)),((sizeof("HANDLER")-1)),(((1))) ? (0x20 | 0x10) : 0x20,((void
*)0),0))
;
39
'?' condition is true
3876 if(!svp)
40
Assuming 'svp' is non-null
41
Taking false branch
3877 croakPerl_croak("Can't supply an oldaction without a HANDLER");
3878 if(SvTRUE(*sigsvp)Perl_SvTRUE( *sigsvp)) { /* TBD: what if "0"? */
42
Calling 'Perl_SvTRUE'
46
Returning from 'Perl_SvTRUE'
47
Taking false branch
3879 sv_setsv(*svp, *sigsvp)Perl_sv_setsv_flags( *svp,*sigsvp,2|0);
3880 }
3881 else {
3882 sv_setpvs(*svp, "DEFAULT")Perl_sv_setpvn( *svp, ("" "DEFAULT" ""), (sizeof("DEFAULT")-1
))
;
3883 }
3884 RETVAL = sigaction(sig, (struct sigaction *)0, & oact);
3885 if(RETVAL == -1) {
48
Assuming the condition is false
49
Taking false branch
3886 LEAVEPerl_pop_scope();
3887 XSRETURN_UNDEFdo { (PL_stack_base[ax + (0)] = &(PL_sv_immortals[1])); do
{ const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0); } while (0)
;
3888 }
3889 /* Get back the mask. */
3890 svp = hv_fetchs(oldaction, "MASK", TRUE)((SV**) Perl_hv_common_key_len( ((oldaction)),(("" "MASK" "")
),((sizeof("MASK")-1)),(((1))) ? (0x20 | 0x10) : 0x20,((void*
)0),0))
;
50
'?' condition is true
3891 if (sv_isa(*svp, "POSIX::SigSet")Perl_sv_isa( *svp,"POSIX::SigSet")) {
51
Assuming the condition is false
52
Taking false branch
3892 sigset = (sigset_t *) SvPV_nolen(SvRV(*svp))((((((*svp)->sv_u.svu_rv))->sv_flags & (0x00000400|
0x00200000)) == 0x00000400) ? ((((*svp)->sv_u.svu_rv))->
sv_u.svu_pv) : Perl_sv_2pv_flags( ((*svp)->sv_u.svu_rv),0,
2))
;
3893 }
3894 else {
3895 sigset = (sigset_t *) allocate_struct(aTHX_ *svp,
3896 sizeof(sigset_t),
3897 "POSIX::SigSet");
3898 }
3899 *sigset = oact.sa_mask;
3900
3901 /* Get back the flags. */
3902 svp = hv_fetchs(oldaction, "FLAGS", TRUE)((SV**) Perl_hv_common_key_len( ((oldaction)),(("" "FLAGS" ""
)),((sizeof("FLAGS")-1)),(((1))) ? (0x20 | 0x10) : 0x20,((void
*)0),0))
;
53
'?' condition is true
3903 sv_setiv(*svp, oact.sa_flags)Perl_sv_setiv( *svp,oact.sa_flags);
3904
3905 /* Get back whether the old handler used safe signals;
3906 * i.e. it used Perl_csighandler[13] rather than
3907 * Perl_sighandler[13]
3908 */
3909 safe =
3910#ifdef SA_SIGINFO0x0040
3911 (oact.sa_flags & SA_SIGINFO0x0040)
54
Assuming the condition is true
55
'?' condition is true
3912 ? ( oact.sa_sigaction__sigaction_u.__sa_sigaction == PL_csighandler3p
56
Assuming 'PL_csighandler3p' is not equal to field '__sa_sigaction'
3913#ifdef PERL_USE_3ARG_SIGHANDLER
3914 || oact.sa_sigaction__sigaction_u.__sa_sigaction == PL_csighandlerp
3915#endif
3916 )
3917 :
3918#endif
3919 ( oact.sa_handler__sigaction_u.__sa_handler == PL_csighandler1p
3920#ifndef PERL_USE_3ARG_SIGHANDLER
3921 || oact.sa_handler__sigaction_u.__sa_handler == PL_csighandlerp
3922#endif
3923 );
3924
3925 svp = hv_fetchs(oldaction, "SAFE", TRUE)((SV**) Perl_hv_common_key_len( ((oldaction)),(("" "SAFE" "")
),((sizeof("SAFE")-1)),(((1))) ? (0x20 | 0x10) : 0x20,((void*
)0),0))
;
57
'?' condition is true
3926 sv_setiv(*svp, safe)Perl_sv_setiv( *svp,safe);
3927 }
3928
3929 if (action) {
58
Assuming 'action' is non-null
59
Taking true branch
3930 int safe;
3931
3932 /* Set up any desired flags. */
3933 svp = hv_fetchs(action, "FLAGS", FALSE)((SV**) Perl_hv_common_key_len( ((action)),(("" "FLAGS" "")),
((sizeof("FLAGS")-1)),(((0))) ? (0x20 | 0x10) : 0x20,((void*)
0),0))
;
60
'?' condition is false
3934 act.sa_flags = svp ? SvIV(*svp)((((*svp)->sv_flags & (0x00000100|0x00200000)) == 0x00000100
) ? ((XPVIV*) (*svp)->sv_any)->xiv_u.xivu_iv : Perl_sv_2iv_flags
( *svp,2))
: 0;
61
Assuming 'svp' is null
62
'?' condition is false
3935
3936 /* Safe signals use "csighandler", which vectors through the
3937 PL_sighandlerp pointer when it's safe to do so.
3938 (BTW, "csighandler" is very different from "sighandler".) */
3939 svp = hv_fetchs(action, "SAFE", FALSE)((SV**) Perl_hv_common_key_len( ((action)),(("" "SAFE" "")),(
(sizeof("SAFE")-1)),(((0))) ? (0x20 | 0x10) : 0x20,((void*)0)
,0))
;
63
'?' condition is false
3940 safe = *svp && SvTRUE(*svp)Perl_SvTRUE( *svp);
64
Assuming the condition is false
3941#ifdef SA_SIGINFO0x0040
3942 if (act.sa_flags & SA_SIGINFO0x0040) {
65
Taking false branch
3943 /* 3-arg handler */
3944 act.sa_sigaction__sigaction_u.__sa_sigaction =
3945 safe ? PL_csighandler3p : PL_sighandler3p;
3946 }
3947 else
3948#endif
3949 {
3950 /* 1-arg handler */
3951 act.sa_handler__sigaction_u.__sa_handler =
3952 safe
65.1
'safe' is 0
65.1
'safe' is 0
? PL_csighandler1p : PL_sighandler1p;
66
'?' condition is false
3953 }
3954
3955 /* Vector new Perl handler through %SIG.
3956 (The core signal handlers read %SIG to dispatch.) */
3957 svp = hv_fetchs(action, "HANDLER", FALSE)((SV**) Perl_hv_common_key_len( ((action)),(("" "HANDLER" "")
),((sizeof("HANDLER")-1)),(((0))) ? (0x20 | 0x10) : 0x20,((void
*)0),0))
;
67
'?' condition is false
3958 if (!svp)
68
Assuming 'svp' is non-null
69
Taking false branch
3959 croakPerl_croak("Can't supply an action without a HANDLER");
3960 sv_setsv(*sigsvp, *svp)Perl_sv_setsv_flags( *sigsvp,*svp,2|0);
3961
3962 /* This call actually calls sigaction() with almost the
3963 right settings, including appropriate interpretation
3964 of DEFAULT and IGNORE. However, why are we doing
3965 this when we're about to do it again just below? XXX */
3966 SvSETMAGIC(*sigsvp)do { if (__builtin_expect(((((*sigsvp)->sv_flags & 0x00400000
)) ? (_Bool)1 : (_Bool)0),(0))) Perl_mg_set( *sigsvp); } while
(0)
;
70
Access to field 'sv_flags' results in a dereference of a null pointer
3967
3968 /* And here again we duplicate -- DEFAULT/IGNORE checking. */
3969 if(SvPOK(*svp)((*svp)->sv_flags & 0x00000400)) {
3970 const char *s=SvPVX_const(*svp)((const char*)(0 + (*svp)->sv_u.svu_pv));
3971 if(strEQ(s,"IGNORE")(strcmp(s,"IGNORE") == 0)) {
3972 act.sa_handler__sigaction_u.__sa_handler = SIG_IGN(void (*)(int))1;
3973 }
3974 else if(strEQ(s,"DEFAULT")(strcmp(s,"DEFAULT") == 0)) {
3975 act.sa_handler__sigaction_u.__sa_handler = SIG_DFL(void (*)(int))0;
3976 }
3977 }
3978
3979 /* Set up any desired mask. */
3980 svp = hv_fetchs(action, "MASK", FALSE)((SV**) Perl_hv_common_key_len( ((action)),(("" "MASK" "")),(
(sizeof("MASK")-1)),(((0))) ? (0x20 | 0x10) : 0x20,((void*)0)
,0))
;
3981 if (svp && sv_isa(*svp, "POSIX::SigSet")Perl_sv_isa( *svp,"POSIX::SigSet")) {
3982 sigset = (sigset_t *) SvPV_nolen(SvRV(*svp))((((((*svp)->sv_u.svu_rv))->sv_flags & (0x00000400|
0x00200000)) == 0x00000400) ? ((((*svp)->sv_u.svu_rv))->
sv_u.svu_pv) : Perl_sv_2pv_flags( ((*svp)->sv_u.svu_rv),0,
2))
;
3983 act.sa_mask = *sigset;
3984 }
3985 else
3986 sigemptyset(& act.sa_mask);
3987
3988 /* Don't worry about cleaning up *sigsvp if this fails,
3989 * because that means we tried to disposition a
3990 * nonblockable signal, in which case *sigsvp is
3991 * essentially meaningless anyway.
3992 */
3993 RETVAL = sigaction(sig, & act, (struct sigaction *)0);
3994 if(RETVAL == -1) {
3995 LEAVEPerl_pop_scope();
3996 XSRETURN_UNDEFdo { (PL_stack_base[ax + (0)] = &(PL_sv_immortals[1])); do
{ const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0); } while (0)
;
3997 }
3998 }
3999
4000 LEAVEPerl_pop_scope();
4001 }
4002#endif
4003#line 4004 "POSIX.c"
4004 {
4005 SV * RETVALSV;
4006 RETVALSV = sv_newmortal()Perl_sv_newmortal();
4007 if (RETVAL != -1) {
4008 if (RETVAL == 0)
4009 sv_setpvn(RETVALSV, "0 but true", 10)Perl_sv_setpvn( RETVALSV,"0 but true",10);
4010 else
4011 sv_setiv(RETVALSV, (IV)RETVAL)Perl_sv_setiv( RETVALSV,(IV)RETVAL);
4012 }
4013 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
4014 }
4015 }
4016 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
4017}
4018
4019
4020XS_EUPXS(XS_POSIX_sigpending)static void XS_POSIX_sigpending( CV* cv __attribute__((unused
)))
; /* prototype to pass -Wmissing-prototypes */
4021XS_EUPXS(XS_POSIX_sigpending)static void XS_POSIX_sigpending( CV* cv __attribute__((unused
)))
4022{
4023 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4024 dXSI32I32 ix = ((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->
xcv_start_u.xcv_xsubany.any_i32
;
4025 if (items != 1)
4026 croak_xs_usagePerl_croak_xs_usage(cv, "sigset");
4027 {
4028 POSIX__SigSet sigset;
4029 SysRet RETVAL;
4030
4031 {
4032 SV * sv = ST(0)PL_stack_base[ax + (0)];
4033 if (SvROK(sv)((sv)->sv_flags & 0x00000800) && sv_derived_from(sv, "POSIX::SigSet")Perl_sv_derived_from( sv,"POSIX::SigSet"))
4034 sigset = (POSIX__SigSet)SvPV_nolen(SvRV(sv))((((((sv)->sv_u.svu_rv))->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((((sv)->sv_u.svu_rv))->sv_u.svu_pv
) : Perl_sv_2pv_flags( ((sv)->sv_u.svu_rv),0,2))
;
4035 else
4036 croakPerl_croak("%s: %s is not of type %s",
4037 GvNAME(CvGV(cv))((((XPVGV*)(Perl_CvGV( (CV *)(cv)))->sv_any)->xiv_u.xivu_namehek
))->hek_key
,
4038 "sigset", "POSIX::SigSet");
4039 }
4040;
4041#line 3190 "POSIX.xs"
4042#ifdef __amigaos4__
4043 RETVAL = not_here("sigpending");
4044#else
4045 RETVAL = ix ? sigsuspend(sigset) : sigpending(sigset);
4046#endif
4047#line 4048 "POSIX.c"
4048 {
4049 SV * RETVALSV;
4050 RETVALSV = sv_newmortal()Perl_sv_newmortal();
4051 if (RETVAL != -1) {
4052 if (RETVAL == 0)
4053 sv_setpvn(RETVALSV, "0 but true", 10)Perl_sv_setpvn( RETVALSV,"0 but true",10);
4054 else
4055 sv_setiv(RETVALSV, (IV)RETVAL)Perl_sv_setiv( RETVALSV,(IV)RETVAL);
4056 }
4057 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
4058 }
4059#line 3198 "POSIX.xs"
4060 PERL_ASYNC_CHECK()if (__builtin_expect(((PL_sig_pending) ? (_Bool)1 : (_Bool)0)
,(0))) PL_signalhook()
;
4061#line 4062 "POSIX.c"
4062 }
4063 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
4064}
4065
4066
4067XS_EUPXS(XS_POSIX_sigprocmask)static void XS_POSIX_sigprocmask( CV* cv __attribute__((unused
)))
; /* prototype to pass -Wmissing-prototypes */
4068XS_EUPXS(XS_POSIX_sigprocmask)static void XS_POSIX_sigprocmask( CV* cv __attribute__((unused
)))
4069{
4070 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4071 if (items < 2 || items > 3)
4072 croak_xs_usagePerl_croak_xs_usage(cv, "how, sigset, oldsigset = 0");
4073 {
4074 int how = (int)SvIV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (0)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
0)],2))
4075;
4076 POSIX__SigSet sigset;
4077 POSIX__SigSet oldsigset;
4078 SysRet RETVAL;
4079#line 3206 "POSIX.xs"
4080 if (! SvOK(ST(1))((PL_stack_base[ax + (1)])->sv_flags & (0x00000100|0x00000200
|0x00000400|0x00000800| 0x00001000|0x00002000|0x00004000|0x00008000
))
) {
4081 sigset = NULL((void*)0);
4082 } else if (sv_isa(ST(1), "POSIX::SigSet")Perl_sv_isa( PL_stack_base[ax + (1)],"POSIX::SigSet")) {
4083 sigset = (sigset_t *) SvPV_nolen(SvRV(ST(1)))((((((PL_stack_base[ax + (1)])->sv_u.svu_rv))->sv_flags
& (0x00000400|0x00200000)) == 0x00000400) ? ((((PL_stack_base
[ax + (1)])->sv_u.svu_rv))->sv_u.svu_pv) : Perl_sv_2pv_flags
( ((PL_stack_base[ax + (1)])->sv_u.svu_rv),0,2))
;
4084 } else {
4085 croakPerl_croak("sigset is not of type POSIX::SigSet");
4086 }
4087
4088 if (items < 3 || ! SvOK(ST(2))((PL_stack_base[ax + (2)])->sv_flags & (0x00000100|0x00000200
|0x00000400|0x00000800| 0x00001000|0x00002000|0x00004000|0x00008000
))
) {
4089 oldsigset = NULL((void*)0);
4090 } else if (sv_isa(ST(2), "POSIX::SigSet")Perl_sv_isa( PL_stack_base[ax + (2)],"POSIX::SigSet")) {
4091 oldsigset = (sigset_t *) SvPV_nolen(SvRV(ST(2)))((((((PL_stack_base[ax + (2)])->sv_u.svu_rv))->sv_flags
& (0x00000400|0x00200000)) == 0x00000400) ? ((((PL_stack_base
[ax + (2)])->sv_u.svu_rv))->sv_u.svu_pv) : Perl_sv_2pv_flags
( ((PL_stack_base[ax + (2)])->sv_u.svu_rv),0,2))
;
4092 } else {
4093 croakPerl_croak("oldsigset is not of type POSIX::SigSet");
4094 }
4095#line 4096 "POSIX.c"
4096
4097 RETVAL = sigprocmask(how, sigset, oldsigset);
4098 {
4099 SV * RETVALSV;
4100 RETVALSV = sv_newmortal()Perl_sv_newmortal();
4101 if (RETVAL != -1) {
4102 if (RETVAL == 0)
4103 sv_setpvn(RETVALSV, "0 but true", 10)Perl_sv_setpvn( RETVALSV,"0 but true",10);
4104 else
4105 sv_setiv(RETVALSV, (IV)RETVAL)Perl_sv_setiv( RETVALSV,(IV)RETVAL);
4106 }
4107 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
4108 }
4109 }
4110 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
4111}
4112
4113
4114XS_EUPXS(XS_POSIX__exit)static void XS_POSIX__exit( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
4115XS_EUPXS(XS_POSIX__exit)static void XS_POSIX__exit( CV* cv __attribute__((unused)))
4116{
4117 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4118 if (items != 1)
4119 croak_xs_usagePerl_croak_xs_usage(cv, "status");
4120 {
4121 int status = (int)SvIV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (0)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
0)],2))
4122;
4123
4124 _exit(status);
4125 }
4126 XSRETURN_EMPTYdo { do { const IV tmpXSoff = (0); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0); } while (0)
;
4127}
4128
4129
4130XS_EUPXS(XS_POSIX_dup2)static void XS_POSIX_dup2( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
4131XS_EUPXS(XS_POSIX_dup2)static void XS_POSIX_dup2( CV* cv __attribute__((unused)))
4132{
4133 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4134 if (items != 2)
4135 croak_xs_usagePerl_croak_xs_usage(cv, "fd1, fd2");
4136 {
4137 int fd1 = (int)SvIV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (0)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
0)],2))
4138;
4139 int fd2 = (int)SvIV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (1)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
1)],2))
4140;
4141 SysRet RETVAL;
4142#line 3231 "POSIX.xs"
4143 if (fd1 >= 0 && fd2 >= 0) {
4144#ifdef WIN32
4145 /* RT #98912 - More Microsoft muppetry - failing to
4146 actually implemented the well known documented POSIX
4147 behaviour for a POSIX API.
4148 http://msdn.microsoft.com/en-us/library/8syseb29.aspx */
4149 RETVAL = dup2(fd1, fd2) == -1 ? -1 : fd2;
4150#else
4151 RETVAL = dup2(fd1, fd2);
4152#endif
4153 } else {
4154 SETERRNO(EBADF,RMS_IFI)((*__errno()) = (9));
4155 RETVAL = -1;
4156 }
4157#line 4158 "POSIX.c"
4158 {
4159 SV * RETVALSV;
4160 RETVALSV = sv_newmortal()Perl_sv_newmortal();
4161 if (RETVAL != -1) {
4162 if (RETVAL == 0)
4163 sv_setpvn(RETVALSV, "0 but true", 10)Perl_sv_setpvn( RETVALSV,"0 but true",10);
4164 else
4165 sv_setiv(RETVALSV, (IV)RETVAL)Perl_sv_setiv( RETVALSV,(IV)RETVAL);
4166 }
4167 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
4168 }
4169 }
4170 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
4171}
4172
4173
4174XS_EUPXS(XS_POSIX_lseek)static void XS_POSIX_lseek( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
4175XS_EUPXS(XS_POSIX_lseek)static void XS_POSIX_lseek( CV* cv __attribute__((unused)))
4176{
4177 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4178 if (items != 3)
4179 croak_xs_usagePerl_croak_xs_usage(cv, "fd, offset, whence");
4180 {
4181 POSIX__Fd fd;
4182 Off_toff_t offset = (Off_toff_t)SvNV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (1)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (1
)],2))
4183;
4184 int whence = (int)SvIV(ST(2))((((PL_stack_base[ax + (2)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (2)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
2)],2))
4185;
4186 SV * RETVAL;
4187
4188 if ((fd = (int)SvIV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (0)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
0)],2))
) < 0) {
4189 SETERRNO(EBADF, RMS_IFI)((*__errno()) = (9));
4190 XSRETURN_IV(-1)do { (PL_stack_base[ax + (0)] = Perl_sv_2mortal( Perl_newSViv
( -1)) ); do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp
= PL_stack_base + ax + (tmpXSoff - 1); return; } while (0); }
while (0)
;
4191 }
4192;
4193#line 3254 "POSIX.xs"
4194 {
4195 Off_toff_t pos = PerlLIO_lseek(fd, offset, whence)lseek((fd), (offset), (whence));
4196 RETVAL = sizeof(Off_toff_t) > sizeof(IV)
4197 ? newSVnv((NV)pos)Perl_newSVnv( (NV)pos) : newSViv((IV)pos)Perl_newSViv( (IV)pos);
4198 }
4199#line 4200 "POSIX.c"
4200 RETVAL = sv_2mortal(RETVAL)Perl_sv_2mortal( RETVAL);
4201 ST(0)PL_stack_base[ax + (0)] = RETVAL;
4202 }
4203 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
4204}
4205
4206
4207XS_EUPXS(XS_POSIX_nice)static void XS_POSIX_nice( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
4208XS_EUPXS(XS_POSIX_nice)static void XS_POSIX_nice( CV* cv __attribute__((unused)))
4209{
4210 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4211 if (items != 1)
4212 croak_xs_usagePerl_croak_xs_usage(cv, "incr");
4213 PERL_UNUSED_VAR(ax)((void)sizeof(ax)); /* -Wall */
4214 SPsp -= items;
4215 {
4216 int incr = (int)SvIV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (0)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
0)],2))
4217;
4218#line 3266 "POSIX.xs"
4219 errno(*__errno()) = 0;
4220 if ((incr = nice(incr)) != -1 || errno(*__errno()) == 0) {
4221 if (incr == 0)
4222 XPUSHs(newSVpvs_flags("0 but true", SVs_TEMP))do { do { (void)0; if (__builtin_expect(((((1) < 0 || PL_stack_max
- (sp) < (1))) ? (_Bool)1 : (_Bool)0),(0))) { sp = Perl_stack_grow
( sp,sp,(sizeof(1) > sizeof(ssize_t) && ((ssize_t)
(1) != (1)) ? -1 : (1))); ((void)sizeof(sp)); } } while (0); *
++sp = (Perl_newSVpvn_flags( ("" "0 but true" ""), (sizeof("0 but true"
)-1), 0x00080000)); } while (0)
;
4223 else
4224 XPUSHs(sv_2mortal(newSViv(incr)))do { do { (void)0; if (__builtin_expect(((((1) < 0 || PL_stack_max
- (sp) < (1))) ? (_Bool)1 : (_Bool)0),(0))) { sp = Perl_stack_grow
( sp,sp,(sizeof(1) > sizeof(ssize_t) && ((ssize_t)
(1) != (1)) ? -1 : (1))); ((void)sizeof(sp)); } } while (0); *
++sp = (Perl_sv_2mortal( Perl_newSViv( incr))); } while (0)
;
4225 }
4226#line 4227 "POSIX.c"
4227 PUTBACKPL_stack_sp = sp;
4228 return;
4229 }
4230}
4231
4232
4233XS_EUPXS(XS_POSIX_pipe)static void XS_POSIX_pipe( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
4234XS_EUPXS(XS_POSIX_pipe)static void XS_POSIX_pipe( CV* cv __attribute__((unused)))
4235{
4236 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4237 if (items != 0)
4238 croak_xs_usagePerl_croak_xs_usage(cv, "");
4239 PERL_UNUSED_VAR(ax)((void)sizeof(ax)); /* -Wall */
4240 SPsp -= items;
4241 {
4242#line 3277 "POSIX.xs"
4243 int fds[2];
4244 if (pipe(fds) != -1) {
4245 EXTEND(SP,2)do { (void)0; if (__builtin_expect(((((2) < 0 || PL_stack_max
- (sp) < (2))) ? (_Bool)1 : (_Bool)0),(0))) { sp = Perl_stack_grow
( sp,sp,(sizeof(2) > sizeof(ssize_t) && ((ssize_t)
(2) != (2)) ? -1 : (2))); ((void)sizeof(sp)); } } while (0)
;
4246 PUSHs(sv_2mortal(newSViv(fds[0])))(*++sp = (Perl_sv_2mortal( Perl_newSViv( fds[0]))));
4247 PUSHs(sv_2mortal(newSViv(fds[1])))(*++sp = (Perl_sv_2mortal( Perl_newSViv( fds[1]))));
4248 }
4249#line 4250 "POSIX.c"
4250 PUTBACKPL_stack_sp = sp;
4251 return;
4252 }
4253}
4254
4255
4256XS_EUPXS(XS_POSIX_read)static void XS_POSIX_read( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
4257XS_EUPXS(XS_POSIX_read)static void XS_POSIX_read( CV* cv __attribute__((unused)))
4258{
4259 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4260 if (items != 3)
4261 croak_xs_usagePerl_croak_xs_usage(cv, "fd, buffer, nbytes");
4262 {
4263#line 3287 "POSIX.xs"
4264 SV *sv_buffer = SvROK(ST(1))((PL_stack_base[ax + (1)])->sv_flags & 0x00000800) ? SvRV(ST(1))((PL_stack_base[ax + (1)])->sv_u.svu_rv) : ST(1)PL_stack_base[ax + (1)];
4265#line 4266 "POSIX.c"
4266 POSIX__Fd fd;
4267 size_t nbytes = (size_t)SvUV(ST(2))((((PL_stack_base[ax + (2)])->sv_flags & (0x00000100|0x80000000
|0x00200000)) == (0x00000100|0x80000000)) ? ((XPVUV*) (PL_stack_base
[ax + (2)])->sv_any)->xuv_u.xivu_uv : Perl_sv_2uv_flags
( PL_stack_base[ax + (2)],2))
4268;
4269 char * buffer = sv_grow( sv_buffer, nbytes+1 )Perl_sv_grow( sv_buffer,nbytes+1);
4270 SysRet RETVAL;
4271
4272 if ((fd = (int)SvIV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (0)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
0)],2))
) < 0) {
4273 SETERRNO(EBADF, RMS_IFI)((*__errno()) = (9));
4274 XSRETURN_IV(-1)do { (PL_stack_base[ax + (0)] = Perl_sv_2mortal( Perl_newSViv
( -1)) ); do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp
= PL_stack_base + ax + (tmpXSoff - 1); return; } while (0); }
while (0)
;
4275 }
4276;
4277
4278 RETVAL = read(fd, buffer, nbytes);
4279 {
4280 SV * RETVALSV;
4281 RETVALSV = sv_newmortal()Perl_sv_newmortal();
4282 if (RETVAL != -1) {
4283 if (RETVAL == 0)
4284 sv_setpvn(RETVALSV, "0 but true", 10)Perl_sv_setpvn( RETVALSV,"0 but true",10);
4285 else
4286 sv_setiv(RETVALSV, (IV)RETVAL)Perl_sv_setiv( RETVALSV,(IV)RETVAL);
4287 }
4288 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
4289 }
4290#line 3293 "POSIX.xs"
4291 if (RETVAL >= 0) {
4292 SvCUR_set(sv_buffer, RETVAL)do { ((void)0); ((void)0); ((void)0); (((XPV*) (sv_buffer)->
sv_any)->xpv_cur = (RETVAL)); } while (0)
;
4293 SvPOK_only(sv_buffer)( (sv_buffer)->sv_flags &= ~((0x00000100|0x00000200|0x00000400
|0x00000800| 0x00001000|0x00002000|0x00004000|0x00008000)| 0x80000000
|0x20000000), (sv_buffer)->sv_flags |= (0x00000400|0x00004000
))
;
4294 *SvEND(sv_buffer)((sv_buffer)->sv_u.svu_pv + ((XPV*)(sv_buffer)->sv_any)
->xpv_cur)
= '\0';
4295 SvTAINTED_on(sv_buffer)do{ if(__builtin_expect((((((__builtin_expect(((PL_tainting) ?
(_Bool)1 : (_Bool)0),(0))) ? (_Bool)1 : (_Bool)0))) ? (_Bool
)1 : (_Bool)0),(0))){Perl_sv_magic( (sv_buffer),((void*)0),'t'
,((void*)0),0);} }while (0)
;
4296 }
4297#line 4298 "POSIX.c"
4298 }
4299 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
4300}
4301
4302
4303XS_EUPXS(XS_POSIX_setpgid)static void XS_POSIX_setpgid( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
4304XS_EUPXS(XS_POSIX_setpgid)static void XS_POSIX_setpgid( CV* cv __attribute__((unused)))
4305{
4306 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4307 if (items != 2)
4308 croak_xs_usagePerl_croak_xs_usage(cv, "pid, pgid");
4309 {
4310 pid_t pid = (pid_t)SvNV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (0)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (0
)],2))
4311;
4312 pid_t pgid = (pid_t)SvNV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (1)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (1
)],2))
4313;
4314 SysRet RETVAL;
4315
4316 RETVAL = setpgid(pid, pgid);
4317 {
4318 SV * RETVALSV;
4319 RETVALSV = sv_newmortal()Perl_sv_newmortal();
4320 if (RETVAL != -1) {
4321 if (RETVAL == 0)
4322 sv_setpvn(RETVALSV, "0 but true", 10)Perl_sv_setpvn( RETVALSV,"0 but true",10);
4323 else
4324 sv_setiv(RETVALSV, (IV)RETVAL)Perl_sv_setiv( RETVALSV,(IV)RETVAL);
4325 }
4326 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
4327 }
4328 }
4329 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
4330}
4331
4332
4333XS_EUPXS(XS_POSIX_setsid)static void XS_POSIX_setsid( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
4334XS_EUPXS(XS_POSIX_setsid)static void XS_POSIX_setsid( CV* cv __attribute__((unused)))
4335{
4336 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4337 if (items != 0)
4338 croak_xs_usagePerl_croak_xs_usage(cv, "");
4339 {
4340 pid_t RETVAL;
4341 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
4342
4343 RETVAL = setsid();
4344 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHn((NV)RETVAL)do { do { NV TARGn_nv = (NV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000))) == SVt_NV) & (1 ? !
(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)0),(0))
) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0),(1))) {
((void)0); (targ)->sv_flags |= (0x00000200|0x00002000); do
{ ((void)0); ((void)0); (((XPVNV*)(targ)->sv_any)->xnv_u
.xnv_nv = (TARGn_nv)); } while (0); } else Perl_sv_setnv_mg( targ
,TARGn_nv); } while (0); (*++sp = (targ)); } while (0)
;
4345 }
4346 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
4347}
4348
4349
4350XS_EUPXS(XS_POSIX_tcgetpgrp)static void XS_POSIX_tcgetpgrp( CV* cv __attribute__((unused)
))
; /* prototype to pass -Wmissing-prototypes */
4351XS_EUPXS(XS_POSIX_tcgetpgrp)static void XS_POSIX_tcgetpgrp( CV* cv __attribute__((unused)
))
4352{
4353 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4354 if (items != 1)
4355 croak_xs_usagePerl_croak_xs_usage(cv, "fd");
4356 {
4357 POSIX__Fd fd;
4358 pid_t RETVAL;
4359 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
4360
4361 if ((fd = (int)SvIV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (0)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
0)],2))
) < 0) {
4362 SETERRNO(EBADF, RMS_IFI)((*__errno()) = (9));
4363 XSRETURN_IV(-1)do { (PL_stack_base[ax + (0)] = Perl_sv_2mortal( Perl_newSViv
( -1)) ); do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp
= PL_stack_base + ax + (tmpXSoff - 1); return; } while (0); }
while (0)
;
4364 }
4365;
4366
4367 RETVAL = tcgetpgrp(fd);
4368 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHn((NV)RETVAL)do { do { NV TARGn_nv = (NV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000))) == SVt_NV) & (1 ? !
(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)0),(0))
) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0),(1))) {
((void)0); (targ)->sv_flags |= (0x00000200|0x00002000); do
{ ((void)0); ((void)0); (((XPVNV*)(targ)->sv_any)->xnv_u
.xnv_nv = (TARGn_nv)); } while (0); } else Perl_sv_setnv_mg( targ
,TARGn_nv); } while (0); (*++sp = (targ)); } while (0)
;
4369 }
4370 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
4371}
4372
4373
4374XS_EUPXS(XS_POSIX_tcsetpgrp)static void XS_POSIX_tcsetpgrp( CV* cv __attribute__((unused)
))
; /* prototype to pass -Wmissing-prototypes */
4375XS_EUPXS(XS_POSIX_tcsetpgrp)static void XS_POSIX_tcsetpgrp( CV* cv __attribute__((unused)
))
4376{
4377 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4378 if (items != 2)
4379 croak_xs_usagePerl_croak_xs_usage(cv, "fd, pgrp_id");
4380 {
4381 POSIX__Fd fd;
4382 pid_t pgrp_id = (pid_t)SvNV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (1)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (1
)],2))
4383;
4384 SysRet RETVAL;
4385
4386 if ((fd = (int)SvIV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (0)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
0)],2))
) < 0) {
4387 SETERRNO(EBADF, RMS_IFI)((*__errno()) = (9));
4388 XSRETURN_IV(-1)do { (PL_stack_base[ax + (0)] = Perl_sv_2mortal( Perl_newSViv
( -1)) ); do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp
= PL_stack_base + ax + (tmpXSoff - 1); return; } while (0); }
while (0)
;
4389 }
4390;
4391
4392 RETVAL = tcsetpgrp(fd, pgrp_id);
4393 {
4394 SV * RETVALSV;
4395 RETVALSV = sv_newmortal()Perl_sv_newmortal();
4396 if (RETVAL != -1) {
4397 if (RETVAL == 0)
4398 sv_setpvn(RETVALSV, "0 but true", 10)Perl_sv_setpvn( RETVALSV,"0 but true",10);
4399 else
4400 sv_setiv(RETVALSV, (IV)RETVAL)Perl_sv_setiv( RETVALSV,(IV)RETVAL);
4401 }
4402 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
4403 }
4404 }
4405 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
4406}
4407
4408
4409XS_EUPXS(XS_POSIX_uname)static void XS_POSIX_uname( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
4410XS_EUPXS(XS_POSIX_uname)static void XS_POSIX_uname( CV* cv __attribute__((unused)))
4411{
4412 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4413 if (items != 0)
4414 croak_xs_usagePerl_croak_xs_usage(cv, "");
4415 PERL_UNUSED_VAR(ax)((void)sizeof(ax)); /* -Wall */
4416 SPsp -= items;
4417 {
4418#line 3320 "POSIX.xs"
4419#ifdef HAS_UNAME
4420 struct utsname buf;
4421 if (uname(&buf) >= 0) {
4422 EXTEND(SP, 5)do { (void)0; if (__builtin_expect(((((5) < 0 || PL_stack_max
- (sp) < (5))) ? (_Bool)1 : (_Bool)0),(0))) { sp = Perl_stack_grow
( sp,sp,(sizeof(5) > sizeof(ssize_t) && ((ssize_t)
(5) != (5)) ? -1 : (5))); ((void)sizeof(sp)); } } while (0)
;
4423 PUSHs(newSVpvn_flags(buf.sysname, strlen(buf.sysname), SVs_TEMP))(*++sp = (Perl_newSVpvn_flags( buf.sysname,strlen(buf.sysname
),0x00080000)))
;
4424 PUSHs(newSVpvn_flags(buf.nodename, strlen(buf.nodename), SVs_TEMP))(*++sp = (Perl_newSVpvn_flags( buf.nodename,strlen(buf.nodename
),0x00080000)))
;
4425 PUSHs(newSVpvn_flags(buf.release, strlen(buf.release), SVs_TEMP))(*++sp = (Perl_newSVpvn_flags( buf.release,strlen(buf.release
),0x00080000)))
;
4426 PUSHs(newSVpvn_flags(buf.version, strlen(buf.version), SVs_TEMP))(*++sp = (Perl_newSVpvn_flags( buf.version,strlen(buf.version
),0x00080000)))
;
4427 PUSHs(newSVpvn_flags(buf.machine, strlen(buf.machine), SVs_TEMP))(*++sp = (Perl_newSVpvn_flags( buf.machine,strlen(buf.machine
),0x00080000)))
;
4428 }
4429#else
4430 uname((char *) 0); /* A stub to call not_here(). */
4431#endif
4432#line 4433 "POSIX.c"
4433 PUTBACKPL_stack_sp = sp;
4434 return;
4435 }
4436}
4437
4438
4439XS_EUPXS(XS_POSIX_write)static void XS_POSIX_write( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
4440XS_EUPXS(XS_POSIX_write)static void XS_POSIX_write( CV* cv __attribute__((unused)))
4441{
4442 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4443 if (items != 3)
4444 croak_xs_usagePerl_croak_xs_usage(cv, "fd, buffer, nbytes");
4445 {
4446 POSIX__Fd fd;
4447 char * buffer = (char *)SvPV_nolen(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((PL_stack_base[ax + (1)])->sv_u.svu_pv
) : Perl_sv_2pv_flags( PL_stack_base[ax + (1)],0,2))
4448;
4449 size_t nbytes = (size_t)SvUV(ST(2))((((PL_stack_base[ax + (2)])->sv_flags & (0x00000100|0x80000000
|0x00200000)) == (0x00000100|0x80000000)) ? ((XPVUV*) (PL_stack_base
[ax + (2)])->sv_any)->xuv_u.xivu_uv : Perl_sv_2uv_flags
( PL_stack_base[ax + (2)],2))
4450;
4451 SysRet RETVAL;
4452
4453 if ((fd = (int)SvIV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (0)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
0)],2))
) < 0) {
4454 SETERRNO(EBADF, RMS_IFI)((*__errno()) = (9));
4455 XSRETURN_IV(-1)do { (PL_stack_base[ax + (0)] = Perl_sv_2mortal( Perl_newSViv
( -1)) ); do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp
= PL_stack_base + ax + (tmpXSoff - 1); return; } while (0); }
while (0)
;
4456 }
4457;
4458
4459 RETVAL = write(fd, buffer, nbytes);
4460 {
4461 SV * RETVALSV;
4462 RETVALSV = sv_newmortal()Perl_sv_newmortal();
4463 if (RETVAL != -1) {
4464 if (RETVAL == 0)
4465 sv_setpvn(RETVALSV, "0 but true", 10)Perl_sv_setpvn( RETVALSV,"0 but true",10);
4466 else
4467 sv_setiv(RETVALSV, (IV)RETVAL)Perl_sv_setiv( RETVALSV,(IV)RETVAL);
4468 }
4469 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
4470 }
4471 }
4472 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
4473}
4474
4475
4476XS_EUPXS(XS_POSIX_abort)static void XS_POSIX_abort( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
4477XS_EUPXS(XS_POSIX_abort)static void XS_POSIX_abort( CV* cv __attribute__((unused)))
4478{
4479 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4480 if (items != 0)
4481 croak_xs_usagePerl_croak_xs_usage(cv, "");
4482 {
4483
4484 abort();
4485 }
4486 XSRETURN_EMPTYdo { do { const IV tmpXSoff = (0); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0); } while (0)
;
4487}
4488
4489#if defined(HAS_MBRLEN) && (defined(USE_ITHREADS) || ! defined(HAS_MBLEN))
4490# define USE_MBRLEN
4491#else
4492# undef USE_MBRLEN
4493#endif
4494
4495XS_EUPXS(XS_POSIX_mblen)static void XS_POSIX_mblen( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
4496XS_EUPXS(XS_POSIX_mblen)static void XS_POSIX_mblen( CV* cv __attribute__((unused)))
4497{
4498 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4499 if (items < 1 || items > 2)
4500 croak_xs_usagePerl_croak_xs_usage(cv, "s, n = ~0");
4501 {
4502 SV * s = ST(0)PL_stack_base[ax + (0)]
4503;
4504 size_t n;
4505 int RETVAL;
4506 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
4507
4508 if (items < 2)
4509 n = ~0;
4510 else {
4511 n = (size_t)SvUV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000100|0x80000000
|0x00200000)) == (0x00000100|0x80000000)) ? ((XPVUV*) (PL_stack_base
[ax + (1)])->sv_any)->xuv_u.xivu_uv : Perl_sv_2uv_flags
( PL_stack_base[ax + (1)],2))
4512;
4513 }
4514#line 3354 "POSIX.xs"
4515 errno(*__errno()) = 0;
4516
4517 SvGETMAGIC(s)((void)(__builtin_expect(((((s)->sv_flags & 0x00200000
)) ? (_Bool)1 : (_Bool)0),(0)) && Perl_mg_get( s)))
;
4518 if (! SvOK(s)((s)->sv_flags & (0x00000100|0x00000200|0x00000400|0x00000800
| 0x00001000|0x00002000|0x00004000|0x00008000))
) {
4519#ifdef USE_MBRLEN
4520 /* Initialize the shift state in PL_mbrlen_ps. The Standard says
4521 * that should be all zeros. */
4522 memzero(&PL_mbrlen_ps, sizeof(PL_mbrlen_ps))memset(&PL_mbrlen_ps,0,sizeof(PL_mbrlen_ps));
4523 RETVAL = 0;
4524#else
4525 LOCALE_LOCK;
4526 RETVAL = mblen(NULL((void*)0), 0);
4527 LOCALE_UNLOCK;
4528#endif
4529 }
4530 else { /* Not resetting state */
4531 SV * byte_s = sv_2mortal(newSVsv_nomg(s))Perl_sv_2mortal( Perl_newSVsv_flags( (s),16));
4532 if (! sv_utf8_downgrade_nomg(byte_s, TRUE)Perl_sv_utf8_downgrade_flags( byte_s,(1),0)) {
4533 SETERRNO(EINVAL, LIB_INVARG)((*__errno()) = (22));
4534 RETVAL = -1;
4535 }
4536 else {
4537 size_t len;
4538 char * string = SvPV(byte_s, len)((((byte_s)->sv_flags & (0x00000400|0x00200000)) == 0x00000400
) ? ((len = ((XPV*) (byte_s)->sv_any)->xpv_cur), ((byte_s
)->sv_u.svu_pv)) : Perl_sv_2pv_flags( byte_s,&len,2))
;
4539 if (n < len) len = n;
4540#ifdef USE_MBRLEN
4541 RETVAL = (SSize_tssize_t) mbrlen(string, len, &PL_mbrlen_ps);
4542 if (RETVAL < 0) RETVAL = -1; /* Use mblen() ret code for
4543 transparency */
4544#else
4545 /* Locking prevents races, but locales can be switched out
4546 * without locking, so this isn't a cure all */
4547 LOCALE_LOCK;
4548 RETVAL = mblen(string, len);
4549 LOCALE_UNLOCK;
4550#endif
4551 }
4552 }
4553#line 4554 "POSIX.c"
4554 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHi((IV)RETVAL)do { do { IV TARGi_iv = (IV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000)|0x80000000)) == SVt_IV) &
(1 ? !(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)
0),(0))) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0)
,(1))) { ((void)0); (targ)->sv_flags |= (0x00000100|0x00001000
); targ->sv_u.svu_iv = TARGi_iv; } else Perl_sv_setiv_mg( targ
,TARGi_iv); } while (0); (*++sp = (targ)); } while (0)
;
4555 }
4556 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
4557}
4558
4559#if defined(HAS_MBRTOWC) && (defined(USE_ITHREADS) || ! defined(HAS_MBTOWC))
4560# define USE_MBRTOWC
4561#else
4562# undef USE_MBRTOWC
4563#endif
4564
4565XS_EUPXS(XS_POSIX_mbtowc)static void XS_POSIX_mbtowc( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
4566XS_EUPXS(XS_POSIX_mbtowc)static void XS_POSIX_mbtowc( CV* cv __attribute__((unused)))
4567{
4568 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4569 if (items < 2 || items > 3)
4570 croak_xs_usagePerl_croak_xs_usage(cv, "pwc, s, n = ~0");
4571 {
4572 SV * pwc = ST(0)PL_stack_base[ax + (0)]
4573;
4574 SV * s = ST(1)PL_stack_base[ax + (1)]
4575;
4576 size_t n;
4577 int RETVAL;
4578 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
4579
4580 if (items < 3)
4581 n = ~0;
4582 else {
4583 n = (size_t)SvUV(ST(2))((((PL_stack_base[ax + (2)])->sv_flags & (0x00000100|0x80000000
|0x00200000)) == (0x00000100|0x80000000)) ? ((XPVUV*) (PL_stack_base
[ax + (2)])->sv_any)->xuv_u.xivu_uv : Perl_sv_2uv_flags
( PL_stack_base[ax + (2)],2))
4584;
4585 }
4586#line 3407 "POSIX.xs"
4587 errno(*__errno()) = 0;
4588 SvGETMAGIC(s)((void)(__builtin_expect(((((s)->sv_flags & 0x00200000
)) ? (_Bool)1 : (_Bool)0),(0)) && Perl_mg_get( s)))
;
4589 if (! SvOK(s)((s)->sv_flags & (0x00000100|0x00000200|0x00000400|0x00000800
| 0x00001000|0x00002000|0x00004000|0x00008000))
) { /* Initialize state */
4590#ifdef USE_MBRTOWC
4591 /* Initialize the shift state to all zeros in PL_mbrtowc_ps. */
4592 memzero(&PL_mbrtowc_ps, sizeof(PL_mbrtowc_ps))memset(&PL_mbrtowc_ps,0,sizeof(PL_mbrtowc_ps));
4593 RETVAL = 0;
4594#else
4595 LOCALE_LOCK;
4596 RETVAL = mbtowc(NULL((void*)0), NULL((void*)0), 0);
4597 LOCALE_UNLOCK;
4598#endif
4599 }
4600 else { /* Not resetting state */
4601 wchar_t wc;
4602 SV * byte_s = sv_2mortal(newSVsv_nomg(s))Perl_sv_2mortal( Perl_newSVsv_flags( (s),16));
4603 if (! sv_utf8_downgrade_nomg(byte_s, TRUE)Perl_sv_utf8_downgrade_flags( byte_s,(1),0)) {
4604 SETERRNO(EINVAL, LIB_INVARG)((*__errno()) = (22));
4605 RETVAL = -1;
4606 }
4607 else {
4608 size_t len;
4609 char * string = SvPV(byte_s, len)((((byte_s)->sv_flags & (0x00000400|0x00200000)) == 0x00000400
) ? ((len = ((XPV*) (byte_s)->sv_any)->xpv_cur), ((byte_s
)->sv_u.svu_pv)) : Perl_sv_2pv_flags( byte_s,&len,2))
;
4610 if (n < len) len = n;
4611#ifdef USE_MBRTOWC
4612 RETVAL = (SSize_tssize_t) mbrtowc(&wc, string, len, &PL_mbrtowc_ps);
4613#else
4614 /* Locking prevents races, but locales can be switched out
4615 * without locking, so this isn't a cure all */
4616 LOCALE_LOCK;
4617 RETVAL = mbtowc(&wc, string, len);
4618 LOCALE_UNLOCK;
4619#endif
4620 if (RETVAL >= 0) {
4621 sv_setiv_mg(pwc, wc)Perl_sv_setiv_mg( pwc,wc);
4622 }
4623 else { /* Use mbtowc() ret code for transparency */
4624 RETVAL = -1;
4625 }
4626 }
4627 }
4628#line 4629 "POSIX.c"
4629 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHi((IV)RETVAL)do { do { IV TARGi_iv = (IV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000)|0x80000000)) == SVt_IV) &
(1 ? !(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)
0),(0))) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0)
,(1))) { ((void)0); (targ)->sv_flags |= (0x00000100|0x00001000
); targ->sv_u.svu_iv = TARGi_iv; } else Perl_sv_setiv_mg( targ
,TARGi_iv); } while (0); (*++sp = (targ)); } while (0)
;
4630 }
4631 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
4632}
4633
4634#if defined(HAS_WCRTOMB) && (defined(USE_ITHREADS) || ! defined(HAS_WCTOMB))
4635# define USE_WCRTOMB
4636#else
4637# undef USE_WCRTOMB
4638#endif
4639
4640XS_EUPXS(XS_POSIX_wctomb)static void XS_POSIX_wctomb( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
4641XS_EUPXS(XS_POSIX_wctomb)static void XS_POSIX_wctomb( CV* cv __attribute__((unused)))
4642{
4643 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4644 if (items != 2)
4645 croak_xs_usagePerl_croak_xs_usage(cv, "s, wchar");
4646 {
4647 SV * s = ST(0)PL_stack_base[ax + (0)]
4648;
4649 wchar_t wchar = (wchar_t)SvIV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (1)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
1)],2))
4650;
4651 int RETVAL;
4652 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
4653#line 3462 "POSIX.xs"
4654 errno(*__errno()) = 0;
4655 SvGETMAGIC(s)((void)(__builtin_expect(((((s)->sv_flags & 0x00200000
)) ? (_Bool)1 : (_Bool)0),(0)) && Perl_mg_get( s)))
;
4656 if (s == &PL_sv_undef(PL_sv_immortals[1])) {
4657#ifdef USE_WCRTOMB
4658 /* The man pages khw looked at are in agreement that this works.
4659 * But probably memzero would too */
4660 RETVAL = wcrtomb(NULL((void*)0), L'\0', &PL_wcrtomb_ps);
4661#else
4662 LOCALE_LOCK;
4663 RETVAL = wctomb(NULL((void*)0), L'\0');
4664 LOCALE_UNLOCK;
4665#endif
4666 }
4667 else { /* Not resetting state */
4668 char buffer[MB_LEN_MAX4];
4669#ifdef USE_WCRTOMB
4670 RETVAL = wcrtomb(buffer, wchar, &PL_wcrtomb_ps);
4671#else
4672 /* Locking prevents races, but locales can be switched out without
4673 * locking, so this isn't a cure all */
4674 LOCALE_LOCK;
4675 RETVAL = wctomb(buffer, wchar);
4676 LOCALE_UNLOCK;
4677#endif
4678 if (RETVAL >= 0) {
4679 sv_setpvn_mg(s, buffer, RETVAL)Perl_sv_setpvn_mg( s,buffer,RETVAL);
4680 }
4681 }
4682#line 4683 "POSIX.c"
4683 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHi((IV)RETVAL)do { do { IV TARGi_iv = (IV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000)|0x80000000)) == SVt_IV) &
(1 ? !(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)
0),(0))) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0)
,(1))) { ((void)0); (targ)->sv_flags |= (0x00000100|0x00001000
); targ->sv_u.svu_iv = TARGi_iv; } else Perl_sv_setiv_mg( targ
,TARGi_iv); } while (0); (*++sp = (targ)); } while (0)
;
4684 }
4685 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
4686}
4687
4688
4689XS_EUPXS(XS_POSIX_strcoll)static void XS_POSIX_strcoll( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
4690XS_EUPXS(XS_POSIX_strcoll)static void XS_POSIX_strcoll( CV* cv __attribute__((unused)))
4691{
4692 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4693 if (items != 2)
4694 croak_xs_usagePerl_croak_xs_usage(cv, "s1, s2");
4695 {
4696 char * s1 = (char *)SvPV_nolen(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((PL_stack_base[ax + (0)])->sv_u.svu_pv
) : Perl_sv_2pv_flags( PL_stack_base[ax + (0)],0,2))
4697;
4698 char * s2 = (char *)SvPV_nolen(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((PL_stack_base[ax + (1)])->sv_u.svu_pv
) : Perl_sv_2pv_flags( PL_stack_base[ax + (1)],0,2))
4699;
4700 int RETVAL;
4701 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
4702
4703 RETVAL = strcoll(s1, s2);
4704 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHi((IV)RETVAL)do { do { IV TARGi_iv = (IV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000)|0x80000000)) == SVt_IV) &
(1 ? !(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)
0),(0))) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0)
,(1))) { ((void)0); (targ)->sv_flags |= (0x00000100|0x00001000
); targ->sv_u.svu_iv = TARGi_iv; } else Perl_sv_setiv_mg( targ
,TARGi_iv); } while (0); (*++sp = (targ)); } while (0)
;
4705 }
4706 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
4707}
4708
4709
4710XS_EUPXS(XS_POSIX_strtod)static void XS_POSIX_strtod( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
4711XS_EUPXS(XS_POSIX_strtod)static void XS_POSIX_strtod( CV* cv __attribute__((unused)))
4712{
4713 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4714 if (items != 1)
4715 croak_xs_usagePerl_croak_xs_usage(cv, "str");
4716 PERL_UNUSED_VAR(ax)((void)sizeof(ax)); /* -Wall */
4717 SPsp -= items;
4718 {
4719 char * str = (char *)SvPV_nolen(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((PL_stack_base[ax + (0)])->sv_u.svu_pv
) : Perl_sv_2pv_flags( PL_stack_base[ax + (0)],0,2))
4720;
4721#line 3502 "POSIX.xs"
4722 double num;
4723 char *unparsed;
4724#line 4725 "POSIX.c"
4725#line 3505 "POSIX.xs"
4726 DECLARATION_FOR_LC_NUMERIC_MANIPULATIONstruct Perl___notused_struct;
4727 STORE_LC_NUMERIC_FORCE_TO_UNDERLYING();
4728 num = strtod(str, &unparsed);
4729 RESTORE_LC_NUMERIC();
4730 PUSHs(sv_2mortal(newSVnv(num)))(*++sp = (Perl_sv_2mortal( Perl_newSVnv( num))));
4731 if (GIMME_VPerl_gimme_V() == G_ARRAY3) {
4732 EXTEND(SP, 1)do { (void)0; if (__builtin_expect(((((1) < 0 || PL_stack_max
- (sp) < (1))) ? (_Bool)1 : (_Bool)0),(0))) { sp = Perl_stack_grow
( sp,sp,(sizeof(1) > sizeof(ssize_t) && ((ssize_t)
(1) != (1)) ? -1 : (1))); ((void)sizeof(sp)); } } while (0)
;
4733 if (unparsed)
4734 PUSHs(sv_2mortal(newSViv(strlen(unparsed))))(*++sp = (Perl_sv_2mortal( Perl_newSViv( strlen(unparsed)))));
4735 else
4736 PUSHs(&PL_sv_undef)(*++sp = (&(PL_sv_immortals[1])));
4737 }
4738#line 4739 "POSIX.c"
4739 PUTBACKPL_stack_sp = sp;
4740 return;
4741 }
4742}
4743
4744#ifdef HAS_STRTOLD
4745#define XSubPPtmpAAAA1 1
4746
4747
4748XS_EUPXS(XS_POSIX_strtold)static void XS_POSIX_strtold( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
4749XS_EUPXS(XS_POSIX_strtold)static void XS_POSIX_strtold( CV* cv __attribute__((unused)))
4750{
4751 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4752 if (items != 1)
4753 croak_xs_usagePerl_croak_xs_usage(cv, "str");
4754 PERL_UNUSED_VAR(ax)((void)sizeof(ax)); /* -Wall */
4755 SPsp -= items;
4756 {
4757 char * str = (char *)SvPV_nolen(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((PL_stack_base[ax + (0)])->sv_u.svu_pv
) : Perl_sv_2pv_flags( PL_stack_base[ax + (0)],0,2))
4758;
4759#line 3524 "POSIX.xs"
4760 long double num;
4761 char *unparsed;
4762#line 4763 "POSIX.c"
4763#line 3527 "POSIX.xs"
4764 DECLARATION_FOR_LC_NUMERIC_MANIPULATIONstruct Perl___notused_struct;
4765 STORE_LC_NUMERIC_FORCE_TO_UNDERLYING();
4766 num = strtold(str, &unparsed);
4767 RESTORE_LC_NUMERIC();
4768 PUSHs(sv_2mortal(newSVnv(num)))(*++sp = (Perl_sv_2mortal( Perl_newSVnv( num))));
4769 if (GIMME_VPerl_gimme_V() == G_ARRAY3) {
4770 EXTEND(SP, 1)do { (void)0; if (__builtin_expect(((((1) < 0 || PL_stack_max
- (sp) < (1))) ? (_Bool)1 : (_Bool)0),(0))) { sp = Perl_stack_grow
( sp,sp,(sizeof(1) > sizeof(ssize_t) && ((ssize_t)
(1) != (1)) ? -1 : (1))); ((void)sizeof(sp)); } } while (0)
;
4771 if (unparsed)
4772 PUSHs(sv_2mortal(newSViv(strlen(unparsed))))(*++sp = (Perl_sv_2mortal( Perl_newSViv( strlen(unparsed)))));
4773 else
4774 PUSHs(&PL_sv_undef)(*++sp = (&(PL_sv_immortals[1])));
4775 }
4776#line 4777 "POSIX.c"
4777 PUTBACKPL_stack_sp = sp;
4778 return;
4779 }
4780}
4781
4782#endif
4783
4784XS_EUPXS(XS_POSIX_strtol)static void XS_POSIX_strtol( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
4785XS_EUPXS(XS_POSIX_strtol)static void XS_POSIX_strtol( CV* cv __attribute__((unused)))
4786{
4787 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4788 if (items < 1 || items > 2)
4789 croak_xs_usagePerl_croak_xs_usage(cv, "str, base = 0");
4790 PERL_UNUSED_VAR(ax)((void)sizeof(ax)); /* -Wall */
4791 SPsp -= items;
4792 {
4793 char * str = (char *)SvPV_nolen(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((PL_stack_base[ax + (0)])->sv_u.svu_pv
) : Perl_sv_2pv_flags( PL_stack_base[ax + (0)],0,2))
4794;
4795 int base;
4796#line 3547 "POSIX.xs"
4797 long num;
4798 char *unparsed;
4799#line 4800 "POSIX.c"
4800
4801 if (items < 2)
4802 base = 0;
4803 else {
4804 base = (int)SvIV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (1)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
1)],2))
4805;
4806 }
4807#line 3550 "POSIX.xs"
4808 if (base == 0 || inRANGE(base, 2, 36)( ( (sizeof(base) == sizeof(U8)) ? ( (((U64) (((((U8) (base))
)) - (((2)) | 0))) <= (((U64) ((((36) - (2))) | 0))))) : (
sizeof(base) == sizeof(U32)) ? ( (((U64) (((((U32) (base)))) -
(((2)) | 0))) <= (((U64) ((((36) - (2))) | 0))))) : ( ( (
((U64) (((((U64) (base)))) - (((2)) | 0))) <= (((U64) ((((
36) - (2))) | 0))))))))
) {
4809 num = strtol(str, &unparsed, base);
4810#if IVSIZE8 < LONGSIZE8
4811 if (num < IV_MIN(-((IV) ((~(UV)0) >> 1)) - ((3 & -1) == 3)) || num > IV_MAX((IV) ((~(UV)0) >> 1)))
4812 PUSHs(sv_2mortal(newSVnv((double)num)))(*++sp = (Perl_sv_2mortal( Perl_newSVnv( (double)num))));
4813 else
4814#endif
4815 PUSHs(sv_2mortal(newSViv((IV)num)))(*++sp = (Perl_sv_2mortal( Perl_newSViv( (IV)num))));
4816 if (GIMME_VPerl_gimme_V() == G_ARRAY3) {
4817 EXTEND(SP, 1)do { (void)0; if (__builtin_expect(((((1) < 0 || PL_stack_max
- (sp) < (1))) ? (_Bool)1 : (_Bool)0),(0))) { sp = Perl_stack_grow
( sp,sp,(sizeof(1) > sizeof(ssize_t) && ((ssize_t)
(1) != (1)) ? -1 : (1))); ((void)sizeof(sp)); } } while (0)
;
4818 if (unparsed)
4819 PUSHs(sv_2mortal(newSViv(strlen(unparsed))))(*++sp = (Perl_sv_2mortal( Perl_newSViv( strlen(unparsed)))));
4820 else
4821 PUSHs(&PL_sv_undef)(*++sp = (&(PL_sv_immortals[1])));
4822 }
4823 } else {
4824 SETERRNO(EINVAL, LIB_INVARG)((*__errno()) = (22));
4825 PUSHs(&PL_sv_undef)(*++sp = (&(PL_sv_immortals[1])));
4826 if (GIMME_VPerl_gimme_V() == G_ARRAY3) {
4827 EXTEND(SP, 1)do { (void)0; if (__builtin_expect(((((1) < 0 || PL_stack_max
- (sp) < (1))) ? (_Bool)1 : (_Bool)0),(0))) { sp = Perl_stack_grow
( sp,sp,(sizeof(1) > sizeof(ssize_t) && ((ssize_t)
(1) != (1)) ? -1 : (1))); ((void)sizeof(sp)); } } while (0)
;
4828 PUSHs(&PL_sv_undef)(*++sp = (&(PL_sv_immortals[1])));
4829 }
4830 }
4831#line 4832 "POSIX.c"
4832 PUTBACKPL_stack_sp = sp;
4833 return;
4834 }
4835}
4836
4837
4838XS_EUPXS(XS_POSIX_strtoul)static void XS_POSIX_strtoul( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
4839XS_EUPXS(XS_POSIX_strtoul)static void XS_POSIX_strtoul( CV* cv __attribute__((unused)))
4840{
4841 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4842 if (items < 1 || items > 2)
4843 croak_xs_usagePerl_croak_xs_usage(cv, "str, base = 0");
4844 PERL_UNUSED_VAR(ax)((void)sizeof(ax)); /* -Wall */
4845 SPsp -= items;
4846 {
4847 const char * str = (const char *)SvPV_nolen(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((PL_stack_base[ax + (0)])->sv_u.svu_pv
) : Perl_sv_2pv_flags( PL_stack_base[ax + (0)],0,2))
4848;
4849 int base;
4850#line 3579 "POSIX.xs"
4851 unsigned long num;
4852 char *unparsed = NULL((void*)0);
4853#line 4854 "POSIX.c"
4854
4855 if (items < 2)
4856 base = 0;
4857 else {
4858 base = (int)SvIV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (1)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
1)],2))
4859;
4860 }
4861#line 3582 "POSIX.xs"
4862 PERL_UNUSED_VAR(str)((void)sizeof(str));
4863 PERL_UNUSED_VAR(base)((void)sizeof(base));
4864 if (base == 0 || inRANGE(base, 2, 36)( ( (sizeof(base) == sizeof(U8)) ? ( (((U64) (((((U8) (base))
)) - (((2)) | 0))) <= (((U64) ((((36) - (2))) | 0))))) : (
sizeof(base) == sizeof(U32)) ? ( (((U64) (((((U32) (base)))) -
(((2)) | 0))) <= (((U64) ((((36) - (2))) | 0))))) : ( ( (
((U64) (((((U64) (base)))) - (((2)) | 0))) <= (((U64) ((((
36) - (2))) | 0))))))))
) {
4865 num = strtoul(str, &unparsed, base);
4866#if IVSIZE8 <= LONGSIZE8
4867 if (num > IV_MAX((IV) ((~(UV)0) >> 1)))
4868 PUSHs(sv_2mortal(newSVnv((double)num)))(*++sp = (Perl_sv_2mortal( Perl_newSVnv( (double)num))));
4869 else
4870#endif
4871 PUSHs(sv_2mortal(newSViv((IV)num)))(*++sp = (Perl_sv_2mortal( Perl_newSViv( (IV)num))));
4872 if (GIMME_VPerl_gimme_V() == G_ARRAY3) {
4873 EXTEND(SP, 1)do { (void)0; if (__builtin_expect(((((1) < 0 || PL_stack_max
- (sp) < (1))) ? (_Bool)1 : (_Bool)0),(0))) { sp = Perl_stack_grow
( sp,sp,(sizeof(1) > sizeof(ssize_t) && ((ssize_t)
(1) != (1)) ? -1 : (1))); ((void)sizeof(sp)); } } while (0)
;
4874 if (unparsed)
4875 PUSHs(sv_2mortal(newSViv(strlen(unparsed))))(*++sp = (Perl_sv_2mortal( Perl_newSViv( strlen(unparsed)))));
4876 else
4877 PUSHs(&PL_sv_undef)(*++sp = (&(PL_sv_immortals[1])));
4878 }
4879 } else {
4880 SETERRNO(EINVAL, LIB_INVARG)((*__errno()) = (22));
4881 PUSHs(&PL_sv_undef)(*++sp = (&(PL_sv_immortals[1])));
4882 if (GIMME_VPerl_gimme_V() == G_ARRAY3) {
4883 EXTEND(SP, 1)do { (void)0; if (__builtin_expect(((((1) < 0 || PL_stack_max
- (sp) < (1))) ? (_Bool)1 : (_Bool)0),(0))) { sp = Perl_stack_grow
( sp,sp,(sizeof(1) > sizeof(ssize_t) && ((ssize_t)
(1) != (1)) ? -1 : (1))); ((void)sizeof(sp)); } } while (0)
;
4884 PUSHs(&PL_sv_undef)(*++sp = (&(PL_sv_immortals[1])));
4885 }
4886 }
4887#line 4888 "POSIX.c"
4888 PUTBACKPL_stack_sp = sp;
4889 return;
4890 }
4891}
4892
4893
4894XS_EUPXS(XS_POSIX_strxfrm)static void XS_POSIX_strxfrm( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
4895XS_EUPXS(XS_POSIX_strxfrm)static void XS_POSIX_strxfrm( CV* cv __attribute__((unused)))
4896{
4897 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4898 if (items != 1)
4899 croak_xs_usagePerl_croak_xs_usage(cv, "src");
4900 {
4901 SV * src = ST(0)PL_stack_base[ax + (0)]
4902;
4903#line 3612 "POSIX.xs"
4904 {
4905 STRLEN srclen;
4906 STRLEN dstlen;
4907 STRLEN buflen;
4908 char *p = SvPV(src,srclen)((((src)->sv_flags & (0x00000400|0x00200000)) == 0x00000400
) ? ((srclen = ((XPV*) (src)->sv_any)->xpv_cur), ((src)
->sv_u.svu_pv)) : Perl_sv_2pv_flags( src,&srclen,2))
;
4909 srclen++;
4910 buflen = srclen * 4 + 1;
4911 ST(0)PL_stack_base[ax + (0)] = sv_2mortal(newSV(buflen))Perl_sv_2mortal( Perl_newSV( buflen));
4912 dstlen = strxfrm(SvPVX(ST(0))((PL_stack_base[ax + (0)])->sv_u.svu_pv), p, (size_t)buflen);
4913 if (dstlen >= buflen) {
4914 dstlen++;
4915 SvGROW(ST(0), dstlen)(((PL_stack_base[ax + (0)])->sv_flags & 0x10000000) ||
((XPV*) (PL_stack_base[ax + (0)])->sv_any)->xpv_len_u.
xpvlenu_len < (dstlen) ? Perl_sv_grow( PL_stack_base[ax + (
0)],dstlen) : ((PL_stack_base[ax + (0)])->sv_u.svu_pv))
;
4916 strxfrm(SvPVX(ST(0))((PL_stack_base[ax + (0)])->sv_u.svu_pv), p, (size_t)dstlen);
4917 dstlen--;
4918 }
4919 SvCUR_set(ST(0), dstlen)do { ((void)0); ((void)0); ((void)0); (((XPV*) (PL_stack_base
[ax + (0)])->sv_any)->xpv_cur = (dstlen)); } while (0)
;
4920 SvPOK_only(ST(0))( (PL_stack_base[ax + (0)])->sv_flags &= ~((0x00000100
|0x00000200|0x00000400|0x00000800| 0x00001000|0x00002000|0x00004000
|0x00008000)| 0x80000000|0x20000000), (PL_stack_base[ax + (0)
])->sv_flags |= (0x00000400|0x00004000))
;
4921 }
4922#line 4923 "POSIX.c"
4923 }
4924 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
4925}
4926
4927
4928XS_EUPXS(XS_POSIX_mkfifo)static void XS_POSIX_mkfifo( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
4929XS_EUPXS(XS_POSIX_mkfifo)static void XS_POSIX_mkfifo( CV* cv __attribute__((unused)))
4930{
4931 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4932 dXSI32I32 ix = ((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->
xcv_start_u.xcv_xsubany.any_i32
;
4933 if (items != 2)
4934 croak_xs_usagePerl_croak_xs_usage(cv, "filename, mode");
4935 {
4936 char * filename = (char *)SvPV_nolen(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((PL_stack_base[ax + (0)])->sv_u.svu_pv
) : Perl_sv_2pv_flags( PL_stack_base[ax + (0)],0,2))
4937;
4938 Mode_tmode_t mode = (Mode_tmode_t)SvNV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (1)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (1
)],2))
4939;
4940 SysRet RETVAL;
4941#line 3638 "POSIX.xs"
4942 if(ix) {
4943 RETVAL = access(filename, mode);
4944 } else {
4945 TAINT_PROPER("mkfifo")if (__builtin_expect(((PL_tainting) ? (_Bool)1 : (_Bool)0),(0
))) { Perl_taint_proper( ((void*)0),"mkfifo"); }
;
4946 RETVAL = mkfifo(filename, mode);
4947 }
4948#line 4949 "POSIX.c"
4949 {
4950 SV * RETVALSV;
4951 RETVALSV = sv_newmortal()Perl_sv_newmortal();
4952 if (RETVAL != -1) {
4953 if (RETVAL == 0)
4954 sv_setpvn(RETVALSV, "0 but true", 10)Perl_sv_setpvn( RETVALSV,"0 but true",10);
4955 else
4956 sv_setiv(RETVALSV, (IV)RETVAL)Perl_sv_setiv( RETVALSV,(IV)RETVAL);
4957 }
4958 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
4959 }
4960 }
4961 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
4962}
4963
4964
4965XS_EUPXS(XS_POSIX_tcdrain)static void XS_POSIX_tcdrain( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
4966XS_EUPXS(XS_POSIX_tcdrain)static void XS_POSIX_tcdrain( CV* cv __attribute__((unused)))
4967{
4968 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
4969 dXSI32I32 ix = ((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->
xcv_start_u.xcv_xsubany.any_i32
;
4970 if (items != 1)
4971 croak_xs_usagePerl_croak_xs_usage(cv, "fd");
4972 {
4973 POSIX__Fd fd;
4974 SysRet RETVAL;
4975
4976 if ((fd = (int)SvIV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (0)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
0)],2))
) < 0) {
4977 SETERRNO(EBADF, RMS_IFI)((*__errno()) = (9));
4978 XSRETURN_IV(-1)do { (PL_stack_base[ax + (0)] = Perl_sv_2mortal( Perl_newSViv
( -1)) ); do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp
= PL_stack_base + ax + (tmpXSoff - 1); return; } while (0); }
while (0)
;
4979 }
4980;
4981#line 3654 "POSIX.xs"
4982 if (fd >= 0) {
4983 RETVAL = ix == 1 ? close(fd)
4984 : (ix < 1 ? tcdrain(fd) : dup(fd));
4985 } else {
4986 SETERRNO(EBADF,RMS_IFI)((*__errno()) = (9));
4987 RETVAL = -1;
4988 }
4989#line 4990 "POSIX.c"
4990 {
4991 SV * RETVALSV;
4992 RETVALSV = sv_newmortal()Perl_sv_newmortal();
4993 if (RETVAL != -1) {
4994 if (RETVAL == 0)
4995 sv_setpvn(RETVALSV, "0 but true", 10)Perl_sv_setpvn( RETVALSV,"0 but true",10);
4996 else
4997 sv_setiv(RETVALSV, (IV)RETVAL)Perl_sv_setiv( RETVALSV,(IV)RETVAL);
4998 }
4999 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
5000 }
5001 }
5002 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
5003}
5004
5005
5006XS_EUPXS(XS_POSIX_tcflow)static void XS_POSIX_tcflow( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
5007XS_EUPXS(XS_POSIX_tcflow)static void XS_POSIX_tcflow( CV* cv __attribute__((unused)))
5008{
5009 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
5010 dXSI32I32 ix = ((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->
xcv_start_u.xcv_xsubany.any_i32
;
5011 if (items != 2)
5012 croak_xs_usagePerl_croak_xs_usage(cv, "fd, action");
5013 {
5014 POSIX__Fd fd;
5015 int action = (int)SvIV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (1)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
1)],2))
5016;
5017 SysRet RETVAL;
5018
5019 if ((fd = (int)SvIV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (0)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
0)],2))
) < 0) {
5020 SETERRNO(EBADF, RMS_IFI)((*__errno()) = (9));
5021 XSRETURN_IV(-1)do { (PL_stack_base[ax + (0)] = Perl_sv_2mortal( Perl_newSViv
( -1)) ); do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp
= PL_stack_base + ax + (tmpXSoff - 1); return; } while (0); }
while (0)
;
5022 }
5023;
5024#line 3673 "POSIX.xs"
5025 if (action >= 0) {
5026 RETVAL = ix == 1 ? tcflush(fd, action)
5027 : (ix < 1 ? tcflow(fd, action) : tcsendbreak(fd, action));
5028 } else {
5029 SETERRNO(EINVAL,LIB_INVARG)((*__errno()) = (22));
5030 RETVAL = -1;
5031 }
5032#line 5033 "POSIX.c"
5033 {
5034 SV * RETVALSV;
5035 RETVALSV = sv_newmortal()Perl_sv_newmortal();
5036 if (RETVAL != -1) {
5037 if (RETVAL == 0)
5038 sv_setpvn(RETVALSV, "0 but true", 10)Perl_sv_setpvn( RETVALSV,"0 but true",10);
5039 else
5040 sv_setiv(RETVALSV, (IV)RETVAL)Perl_sv_setiv( RETVALSV,(IV)RETVAL);
5041 }
5042 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
5043 }
5044 }
5045 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
5046}
5047
5048
5049XS_EUPXS(XS_POSIX_asctime)static void XS_POSIX_asctime( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
5050XS_EUPXS(XS_POSIX_asctime)static void XS_POSIX_asctime( CV* cv __attribute__((unused)))
5051{
5052 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
5053 dXSI32I32 ix = ((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->
xcv_start_u.xcv_xsubany.any_i32
;
5054 if (items < 6 || items > 9)
5055 croak_xs_usagePerl_croak_xs_usage(cv, "sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = -1");
5056 PERL_UNUSED_VAR(ax)((void)sizeof(ax)); /* -Wall */
5057 SPsp -= items;
5058 {
5059 int sec = (int)SvIV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (0)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
0)],2))
5060;
5061 int min = (int)SvIV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (1)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
1)],2))
5062;
5063 int hour = (int)SvIV(ST(2))((((PL_stack_base[ax + (2)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (2)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
2)],2))
5064;
5065 int mday = (int)SvIV(ST(3))((((PL_stack_base[ax + (3)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (3)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
3)],2))
5066;
5067 int mon = (int)SvIV(ST(4))((((PL_stack_base[ax + (4)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (4)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
4)],2))
5068;
5069 int year = (int)SvIV(ST(5))((((PL_stack_base[ax + (5)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (5)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
5)],2))
5070;
5071 int wday;
5072 int yday;
5073 int isdst;
5074
5075 if (items < 7)
5076 wday = 0;
5077 else {
5078 wday = (int)SvIV(ST(6))((((PL_stack_base[ax + (6)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (6)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
6)],2))
5079;
5080 }
5081
5082 if (items < 8)
5083 yday = 0;
5084 else {
5085 yday = (int)SvIV(ST(7))((((PL_stack_base[ax + (7)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (7)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
7)],2))
5086;
5087 }
5088
5089 if (items < 9)
5090 isdst = -1;
5091 else {
5092 isdst = (int)SvIV(ST(8))((((PL_stack_base[ax + (8)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (8)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
8)],2))
5093;
5094 }
5095#line 3697 "POSIX.xs"
5096 {
5097 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
5098 struct tm mytm;
5099 init_tm(&mytm)Perl_init_tm( &mytm); /* XXX workaround - see init_tm() in core util.c */
5100 mytm.tm_sec = sec;
5101 mytm.tm_min = min;
5102 mytm.tm_hour = hour;
5103 mytm.tm_mday = mday;
5104 mytm.tm_mon = mon;
5105 mytm.tm_year = year;
5106 mytm.tm_wday = wday;
5107 mytm.tm_yday = yday;
5108 mytm.tm_isdst = isdst;
5109 if (ix) {
5110 const time_t result = mktime(&mytm);
5111 if (result == (time_t)-1)
5112 SvOK_off(TARG)( (targ)->sv_flags &= ~((0x00000100|0x00000200|0x00000400
|0x00000800| 0x00001000|0x00002000|0x00004000|0x00008000)| 0x80000000
|0x20000000), ((void)(((targ)->sv_flags & 0x02000000) &&
(Perl_sv_backoff(targ),0))))
;
5113 else if (result == 0)
5114 sv_setpvs(TARG, "0 but true")Perl_sv_setpvn( targ, ("" "0 but true" ""), (sizeof("0 but true"
)-1))
;
5115 else
5116 sv_setiv(TARG, (IV)result)Perl_sv_setiv( targ,(IV)result);
5117 } else {
5118 sv_setpv(TARG, asctime(&mytm))Perl_sv_setpv( targ,asctime(&mytm));
5119 }
5120 ST(0)PL_stack_base[ax + (0)] = TARGtarg;
5121 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
5122 }
5123#line 5124 "POSIX.c"
5124 PUTBACKPL_stack_sp = sp;
5125 return;
5126 }
5127}
5128
5129
5130XS_EUPXS(XS_POSIX_clock)static void XS_POSIX_clock( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
5131XS_EUPXS(XS_POSIX_clock)static void XS_POSIX_clock( CV* cv __attribute__((unused)))
5132{
5133 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
5134 if (items != 0)
5135 croak_xs_usagePerl_croak_xs_usage(cv, "");
5136 {
5137 long RETVAL;
5138 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
5139
5140 RETVAL = clock();
5141 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHi((IV)RETVAL)do { do { IV TARGi_iv = (IV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000)|0x80000000)) == SVt_IV) &
(1 ? !(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)
0),(0))) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0)
,(1))) { ((void)0); (targ)->sv_flags |= (0x00000100|0x00001000
); targ->sv_u.svu_iv = TARGi_iv; } else Perl_sv_setiv_mg( targ
,TARGi_iv); } while (0); (*++sp = (targ)); } while (0)
;
5142 }
5143 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
5144}
5145
5146
5147XS_EUPXS(XS_POSIX_ctime)static void XS_POSIX_ctime( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
5148XS_EUPXS(XS_POSIX_ctime)static void XS_POSIX_ctime( CV* cv __attribute__((unused)))
5149{
5150 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
5151 if (items != 1)
5152 croak_xs_usagePerl_croak_xs_usage(cv, "time");
5153 {
5154 Time_ttime_t time = (Time_ttime_t)SvNV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (0)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (0
)],2))
5155;
5156 char * RETVAL;
5157 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
5158
5159 RETVAL = ctime(&time);
5160 sv_setpv(TARG, RETVAL)Perl_sv_setpv( targ,RETVAL); XSprePUSH(sp = PL_stack_base + ax - 1); PUSHTARGdo { do { if (__builtin_expect(((((targ)->sv_flags & 0x00400000
)) ? (_Bool)1 : (_Bool)0),(0))) Perl_mg_set( targ); } while (
0); (*++sp = (targ)); } while (0)
;
5161 }
5162 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
5163}
5164
5165
5166XS_EUPXS(XS_POSIX_times)static void XS_POSIX_times( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
5167XS_EUPXS(XS_POSIX_times)static void XS_POSIX_times( CV* cv __attribute__((unused)))
5168{
5169 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
5170 if (items != 0)
5171 croak_xs_usagePerl_croak_xs_usage(cv, "");
5172 PERL_UNUSED_VAR(ax)((void)sizeof(ax)); /* -Wall */
5173 SPsp -= items;
5174 {
5175#line 3735 "POSIX.xs"
5176 struct tms tms;
5177 clock_t realtime;
5178 realtime = times( &tms );
5179 EXTEND(SP,5)do { (void)0; if (__builtin_expect(((((5) < 0 || PL_stack_max
- (sp) < (5))) ? (_Bool)1 : (_Bool)0),(0))) { sp = Perl_stack_grow
( sp,sp,(sizeof(5) > sizeof(ssize_t) && ((ssize_t)
(5) != (5)) ? -1 : (5))); ((void)sizeof(sp)); } } while (0)
;
5180 PUSHs( sv_2mortal( newSViv( (IV) realtime ) ) )(*++sp = (Perl_sv_2mortal( Perl_newSViv( (IV) realtime))));
5181 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_utime ) ) )(*++sp = (Perl_sv_2mortal( Perl_newSViv( (IV) tms.tms_utime))
))
;
5182 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_stime ) ) )(*++sp = (Perl_sv_2mortal( Perl_newSViv( (IV) tms.tms_stime))
))
;
5183 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cutime ) ) )(*++sp = (Perl_sv_2mortal( Perl_newSViv( (IV) tms.tms_cutime)
)))
;
5184 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cstime ) ) )(*++sp = (Perl_sv_2mortal( Perl_newSViv( (IV) tms.tms_cstime)
)))
;
5185#line 5186 "POSIX.c"
5186 PUTBACKPL_stack_sp = sp;
5187 return;
5188 }
5189}
5190
5191
5192XS_EUPXS(XS_POSIX_difftime)static void XS_POSIX_difftime( CV* cv __attribute__((unused))
)
; /* prototype to pass -Wmissing-prototypes */
5193XS_EUPXS(XS_POSIX_difftime)static void XS_POSIX_difftime( CV* cv __attribute__((unused))
)
5194{
5195 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
5196 if (items != 2)
5197 croak_xs_usagePerl_croak_xs_usage(cv, "time1, time2");
5198 {
5199 Time_ttime_t time1 = (Time_ttime_t)SvNV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (0)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (0
)],2))
5200;
5201 Time_ttime_t time2 = (Time_ttime_t)SvNV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (1)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (1
)],2))
5202;
5203 double RETVAL;
5204 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
5205
5206 RETVAL = difftime(time1, time2);
5207 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHn((double)RETVAL)do { do { NV TARGn_nv = (double)RETVAL; if (__builtin_expect(
(((((targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000))) == SVt_NV) & (1 ? !
(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)0),(0))
) ? (_Bool)1 : (_Bool)0)) : 1)) ? (_Bool)1 : (_Bool)0),(1))) {
((void)0); (targ)->sv_flags |= (0x00000200|0x00002000); do
{ ((void)0); ((void)0); (((XPVNV*)(targ)->sv_any)->xnv_u
.xnv_nv = (TARGn_nv)); } while (0); } else Perl_sv_setnv_mg( targ
,TARGn_nv); } while (0); (*++sp = (targ)); } while (0)
;
5208 }
5209 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
5210}
5211
5212
5213XS_EUPXS(XS_POSIX_strftime)static void XS_POSIX_strftime( CV* cv __attribute__((unused))
)
; /* prototype to pass -Wmissing-prototypes */
5214XS_EUPXS(XS_POSIX_strftime)static void XS_POSIX_strftime( CV* cv __attribute__((unused))
)
5215{
5216 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
5217 if (items < 7 || items > 10)
5218 croak_xs_usagePerl_croak_xs_usage(cv, "fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1");
5219 {
5220 SV * fmt = ST(0)PL_stack_base[ax + (0)]
5221;
5222 int sec = (int)SvIV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (1)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
1)],2))
5223;
5224 int min = (int)SvIV(ST(2))((((PL_stack_base[ax + (2)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (2)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
2)],2))
5225;
5226 int hour = (int)SvIV(ST(3))((((PL_stack_base[ax + (3)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (3)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
3)],2))
5227;
5228 int mday = (int)SvIV(ST(4))((((PL_stack_base[ax + (4)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (4)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
4)],2))
5229;
5230 int mon = (int)SvIV(ST(5))((((PL_stack_base[ax + (5)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (5)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
5)],2))
5231;
5232 int year = (int)SvIV(ST(6))((((PL_stack_base[ax + (6)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (6)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
6)],2))
5233;
5234 int wday;
5235 int yday;
5236 int isdst;
5237
5238 if (items < 8)
5239 wday = -1;
5240 else {
5241 wday = (int)SvIV(ST(7))((((PL_stack_base[ax + (7)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (7)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
7)],2))
5242;
5243 }
5244
5245 if (items < 9)
5246 yday = -1;
5247 else {
5248 yday = (int)SvIV(ST(8))((((PL_stack_base[ax + (8)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (8)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
8)],2))
5249;
5250 }
5251
5252 if (items < 10)
5253 isdst = -1;
5254 else {
5255 isdst = (int)SvIV(ST(9))((((PL_stack_base[ax + (9)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (9)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
9)],2))
5256;
5257 }
5258#line 3766 "POSIX.xs"
5259 {
5260 char *buf;
5261 SV *sv;
5262
5263 /* allowing user-supplied (rather than literal) formats
5264 * is normally frowned upon as a potential security risk;
5265 * but this is part of the API so we have to allow it */
5266 GCC_DIAG_IGNORE_STMT(-Wformat-nonliteral)GCC diagnostic push GCC diagnostic ignored "-Wformat-nonliteral"
(void)0
;
5267 buf = my_strftime(SvPV_nolen(fmt), sec, min, hour, mday, mon, year, wday, yday, isdst)Perl_my_strftime( ((((fmt)->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((fmt)->sv_u.svu_pv) : Perl_sv_2pv_flags
( fmt,0,2)),sec,min,hour,mday,mon,year,wday,yday,isdst)
;
5268 GCC_DIAG_RESTORE_STMTGCC diagnostic pop (void)0;
5269 sv = sv_newmortal()Perl_sv_newmortal();
5270 if (buf) {
5271 STRLEN len = strlen(buf);
5272 sv_usepvn_flags(sv, buf, len, SV_HAS_TRAILING_NUL)Perl_sv_usepvn_flags( sv,buf,len,256);
5273 if ( SvUTF8(fmt)((fmt)->sv_flags & 0x20000000)
5274 || ( is_utf8_non_invariant_stringPerl_is_utf8_non_invariant_string((U8*) buf, len)
5275#ifdef USE_LOCALE_TIME
5276 && _is_cur_LC_category_utf8(LC_TIME)Perl__is_cur_LC_category_utf8( 5)
5277#else /* If can't check directly, at least can see if script is consistent,
5278 under UTF-8, which gives us an extra measure of confidence. */
5279
5280 && isSCRIPT_RUN((const U8 *) buf,Perl_isSCRIPT_RUN( (const U8 *) buf,(const U8 *) buf + len,(1
))
5281 (const U8 *) buf + len,Perl_isSCRIPT_RUN( (const U8 *) buf,(const U8 *) buf + len,(1
))
5282 TRUE)Perl_isSCRIPT_RUN( (const U8 *) buf,(const U8 *) buf + len,(1
))
/* Means assume UTF-8 */
5283#endif
5284 )) {
5285 SvUTF8_on(sv)((sv)->sv_flags |= (0x20000000));
5286 }
5287 }
5288 else { /* We can't distinguish between errors and just an empty
5289 * return; in all cases just return an empty string */
5290 SvUPGRADE(sv, SVt_PV)((void)(((svtype)((sv)->sv_flags & 0xff)) >= (SVt_PV
) || (Perl_sv_upgrade( sv,SVt_PV),1)))
;
5291 SvPV_set(sv, (char *) "")do { ((void)0); ((void)0); ((void)0); ((sv)->sv_u.svu_pv =
((char *) "")); } while (0)
;
5292 SvPOK_on(sv)( (sv)->sv_flags |= (0x00000400|0x00004000));
5293 SvCUR_set(sv, 0)do { ((void)0); ((void)0); ((void)0); (((XPV*) (sv)->sv_any
)->xpv_cur = (0)); } while (0)
;
5294 SvLEN_set(sv, 0)do { ((void)0); ((void)0); ((void)0); (((XPV*) (sv)->sv_any
)->xpv_len_u.xpvlenu_len = (0)); } while (0)
; /* Won't attempt to free the string when sv
5295 gets destroyed */
5296 }
5297 ST(0)PL_stack_base[ax + (0)] = sv;
5298 }
5299#line 5300 "POSIX.c"
5300 }
5301 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
5302}
5303
5304
5305XS_EUPXS(XS_POSIX_tzset)static void XS_POSIX_tzset( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
5306XS_EUPXS(XS_POSIX_tzset)static void XS_POSIX_tzset( CV* cv __attribute__((unused)))
5307{
5308 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
5309 if (items != 0)
5310 croak_xs_usagePerl_croak_xs_usage(cv, "");
5311 PERL_UNUSED_VAR(ax)((void)sizeof(ax)); /* -Wall */
5312 SPsp -= items;
5313 {
5314#line 3810 "POSIX.xs"
5315 my_tzset(aTHX);
5316#line 5317 "POSIX.c"
5317 PUTBACKPL_stack_sp = sp;
5318 return;
5319 }
5320}
5321
5322
5323XS_EUPXS(XS_POSIX_tzname)static void XS_POSIX_tzname( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
5324XS_EUPXS(XS_POSIX_tzname)static void XS_POSIX_tzname( CV* cv __attribute__((unused)))
5325{
5326 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
5327 if (items != 0)
5328 croak_xs_usagePerl_croak_xs_usage(cv, "");
5329 PERL_UNUSED_VAR(ax)((void)sizeof(ax)); /* -Wall */
5330 SPsp -= items;
5331 {
5332#line 3815 "POSIX.xs"
5333 EXTEND(SP,2)do { (void)0; if (__builtin_expect(((((2) < 0 || PL_stack_max
- (sp) < (2))) ? (_Bool)1 : (_Bool)0),(0))) { sp = Perl_stack_grow
( sp,sp,(sizeof(2) > sizeof(ssize_t) && ((ssize_t)
(2) != (2)) ? -1 : (2))); ((void)sizeof(sp)); } } while (0)
;
5334 PUSHs(newSVpvn_flags(tzname[0], strlen(tzname[0]), SVs_TEMP))(*++sp = (Perl_newSVpvn_flags( tzname[0],strlen(tzname[0]),0x00080000
)))
;
5335 PUSHs(newSVpvn_flags(tzname[1], strlen(tzname[1]), SVs_TEMP))(*++sp = (Perl_newSVpvn_flags( tzname[1],strlen(tzname[1]),0x00080000
)))
;
5336#line 5337 "POSIX.c"
5337 PUTBACKPL_stack_sp = sp;
5338 return;
5339 }
5340}
5341
5342
5343XS_EUPXS(XS_POSIX_ctermid)static void XS_POSIX_ctermid( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
5344XS_EUPXS(XS_POSIX_ctermid)static void XS_POSIX_ctermid( CV* cv __attribute__((unused)))
5345{
5346 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
5347 if (items < 0 || items > 1)
5348 croak_xs_usagePerl_croak_xs_usage(cv, "s = 0");
5349 {
5350 char * s = 0;
5351 char * RETVAL;
5352 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
5353#line 3823 "POSIX.xs"
5354#ifdef I_TERMIOS
5355 /* On some systems L_ctermid is a #define; but not all; this code works
5356 * for all cases (so far...) */
5357 s = (char *) safemallocPerl_safesysmalloc((size_t) L_ctermid1024);
5358#endif
5359 RETVAL = ctermid(s);
5360#line 5361 "POSIX.c"
5361 sv_setpv(TARG, RETVAL)Perl_sv_setpv( targ,RETVAL); XSprePUSH(sp = PL_stack_base + ax - 1); PUSHTARGdo { do { if (__builtin_expect(((((targ)->sv_flags & 0x00400000
)) ? (_Bool)1 : (_Bool)0),(0))) Perl_mg_set( targ); } while (
0); (*++sp = (targ)); } while (0)
;
5362#line 3832 "POSIX.xs"
5363#ifdef I_TERMIOS
5364 Safefree(s)Perl_safesysfree(((void *)(s)));
5365#endif
5366#line 5367 "POSIX.c"
5367 }
5368 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
5369}
5370
5371
5372XS_EUPXS(XS_POSIX_cuserid)static void XS_POSIX_cuserid( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
5373XS_EUPXS(XS_POSIX_cuserid)static void XS_POSIX_cuserid( CV* cv __attribute__((unused)))
5374{
5375 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
5376 if (items < 0 || items > 1)
5377 croak_xs_usagePerl_croak_xs_usage(cv, "s = 0");
5378 {
5379 char * s = 0;
5380 char * RETVAL;
5381 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
5382#line 3840 "POSIX.xs"
5383#ifdef HAS_CUSERID
5384 RETVAL = cuserid(s);
5385#else
5386 PERL_UNUSED_VAR(s)((void)sizeof(s));
5387 RETVAL = 0;
5388 not_here("cuserid");
5389#endif
5390#line 5391 "POSIX.c"
5391 sv_setpv(TARG, RETVAL)Perl_sv_setpv( targ,RETVAL); XSprePUSH(sp = PL_stack_base + ax - 1); PUSHTARGdo { do { if (__builtin_expect(((((targ)->sv_flags & 0x00400000
)) ? (_Bool)1 : (_Bool)0),(0))) Perl_mg_set( targ); } while (
0); (*++sp = (targ)); } while (0)
;
5392 }
5393 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
5394}
5395
5396
5397XS_EUPXS(XS_POSIX_fpathconf)static void XS_POSIX_fpathconf( CV* cv __attribute__((unused)
))
; /* prototype to pass -Wmissing-prototypes */
5398XS_EUPXS(XS_POSIX_fpathconf)static void XS_POSIX_fpathconf( CV* cv __attribute__((unused)
))
5399{
5400 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
5401 if (items != 2)
5402 croak_xs_usagePerl_croak_xs_usage(cv, "fd, name");
5403 {
5404 POSIX__Fd fd;
5405 int name = (int)SvIV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (1)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
1)],2))
5406;
5407 SysRetLong RETVAL;
5408
5409 if ((fd = (int)SvIV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (0)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
0)],2))
) < 0) {
5410 SETERRNO(EBADF, RMS_IFI)((*__errno()) = (9));
5411 XSRETURN_IV(-1)do { (PL_stack_base[ax + (0)] = Perl_sv_2mortal( Perl_newSViv
( -1)) ); do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp
= PL_stack_base + ax + (tmpXSoff - 1); return; } while (0); }
while (0)
;
5412 }
5413;
5414
5415 RETVAL = fpathconf(fd, name);
5416 {
5417 SV * RETVALSV;
5418 RETVALSV = sv_newmortal()Perl_sv_newmortal();
5419 if (RETVAL != -1) {
5420 if (RETVAL == 0)
5421 sv_setpvn(RETVALSV, "0 but true", 10)Perl_sv_setpvn( RETVALSV,"0 but true",10);
5422 else
5423 sv_setiv(RETVALSV, (IV)RETVAL)Perl_sv_setiv( RETVALSV,(IV)RETVAL);
5424 }
5425 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
5426 }
5427 }
5428 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
5429}
5430
5431
5432XS_EUPXS(XS_POSIX_pathconf)static void XS_POSIX_pathconf( CV* cv __attribute__((unused))
)
; /* prototype to pass -Wmissing-prototypes */
5433XS_EUPXS(XS_POSIX_pathconf)static void XS_POSIX_pathconf( CV* cv __attribute__((unused))
)
5434{
5435 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
5436 if (items != 2)
5437 croak_xs_usagePerl_croak_xs_usage(cv, "filename, name");
5438 {
5439 char * filename = (char *)SvPV_nolen(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((PL_stack_base[ax + (0)])->sv_u.svu_pv
) : Perl_sv_2pv_flags( PL_stack_base[ax + (0)],0,2))
5440;
5441 int name = (int)SvIV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (1)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
1)],2))
5442;
5443 SysRetLong RETVAL;
5444
5445 RETVAL = pathconf(filename, name);
5446 {
5447 SV * RETVALSV;
5448 RETVALSV = sv_newmortal()Perl_sv_newmortal();
5449 if (RETVAL != -1) {
5450 if (RETVAL == 0)
5451 sv_setpvn(RETVALSV, "0 but true", 10)Perl_sv_setpvn( RETVALSV,"0 but true",10);
5452 else
5453 sv_setiv(RETVALSV, (IV)RETVAL)Perl_sv_setiv( RETVALSV,(IV)RETVAL);
5454 }
5455 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
5456 }
5457 }
5458 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
5459}
5460
5461
5462XS_EUPXS(XS_POSIX_pause)static void XS_POSIX_pause( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
5463XS_EUPXS(XS_POSIX_pause)static void XS_POSIX_pause( CV* cv __attribute__((unused)))
5464{
5465 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
5466 if (items != 0)
5467 croak_xs_usagePerl_croak_xs_usage(cv, "");
5468 {
5469 SysRet RETVAL;
5470
5471 RETVAL = pause();
5472 {
5473 SV * RETVALSV;
5474 RETVALSV = sv_newmortal()Perl_sv_newmortal();
5475 if (RETVAL != -1) {
5476 if (RETVAL == 0)
5477 sv_setpvn(RETVALSV, "0 but true", 10)Perl_sv_setpvn( RETVALSV,"0 but true",10);
5478 else
5479 sv_setiv(RETVALSV, (IV)RETVAL)Perl_sv_setiv( RETVALSV,(IV)RETVAL);
5480 }
5481 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
5482 }
5483#line 3863 "POSIX.xs"
5484 PERL_ASYNC_CHECK()if (__builtin_expect(((PL_sig_pending) ? (_Bool)1 : (_Bool)0)
,(0))) PL_signalhook()
;
5485#line 5486 "POSIX.c"
5486 }
5487 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
5488}
5489
5490
5491XS_EUPXS(XS_POSIX_sleep)static void XS_POSIX_sleep( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
5492XS_EUPXS(XS_POSIX_sleep)static void XS_POSIX_sleep( CV* cv __attribute__((unused)))
5493{
5494 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
5495 if (items != 1)
5496 croak_xs_usagePerl_croak_xs_usage(cv, "seconds");
5497 {
5498 unsigned int seconds = (unsigned int)SvUV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000100|0x80000000
|0x00200000)) == (0x00000100|0x80000000)) ? ((XPVUV*) (PL_stack_base
[ax + (0)])->sv_any)->xuv_u.xivu_uv : Perl_sv_2uv_flags
( PL_stack_base[ax + (0)],2))
5499;
5500 unsigned int RETVAL;
5501 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
5502#line 3869 "POSIX.xs"
5503 RETVAL = PerlProc_sleep(seconds)sleep((seconds));
5504#line 5505 "POSIX.c"
5505 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHu((UV)RETVAL)do { do { UV TARGu_uv = (UV)RETVAL; if (__builtin_expect(((((
(targ)->sv_flags & (0xff|(0x08000000|0x00010000|0x00000800
|0x01000000 |0x00800000|0x10000000)|0x80000000)) == SVt_IV) &
(1 ? !(((__builtin_expect(((PL_tainted) ? (_Bool)1 : (_Bool)
0),(0))) ? (_Bool)1 : (_Bool)0)) : 1) & (TARGu_uv <= (
UV)((IV) ((~(UV)0) >> 1)))) ? (_Bool)1 : (_Bool)0),(1))
) { ((void)0); (targ)->sv_flags |= (0x00000100|0x00001000)
; targ->sv_u.svu_iv = TARGu_uv; } else Perl_sv_setuv_mg( targ
,TARGu_uv); } while (0); (*++sp = (targ)); } while (0)
;
5506 }
5507 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
5508}
5509
5510
5511XS_EUPXS(XS_POSIX_setgid)static void XS_POSIX_setgid( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
5512XS_EUPXS(XS_POSIX_setgid)static void XS_POSIX_setgid( CV* cv __attribute__((unused)))
5513{
5514 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
5515 if (items != 1)
5516 croak_xs_usagePerl_croak_xs_usage(cv, "gid");
5517 {
5518 Gid_tgid_t gid = (Gid_tgid_t)SvNV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (0)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (0
)],2))
5519;
5520 SysRet RETVAL;
5521
5522 RETVAL = setgid(gid);
5523 {
5524 SV * RETVALSV;
5525 RETVALSV = sv_newmortal()Perl_sv_newmortal();
5526 if (RETVAL != -1) {
5527 if (RETVAL == 0)
5528 sv_setpvn(RETVALSV, "0 but true", 10)Perl_sv_setpvn( RETVALSV,"0 but true",10);
5529 else
5530 sv_setiv(RETVALSV, (IV)RETVAL)Perl_sv_setiv( RETVALSV,(IV)RETVAL);
5531 }
5532 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
5533 }
5534 }
5535 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
5536}
5537
5538
5539XS_EUPXS(XS_POSIX_setuid)static void XS_POSIX_setuid( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
5540XS_EUPXS(XS_POSIX_setuid)static void XS_POSIX_setuid( CV* cv __attribute__((unused)))
5541{
5542 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
5543 if (items != 1)
5544 croak_xs_usagePerl_croak_xs_usage(cv, "uid");
5545 {
5546 Uid_tuid_t uid = (Uid_tuid_t)SvNV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (0)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (0
)],2))
5547;
5548 SysRet RETVAL;
5549
5550 RETVAL = setuid(uid);
5551 {
5552 SV * RETVALSV;
5553 RETVALSV = sv_newmortal()Perl_sv_newmortal();
5554 if (RETVAL != -1) {
5555 if (RETVAL == 0)
5556 sv_setpvn(RETVALSV, "0 but true", 10)Perl_sv_setpvn( RETVALSV,"0 but true",10);
5557 else
5558 sv_setiv(RETVALSV, (IV)RETVAL)Perl_sv_setiv( RETVALSV,(IV)RETVAL);
5559 }
5560 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
5561 }
5562 }
5563 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
5564}
5565
5566
5567XS_EUPXS(XS_POSIX_sysconf)static void XS_POSIX_sysconf( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
5568XS_EUPXS(XS_POSIX_sysconf)static void XS_POSIX_sysconf( CV* cv __attribute__((unused)))
5569{
5570 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
5571 if (items != 1)
5572 croak_xs_usagePerl_croak_xs_usage(cv, "name");
5573 {
5574 int name = (int)SvIV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (0)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
0)],2))
5575;
5576 SysRetLong RETVAL;
5577
5578 RETVAL = sysconf(name);
5579 {
5580 SV * RETVALSV;
5581 RETVALSV = sv_newmortal()Perl_sv_newmortal();
5582 if (RETVAL != -1) {
5583 if (RETVAL == 0)
5584 sv_setpvn(RETVALSV, "0 but true", 10)Perl_sv_setpvn( RETVALSV,"0 but true",10);
5585 else
5586 sv_setiv(RETVALSV, (IV)RETVAL)Perl_sv_setiv( RETVALSV,(IV)RETVAL);
5587 }
5588 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
5589 }
5590 }
5591 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
5592}
5593
5594
5595XS_EUPXS(XS_POSIX_ttyname)static void XS_POSIX_ttyname( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
5596XS_EUPXS(XS_POSIX_ttyname)static void XS_POSIX_ttyname( CV* cv __attribute__((unused)))
5597{
5598 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
5599 if (items != 1)
5600 croak_xs_usagePerl_croak_xs_usage(cv, "fd");
5601 {
5602 POSIX__Fd fd;
5603 char * RETVAL;
5604 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
5605
5606 if ((fd = (int)SvIV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000100|0x00200000
)) == 0x00000100) ? ((XPVIV*) (PL_stack_base[ax + (0)])->sv_any
)->xiv_u.xivu_iv : Perl_sv_2iv_flags( PL_stack_base[ax + (
0)],2))
) < 0) {
5607 SETERRNO(EBADF, RMS_IFI)((*__errno()) = (9));
5608 XSRETURN_IV(-1)do { (PL_stack_base[ax + (0)] = Perl_sv_2mortal( Perl_newSViv
( -1)) ); do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp
= PL_stack_base + ax + (tmpXSoff - 1); return; } while (0); }
while (0)
;
5609 }
5610;
5611
5612 RETVAL = ttyname(fd);
5613 sv_setpv(TARG, RETVAL)Perl_sv_setpv( targ,RETVAL); XSprePUSH(sp = PL_stack_base + ax - 1); PUSHTARGdo { do { if (__builtin_expect(((((targ)->sv_flags & 0x00400000
)) ? (_Bool)1 : (_Bool)0),(0))) Perl_mg_set( targ); } while (
0); (*++sp = (targ)); } while (0)
;
5614 }
5615 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
5616}
5617
5618
5619XS_EUPXS(XS_POSIX_getcwd)static void XS_POSIX_getcwd( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
5620XS_EUPXS(XS_POSIX_getcwd)static void XS_POSIX_getcwd( CV* cv __attribute__((unused)))
5621{
5622 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
5623 if (items != 0)
5624 croak_xs_usagePerl_croak_xs_usage(cv, "");
5625 PERL_UNUSED_VAR(ax)((void)sizeof(ax)); /* -Wall */
5626 SPsp -= items;
5627 {
5628#line 3892 "POSIX.xs"
5629 {
5630 dXSTARGSV * const targ = ((PL_op->op_private & 0x04) ? (PL_curpad
[PL_op->op_targ]) : Perl_sv_newmortal())
;
5631 getcwd_sv(TARG)Perl_getcwd_sv( targ);
5632 XSprePUSH(sp = PL_stack_base + ax - 1); PUSHTARGdo { do { if (__builtin_expect(((((targ)->sv_flags & 0x00400000
)) ? (_Bool)1 : (_Bool)0),(0))) Perl_mg_set( targ); } while (
0); (*++sp = (targ)); } while (0)
;
5633 }
5634#line 5635 "POSIX.c"
5635 PUTBACKPL_stack_sp = sp;
5636 return;
5637 }
5638}
5639
5640
5641XS_EUPXS(XS_POSIX_lchown)static void XS_POSIX_lchown( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
5642XS_EUPXS(XS_POSIX_lchown)static void XS_POSIX_lchown( CV* cv __attribute__((unused)))
5643{
5644 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
5645 if (items != 3)
5646 croak_xs_usagePerl_croak_xs_usage(cv, "uid, gid, path");
5647 {
5648 Uid_tuid_t uid = (Uid_tuid_t)SvNV(ST(0))((((PL_stack_base[ax + (0)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (0)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (0
)],2))
5649;
5650 Gid_tgid_t gid = (Gid_tgid_t)SvNV(ST(1))((((PL_stack_base[ax + (1)])->sv_flags & (0x00000200|0x00200000
)) == 0x00000200) ? ((XPVNV*) (PL_stack_base[ax + (1)])->sv_any
)->xnv_u.xnv_nv : Perl_sv_2nv_flags( PL_stack_base[ax + (1
)],2))
5651;
5652 char * path = (char *)SvPV_nolen(ST(2))((((PL_stack_base[ax + (2)])->sv_flags & (0x00000400|0x00200000
)) == 0x00000400) ? ((PL_stack_base[ax + (2)])->sv_u.svu_pv
) : Perl_sv_2pv_flags( PL_stack_base[ax + (2)],0,2))
5653;
5654 SysRet RETVAL;
5655#line 3904 "POSIX.xs"
5656#ifdef HAS_LCHOWN
5657 /* yes, the order of arguments is different,
5658 * but consistent with CORE::chown() */
5659 RETVAL = lchown(path, uid, gid);
5660#else
5661 PERL_UNUSED_VAR(uid)((void)sizeof(uid));
5662 PERL_UNUSED_VAR(gid)((void)sizeof(gid));
5663 PERL_UNUSED_VAR(path)((void)sizeof(path));
5664 RETVAL = not_here("lchown");
5665#endif
5666#line 5667 "POSIX.c"
5667 {
5668 SV * RETVALSV;
5669 RETVALSV = sv_newmortal()Perl_sv_newmortal();
5670 if (RETVAL != -1) {
5671 if (RETVAL == 0)
5672 sv_setpvn(RETVALSV, "0 but true", 10)Perl_sv_setpvn( RETVALSV,"0 but true",10);
5673 else
5674 sv_setiv(RETVALSV, (IV)RETVAL)Perl_sv_setiv( RETVALSV,(IV)RETVAL);
5675 }
5676 ST(0)PL_stack_base[ax + (0)] = RETVALSV;
5677 }
5678 }
5679 XSRETURN(1)do { const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0)
;
5680}
5681
5682#ifdef __cplusplus
5683extern "C"
5684#endif
5685XS_EXTERNAL(boot_POSIX)void boot_POSIX( CV* cv __attribute__((unused))); /* prototype to pass -Wmissing-prototypes */
5686XS_EXTERNAL(boot_POSIX)void boot_POSIX( CV* cv __attribute__((unused)))
5687{
5688#if PERL_VERSION_LE(5, 21, 5)((5*1000000 + 32*1000 + 1) <= (5*1000000 + 21*1000 + 5))
5689 dVARstruct Perl___notused_struct; dXSARGSSV **sp = PL_stack_sp; I32 ax = Perl_POPMARK(); SV **mark = PL_stack_base
+ ax++; I32 items = (I32)(sp - mark)
;
5690#else
5691 dVARstruct Perl___notused_struct; dXSBOOTARGSXSAPIVERCHKI32 ax = Perl_xs_handshake((((sizeof(struct PerlHandShakeInterpreter
)) << 16) | ((sizeof("" "1.94" "")-1) > 0xFF ? (Perl_croak
("panic: handshake overflow"), 0xFF) : (sizeof("" "1.94" "")-
1) << 8) | ((((1)) ? (_Bool)1 : (_Bool)0) ? 0x00000020 :
0) | ((((0)) ? (_Bool)1 : (_Bool)0) ? 0x00000080 : 0) | ((((
1)) ? (_Bool)1 : (_Bool)0) ? 0x00000040 : 0) | ((sizeof("" "v"
"5" "." "32" "." "0" "")-1) > 0x0000001F ? (Perl_croak("panic: handshake overflow"
), 0x0000001F) : (sizeof("" "v" "5" "." "32" "." "0" "")-1)))
, cv, "POSIX.c", "v" "5" "." "32" "." "0", "1.94"); SV **mark
= PL_stack_base + ax; SV **sp = PL_stack_sp; I32 items = (I32
)(sp - mark)
;
5692#endif
5693#if (PERL_REVISION5 == 5 && PERL_VERSION32 < 9)
5694 char* file = __FILE__"POSIX.c";
5695#else
5696 const char* file = __FILE__"POSIX.c";
5697#endif
5698
5699 PERL_UNUSED_VAR(file)((void)sizeof(file));
5700
5701 PERL_UNUSED_VAR(cv)((void)sizeof(cv)); /* -W */
5702 PERL_UNUSED_VAR(items)((void)sizeof(items)); /* -W */
5703#if PERL_VERSION_LE(5, 21, 5)((5*1000000 + 32*1000 + 1) <= (5*1000000 + 21*1000 + 5))
5704 XS_VERSION_BOOTCHECKPerl_xs_handshake((((sizeof(struct PerlHandShakeInterpreter))
<< 16) | ((sizeof("" "1.94" "")-1) > 0xFF ? (Perl_croak
("panic: handshake overflow"), 0xFF) : (sizeof("" "1.94" "")-
1) << 8) | ((((0)) ? (_Bool)1 : (_Bool)0) ? 0x00000020 :
0) | ((((0)) ? (_Bool)1 : (_Bool)0) ? 0x00000080 : 0) | ((((
0)) ? (_Bool)1 : (_Bool)0) ? 0x00000040 : 0) | ((sizeof("" ""
"")-1) > 0x0000001F ? (Perl_croak("panic: handshake overflow"
), 0x0000001F) : (sizeof("" "" "")-1))), cv, "POSIX.c", items
, ax, "1.94")
;
5705# ifdef XS_APIVERSION_BOOTCHECKPerl_xs_handshake((((sizeof(struct PerlHandShakeInterpreter))
<< 16) | ((sizeof("" "" "")-1) > 0xFF ? (Perl_croak
("panic: handshake overflow"), 0xFF) : (sizeof("" "" "")-1) <<
8) | ((((0)) ? (_Bool)1 : (_Bool)0) ? 0x00000020 : 0) | ((((
0)) ? (_Bool)1 : (_Bool)0) ? 0x00000080 : 0) | ((((0)) ? (_Bool
)1 : (_Bool)0) ? 0x00000040 : 0) | ((sizeof("" "v" "5" "." "32"
"." "0" "")-1) > 0x0000001F ? (Perl_croak("panic: handshake overflow"
), 0x0000001F) : (sizeof("" "v" "5" "." "32" "." "0" "")-1)))
, cv, "POSIX.c", items, ax, "v" "5" "." "32" "." "0")
5706 XS_APIVERSION_BOOTCHECKPerl_xs_handshake((((sizeof(struct PerlHandShakeInterpreter))
<< 16) | ((sizeof("" "" "")-1) > 0xFF ? (Perl_croak
("panic: handshake overflow"), 0xFF) : (sizeof("" "" "")-1) <<
8) | ((((0)) ? (_Bool)1 : (_Bool)0) ? 0x00000020 : 0) | ((((
0)) ? (_Bool)1 : (_Bool)0) ? 0x00000080 : 0) | ((((0)) ? (_Bool
)1 : (_Bool)0) ? 0x00000040 : 0) | ((sizeof("" "v" "5" "." "32"
"." "0" "")-1) > 0x0000001F ? (Perl_croak("panic: handshake overflow"
), 0x0000001F) : (sizeof("" "v" "5" "." "32" "." "0" "")-1)))
, cv, "POSIX.c", items, ax, "v" "5" "." "32" "." "0")
;
5707# endif
5708#endif
5709
5710 newXS_deffile("POSIX::SigSet::new", XS_POSIX__SigSet_new)Perl_newXS_deffile( "POSIX::SigSet::new",XS_POSIX__SigSet_new
)
;
5711 cv = newXS_deffile("POSIX::SigSet::addset", XS_POSIX__SigSet_addset)Perl_newXS_deffile( "POSIX::SigSet::addset",XS_POSIX__SigSet_addset
)
;
5712 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 0;
5713 cv = newXS_deffile("POSIX::SigSet::delset", XS_POSIX__SigSet_addset)Perl_newXS_deffile( "POSIX::SigSet::delset",XS_POSIX__SigSet_addset
)
;
5714 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 1;
5715 cv = newXS_deffile("POSIX::SigSet::emptyset", XS_POSIX__SigSet_emptyset)Perl_newXS_deffile( "POSIX::SigSet::emptyset",XS_POSIX__SigSet_emptyset
)
;
5716 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 0;
5717 cv = newXS_deffile("POSIX::SigSet::fillset", XS_POSIX__SigSet_emptyset)Perl_newXS_deffile( "POSIX::SigSet::fillset",XS_POSIX__SigSet_emptyset
)
;
5718 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 1;
5719 newXS_deffile("POSIX::SigSet::ismember", XS_POSIX__SigSet_ismember)Perl_newXS_deffile( "POSIX::SigSet::ismember",XS_POSIX__SigSet_ismember
)
;
5720 newXS_deffile("POSIX::Termios::new", XS_POSIX__Termios_new)Perl_newXS_deffile( "POSIX::Termios::new",XS_POSIX__Termios_new
)
;
5721 newXS_deffile("POSIX::Termios::getattr", XS_POSIX__Termios_getattr)Perl_newXS_deffile( "POSIX::Termios::getattr",XS_POSIX__Termios_getattr
)
;
5722 newXS_deffile("POSIX::Termios::setattr", XS_POSIX__Termios_setattr)Perl_newXS_deffile( "POSIX::Termios::setattr",XS_POSIX__Termios_setattr
)
;
5723 cv = newXS_deffile("POSIX::Termios::getispeed", XS_POSIX__Termios_getispeed)Perl_newXS_deffile( "POSIX::Termios::getispeed",XS_POSIX__Termios_getispeed
)
;
5724 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 0;
5725 cv = newXS_deffile("POSIX::Termios::getospeed", XS_POSIX__Termios_getispeed)Perl_newXS_deffile( "POSIX::Termios::getospeed",XS_POSIX__Termios_getispeed
)
;
5726 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 1;
5727 cv = newXS_deffile("POSIX::Termios::getcflag", XS_POSIX__Termios_getiflag)Perl_newXS_deffile( "POSIX::Termios::getcflag",XS_POSIX__Termios_getiflag
)
;
5728 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 2;
5729 cv = newXS_deffile("POSIX::Termios::getiflag", XS_POSIX__Termios_getiflag)Perl_newXS_deffile( "POSIX::Termios::getiflag",XS_POSIX__Termios_getiflag
)
;
5730 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 0;
5731 cv = newXS_deffile("POSIX::Termios::getlflag", XS_POSIX__Termios_getiflag)Perl_newXS_deffile( "POSIX::Termios::getlflag",XS_POSIX__Termios_getiflag
)
;
5732 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 3;
5733 cv = newXS_deffile("POSIX::Termios::getoflag", XS_POSIX__Termios_getiflag)Perl_newXS_deffile( "POSIX::Termios::getoflag",XS_POSIX__Termios_getiflag
)
;
5734 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 1;
5735 newXS_deffile("POSIX::Termios::getcc", XS_POSIX__Termios_getcc)Perl_newXS_deffile( "POSIX::Termios::getcc",XS_POSIX__Termios_getcc
)
;
5736 cv = newXS_deffile("POSIX::Termios::setispeed", XS_POSIX__Termios_setispeed)Perl_newXS_deffile( "POSIX::Termios::setispeed",XS_POSIX__Termios_setispeed
)
;
5737 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 0;
5738 cv = newXS_deffile("POSIX::Termios::setospeed", XS_POSIX__Termios_setispeed)Perl_newXS_deffile( "POSIX::Termios::setospeed",XS_POSIX__Termios_setispeed
)
;
5739 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 1;
5740 cv = newXS_deffile("POSIX::Termios::setcflag", XS_POSIX__Termios_setiflag)Perl_newXS_deffile( "POSIX::Termios::setcflag",XS_POSIX__Termios_setiflag
)
;
5741 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 2;
5742 cv = newXS_deffile("POSIX::Termios::setiflag", XS_POSIX__Termios_setiflag)Perl_newXS_deffile( "POSIX::Termios::setiflag",XS_POSIX__Termios_setiflag
)
;
5743 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 0;
5744 cv = newXS_deffile("POSIX::Termios::setlflag", XS_POSIX__Termios_setiflag)Perl_newXS_deffile( "POSIX::Termios::setlflag",XS_POSIX__Termios_setiflag
)
;
5745 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 3;
5746 cv = newXS_deffile("POSIX::Termios::setoflag", XS_POSIX__Termios_setiflag)Perl_newXS_deffile( "POSIX::Termios::setoflag",XS_POSIX__Termios_setiflag
)
;
5747 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 1;
5748 newXS_deffile("POSIX::Termios::setcc", XS_POSIX__Termios_setcc)Perl_newXS_deffile( "POSIX::Termios::setcc",XS_POSIX__Termios_setcc
)
;
5749 newXS_deffile("POSIX::constant", XS_POSIX_constant)Perl_newXS_deffile( "POSIX::constant",XS_POSIX_constant);
5750 cv = newXS_deffile("POSIX::WEXITSTATUS", XS_POSIX_WEXITSTATUS)Perl_newXS_deffile( "POSIX::WEXITSTATUS",XS_POSIX_WEXITSTATUS
)
;
5751 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 0;
5752 cv = newXS_deffile("POSIX::WIFEXITED", XS_POSIX_WEXITSTATUS)Perl_newXS_deffile( "POSIX::WIFEXITED",XS_POSIX_WEXITSTATUS);
5753 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 1;
5754 cv = newXS_deffile("POSIX::WIFSIGNALED", XS_POSIX_WEXITSTATUS)Perl_newXS_deffile( "POSIX::WIFSIGNALED",XS_POSIX_WEXITSTATUS
)
;
5755 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 2;
5756 cv = newXS_deffile("POSIX::WIFSTOPPED", XS_POSIX_WEXITSTATUS)Perl_newXS_deffile( "POSIX::WIFSTOPPED",XS_POSIX_WEXITSTATUS);
5757 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 3;
5758 cv = newXS_deffile("POSIX::WSTOPSIG", XS_POSIX_WEXITSTATUS)Perl_newXS_deffile( "POSIX::WSTOPSIG",XS_POSIX_WEXITSTATUS);
5759 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 4;
5760 cv = newXS_deffile("POSIX::WTERMSIG", XS_POSIX_WEXITSTATUS)Perl_newXS_deffile( "POSIX::WTERMSIG",XS_POSIX_WEXITSTATUS);
5761 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 5;
5762 newXS_deffile("POSIX::open", XS_POSIX_open)Perl_newXS_deffile( "POSIX::open",XS_POSIX_open);
5763 newXS_deffile("POSIX::localeconv", XS_POSIX_localeconv)Perl_newXS_deffile( "POSIX::localeconv",XS_POSIX_localeconv);
5764 newXS_deffile("POSIX::setlocale", XS_POSIX_setlocale)Perl_newXS_deffile( "POSIX::setlocale",XS_POSIX_setlocale);
5765 cv = newXS_deffile("POSIX::acos", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::acos",XS_POSIX_acos);
5766 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 0;
5767 cv = newXS_deffile("POSIX::acosh", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::acosh",XS_POSIX_acos);
5768 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 1;
5769 cv = newXS_deffile("POSIX::asin", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::asin",XS_POSIX_acos);
5770 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 2;
5771 cv = newXS_deffile("POSIX::asinh", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::asinh",XS_POSIX_acos);
5772 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 3;
5773 cv = newXS_deffile("POSIX::atan", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::atan",XS_POSIX_acos);
5774 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 4;
5775 cv = newXS_deffile("POSIX::atanh", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::atanh",XS_POSIX_acos);
5776 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 5;
5777 cv = newXS_deffile("POSIX::cbrt", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::cbrt",XS_POSIX_acos);
5778 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 6;
5779 cv = newXS_deffile("POSIX::ceil", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::ceil",XS_POSIX_acos);
5780 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 7;
5781 cv = newXS_deffile("POSIX::cosh", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::cosh",XS_POSIX_acos);
5782 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 8;
5783 cv = newXS_deffile("POSIX::erf", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::erf",XS_POSIX_acos);
5784 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 9;
5785 cv = newXS_deffile("POSIX::erfc", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::erfc",XS_POSIX_acos);
5786 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 10;
5787 cv = newXS_deffile("POSIX::exp2", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::exp2",XS_POSIX_acos);
5788 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 11;
5789 cv = newXS_deffile("POSIX::expm1", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::expm1",XS_POSIX_acos);
5790 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 12;
5791 cv = newXS_deffile("POSIX::floor", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::floor",XS_POSIX_acos);
5792 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 13;
5793 cv = newXS_deffile("POSIX::j0", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::j0",XS_POSIX_acos);
5794 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 14;
5795 cv = newXS_deffile("POSIX::j1", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::j1",XS_POSIX_acos);
5796 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 15;
5797 cv = newXS_deffile("POSIX::lgamma", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::lgamma",XS_POSIX_acos);
5798 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 16;
5799 cv = newXS_deffile("POSIX::log10", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::log10",XS_POSIX_acos);
5800 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 17;
5801 cv = newXS_deffile("POSIX::log1p", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::log1p",XS_POSIX_acos);
5802 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 18;
5803 cv = newXS_deffile("POSIX::log2", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::log2",XS_POSIX_acos);
5804 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 19;
5805 cv = newXS_deffile("POSIX::logb", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::logb",XS_POSIX_acos);
5806 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 20;
5807 cv = newXS_deffile("POSIX::nearbyint", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::nearbyint",XS_POSIX_acos);
5808 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 21;
5809 cv = newXS_deffile("POSIX::rint", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::rint",XS_POSIX_acos);
5810 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 22;
5811 cv = newXS_deffile("POSIX::round", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::round",XS_POSIX_acos);
5812 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 23;
5813 cv = newXS_deffile("POSIX::sinh", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::sinh",XS_POSIX_acos);
5814 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 24;
5815 cv = newXS_deffile("POSIX::tan", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::tan",XS_POSIX_acos);
5816 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 25;
5817 cv = newXS_deffile("POSIX::tanh", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::tanh",XS_POSIX_acos);
5818 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 26;
5819 cv = newXS_deffile("POSIX::tgamma", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::tgamma",XS_POSIX_acos);
5820 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 27;
5821 cv = newXS_deffile("POSIX::trunc", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::trunc",XS_POSIX_acos);
5822 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 28;
5823 cv = newXS_deffile("POSIX::y0", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::y0",XS_POSIX_acos);
5824 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 29;
5825 cv = newXS_deffile("POSIX::y1", XS_POSIX_acos)Perl_newXS_deffile( "POSIX::y1",XS_POSIX_acos);
5826 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 30;
5827 newXS_deffile("POSIX::fegetround", XS_POSIX_fegetround)Perl_newXS_deffile( "POSIX::fegetround",XS_POSIX_fegetround);
5828 newXS_deffile("POSIX::fesetround", XS_POSIX_fesetround)Perl_newXS_deffile( "POSIX::fesetround",XS_POSIX_fesetround);
5829 cv = newXS_deffile("POSIX::fpclassify", XS_POSIX_fpclassify)Perl_newXS_deffile( "POSIX::fpclassify",XS_POSIX_fpclassify);
5830 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 0;
5831 cv = newXS_deffile("POSIX::ilogb", XS_POSIX_fpclassify)Perl_newXS_deffile( "POSIX::ilogb",XS_POSIX_fpclassify);
5832 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 1;
5833 cv = newXS_deffile("POSIX::isfinite", XS_POSIX_fpclassify)Perl_newXS_deffile( "POSIX::isfinite",XS_POSIX_fpclassify);
5834 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 2;
5835 cv = newXS_deffile("POSIX::isinf", XS_POSIX_fpclassify)Perl_newXS_deffile( "POSIX::isinf",XS_POSIX_fpclassify);
5836 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 3;
5837 cv = newXS_deffile("POSIX::isnan", XS_POSIX_fpclassify)Perl_newXS_deffile( "POSIX::isnan",XS_POSIX_fpclassify);
5838 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 4;
5839 cv = newXS_deffile("POSIX::isnormal", XS_POSIX_fpclassify)Perl_newXS_deffile( "POSIX::isnormal",XS_POSIX_fpclassify);
5840 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 5;
5841 cv = newXS_deffile("POSIX::lrint", XS_POSIX_fpclassify)Perl_newXS_deffile( "POSIX::lrint",XS_POSIX_fpclassify);
5842 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 6;
5843 cv = newXS_deffile("POSIX::lround", XS_POSIX_fpclassify)Perl_newXS_deffile( "POSIX::lround",XS_POSIX_fpclassify);
5844 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 7;
5845 cv = newXS_deffile("POSIX::signbit", XS_POSIX_fpclassify)Perl_newXS_deffile( "POSIX::signbit",XS_POSIX_fpclassify);
5846 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 8;
5847 newXS_deffile("POSIX::getpayload", XS_POSIX_getpayload)Perl_newXS_deffile( "POSIX::getpayload",XS_POSIX_getpayload);
5848 newXS_deffile("POSIX::setpayload", XS_POSIX_setpayload)Perl_newXS_deffile( "POSIX::setpayload",XS_POSIX_setpayload);
5849 newXS_deffile("POSIX::setpayloadsig", XS_POSIX_setpayloadsig)Perl_newXS_deffile( "POSIX::setpayloadsig",XS_POSIX_setpayloadsig
)
;
5850 newXS_deffile("POSIX::issignaling", XS_POSIX_issignaling)Perl_newXS_deffile( "POSIX::issignaling",XS_POSIX_issignaling
)
;
5851 cv = newXS_deffile("POSIX::copysign", XS_POSIX_copysign)Perl_newXS_deffile( "POSIX::copysign",XS_POSIX_copysign);
5852 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 0;
5853 cv = newXS_deffile("POSIX::fdim", XS_POSIX_copysign)Perl_newXS_deffile( "POSIX::fdim",XS_POSIX_copysign);
5854 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 1;
5855 cv = newXS_deffile("POSIX::fmax", XS_POSIX_copysign)Perl_newXS_deffile( "POSIX::fmax",XS_POSIX_copysign);
5856 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 2;
5857 cv = newXS_deffile("POSIX::fmin", XS_POSIX_copysign)Perl_newXS_deffile( "POSIX::fmin",XS_POSIX_copysign);
5858 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 3;
5859 cv = newXS_deffile("POSIX::fmod", XS_POSIX_copysign)Perl_newXS_deffile( "POSIX::fmod",XS_POSIX_copysign);
5860 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 4;
5861 cv = newXS_deffile("POSIX::hypot", XS_POSIX_copysign)Perl_newXS_deffile( "POSIX::hypot",XS_POSIX_copysign);
5862 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 5;
5863 cv = newXS_deffile("POSIX::isgreater", XS_POSIX_copysign)Perl_newXS_deffile( "POSIX::isgreater",XS_POSIX_copysign);
5864 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 6;
5865 cv = newXS_deffile("POSIX::isgreaterequal", XS_POSIX_copysign)Perl_newXS_deffile( "POSIX::isgreaterequal",XS_POSIX_copysign
)
;
5866 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 7;
5867 cv = newXS_deffile("POSIX::isless", XS_POSIX_copysign)Perl_newXS_deffile( "POSIX::isless",XS_POSIX_copysign);
5868 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 8;
5869 cv = newXS_deffile("POSIX::islessequal", XS_POSIX_copysign)Perl_newXS_deffile( "POSIX::islessequal",XS_POSIX_copysign);
5870 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 9;
5871 cv = newXS_deffile("POSIX::islessgreater", XS_POSIX_copysign)Perl_newXS_deffile( "POSIX::islessgreater",XS_POSIX_copysign);
5872 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 10;
5873 cv = newXS_deffile("POSIX::isunordered", XS_POSIX_copysign)Perl_newXS_deffile( "POSIX::isunordered",XS_POSIX_copysign);
5874 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 11;
5875 cv = newXS_deffile("POSIX::nextafter", XS_POSIX_copysign)Perl_newXS_deffile( "POSIX::nextafter",XS_POSIX_copysign);
5876 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 12;
5877 cv = newXS_deffile("POSIX::nexttoward", XS_POSIX_copysign)Perl_newXS_deffile( "POSIX::nexttoward",XS_POSIX_copysign);
5878 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 13;
5879 cv = newXS_deffile("POSIX::remainder", XS_POSIX_copysign)Perl_newXS_deffile( "POSIX::remainder",XS_POSIX_copysign);
5880 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 14;
5881 newXS_deffile("POSIX::frexp", XS_POSIX_frexp)Perl_newXS_deffile( "POSIX::frexp",XS_POSIX_frexp);
5882 newXS_deffile("POSIX::ldexp", XS_POSIX_ldexp)Perl_newXS_deffile( "POSIX::ldexp",XS_POSIX_ldexp);
5883 newXS_deffile("POSIX::modf", XS_POSIX_modf)Perl_newXS_deffile( "POSIX::modf",XS_POSIX_modf);
5884 newXS_deffile("POSIX::remquo", XS_POSIX_remquo)Perl_newXS_deffile( "POSIX::remquo",XS_POSIX_remquo);
5885 newXS_deffile("POSIX::scalbn", XS_POSIX_scalbn)Perl_newXS_deffile( "POSIX::scalbn",XS_POSIX_scalbn);
5886 newXS_deffile("POSIX::fma", XS_POSIX_fma)Perl_newXS_deffile( "POSIX::fma",XS_POSIX_fma);
5887 newXS_deffile("POSIX::nan", XS_POSIX_nan)Perl_newXS_deffile( "POSIX::nan",XS_POSIX_nan);
5888 cv = newXS_deffile("POSIX::jn", XS_POSIX_jn)Perl_newXS_deffile( "POSIX::jn",XS_POSIX_jn);
5889 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 0;
5890 cv = newXS_deffile("POSIX::yn", XS_POSIX_jn)Perl_newXS_deffile( "POSIX::yn",XS_POSIX_jn);
5891 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 1;
5892 newXS_deffile("POSIX::sigaction", XS_POSIX_sigaction)Perl_newXS_deffile( "POSIX::sigaction",XS_POSIX_sigaction);
5893 cv = newXS_deffile("POSIX::sigpending", XS_POSIX_sigpending)Perl_newXS_deffile( "POSIX::sigpending",XS_POSIX_sigpending);
5894 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 0;
5895 cv = newXS_deffile("POSIX::sigsuspend", XS_POSIX_sigpending)Perl_newXS_deffile( "POSIX::sigsuspend",XS_POSIX_sigpending);
5896 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 1;
5897 newXS_deffile("POSIX::sigprocmask", XS_POSIX_sigprocmask)Perl_newXS_deffile( "POSIX::sigprocmask",XS_POSIX_sigprocmask
)
;
5898 newXS_deffile("POSIX::_exit", XS_POSIX__exit)Perl_newXS_deffile( "POSIX::_exit",XS_POSIX__exit);
5899 newXS_deffile("POSIX::dup2", XS_POSIX_dup2)Perl_newXS_deffile( "POSIX::dup2",XS_POSIX_dup2);
5900 newXS_deffile("POSIX::lseek", XS_POSIX_lseek)Perl_newXS_deffile( "POSIX::lseek",XS_POSIX_lseek);
5901 newXS_deffile("POSIX::nice", XS_POSIX_nice)Perl_newXS_deffile( "POSIX::nice",XS_POSIX_nice);
5902 newXS_deffile("POSIX::pipe", XS_POSIX_pipe)Perl_newXS_deffile( "POSIX::pipe",XS_POSIX_pipe);
5903 newXS_deffile("POSIX::read", XS_POSIX_read)Perl_newXS_deffile( "POSIX::read",XS_POSIX_read);
5904 newXS_deffile("POSIX::setpgid", XS_POSIX_setpgid)Perl_newXS_deffile( "POSIX::setpgid",XS_POSIX_setpgid);
5905 newXS_deffile("POSIX::setsid", XS_POSIX_setsid)Perl_newXS_deffile( "POSIX::setsid",XS_POSIX_setsid);
5906 newXS_deffile("POSIX::tcgetpgrp", XS_POSIX_tcgetpgrp)Perl_newXS_deffile( "POSIX::tcgetpgrp",XS_POSIX_tcgetpgrp);
5907 newXS_deffile("POSIX::tcsetpgrp", XS_POSIX_tcsetpgrp)Perl_newXS_deffile( "POSIX::tcsetpgrp",XS_POSIX_tcsetpgrp);
5908 newXS_deffile("POSIX::uname", XS_POSIX_uname)Perl_newXS_deffile( "POSIX::uname",XS_POSIX_uname);
5909 newXS_deffile("POSIX::write", XS_POSIX_write)Perl_newXS_deffile( "POSIX::write",XS_POSIX_write);
5910 newXS_deffile("POSIX::abort", XS_POSIX_abort)Perl_newXS_deffile( "POSIX::abort",XS_POSIX_abort);
5911 newXS_deffile("POSIX::mblen", XS_POSIX_mblen)Perl_newXS_deffile( "POSIX::mblen",XS_POSIX_mblen);
5912 newXS_deffile("POSIX::mbtowc", XS_POSIX_mbtowc)Perl_newXS_deffile( "POSIX::mbtowc",XS_POSIX_mbtowc);
5913 newXS_deffile("POSIX::wctomb", XS_POSIX_wctomb)Perl_newXS_deffile( "POSIX::wctomb",XS_POSIX_wctomb);
5914 newXS_deffile("POSIX::strcoll", XS_POSIX_strcoll)Perl_newXS_deffile( "POSIX::strcoll",XS_POSIX_strcoll);
5915 newXS_deffile("POSIX::strtod", XS_POSIX_strtod)Perl_newXS_deffile( "POSIX::strtod",XS_POSIX_strtod);
5916#if XSubPPtmpAAAA1
5917 newXS_deffile("POSIX::strtold", XS_POSIX_strtold)Perl_newXS_deffile( "POSIX::strtold",XS_POSIX_strtold);
5918#endif
5919 newXS_deffile("POSIX::strtol", XS_POSIX_strtol)Perl_newXS_deffile( "POSIX::strtol",XS_POSIX_strtol);
5920 newXS_deffile("POSIX::strtoul", XS_POSIX_strtoul)Perl_newXS_deffile( "POSIX::strtoul",XS_POSIX_strtoul);
5921 newXS_deffile("POSIX::strxfrm", XS_POSIX_strxfrm)Perl_newXS_deffile( "POSIX::strxfrm",XS_POSIX_strxfrm);
5922 cv = newXS_deffile("POSIX::access", XS_POSIX_mkfifo)Perl_newXS_deffile( "POSIX::access",XS_POSIX_mkfifo);
5923 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 1;
5924 cv = newXS_deffile("POSIX::mkfifo", XS_POSIX_mkfifo)Perl_newXS_deffile( "POSIX::mkfifo",XS_POSIX_mkfifo);
5925 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 0;
5926 cv = newXS_deffile("POSIX::close", XS_POSIX_tcdrain)Perl_newXS_deffile( "POSIX::close",XS_POSIX_tcdrain);
5927 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 1;
5928 cv = newXS_deffile("POSIX::dup", XS_POSIX_tcdrain)Perl_newXS_deffile( "POSIX::dup",XS_POSIX_tcdrain);
5929 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 2;
5930 cv = newXS_deffile("POSIX::tcdrain", XS_POSIX_tcdrain)Perl_newXS_deffile( "POSIX::tcdrain",XS_POSIX_tcdrain);
5931 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 0;
5932 cv = newXS_deffile("POSIX::tcflow", XS_POSIX_tcflow)Perl_newXS_deffile( "POSIX::tcflow",XS_POSIX_tcflow);
5933 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 0;
5934 cv = newXS_deffile("POSIX::tcflush", XS_POSIX_tcflow)Perl_newXS_deffile( "POSIX::tcflush",XS_POSIX_tcflow);
5935 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 1;
5936 cv = newXS_deffile("POSIX::tcsendbreak", XS_POSIX_tcflow)Perl_newXS_deffile( "POSIX::tcsendbreak",XS_POSIX_tcflow);
5937 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 2;
5938 cv = newXS_deffile("POSIX::asctime", XS_POSIX_asctime)Perl_newXS_deffile( "POSIX::asctime",XS_POSIX_asctime);
5939 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 0;
5940 cv = newXS_deffile("POSIX::mktime", XS_POSIX_asctime)Perl_newXS_deffile( "POSIX::mktime",XS_POSIX_asctime);
5941 XSANY((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_i32 = 1;
5942 newXS_deffile("POSIX::clock", XS_POSIX_clock)Perl_newXS_deffile( "POSIX::clock",XS_POSIX_clock);
5943 newXS_deffile("POSIX::ctime", XS_POSIX_ctime)Perl_newXS_deffile( "POSIX::ctime",XS_POSIX_ctime);
5944 newXS_deffile("POSIX::times", XS_POSIX_times)Perl_newXS_deffile( "POSIX::times",XS_POSIX_times);
5945 newXS_deffile("POSIX::difftime", XS_POSIX_difftime)Perl_newXS_deffile( "POSIX::difftime",XS_POSIX_difftime);
5946 newXS_deffile("POSIX::strftime", XS_POSIX_strftime)Perl_newXS_deffile( "POSIX::strftime",XS_POSIX_strftime);
5947 newXS_deffile("POSIX::tzset", XS_POSIX_tzset)Perl_newXS_deffile( "POSIX::tzset",XS_POSIX_tzset);
5948 newXS_deffile("POSIX::tzname", XS_POSIX_tzname)Perl_newXS_deffile( "POSIX::tzname",XS_POSIX_tzname);
5949 newXS_deffile("POSIX::ctermid", XS_POSIX_ctermid)Perl_newXS_deffile( "POSIX::ctermid",XS_POSIX_ctermid);
5950 newXS_deffile("POSIX::cuserid", XS_POSIX_cuserid)Perl_newXS_deffile( "POSIX::cuserid",XS_POSIX_cuserid);
5951 newXS_deffile("POSIX::fpathconf", XS_POSIX_fpathconf)Perl_newXS_deffile( "POSIX::fpathconf",XS_POSIX_fpathconf);
5952 newXS_deffile("POSIX::pathconf", XS_POSIX_pathconf)Perl_newXS_deffile( "POSIX::pathconf",XS_POSIX_pathconf);
5953 newXS_deffile("POSIX::pause", XS_POSIX_pause)Perl_newXS_deffile( "POSIX::pause",XS_POSIX_pause);
5954 newXS_deffile("POSIX::sleep", XS_POSIX_sleep)Perl_newXS_deffile( "POSIX::sleep",XS_POSIX_sleep);
5955 newXS_deffile("POSIX::setgid", XS_POSIX_setgid)Perl_newXS_deffile( "POSIX::setgid",XS_POSIX_setgid);
5956 newXS_deffile("POSIX::setuid", XS_POSIX_setuid)Perl_newXS_deffile( "POSIX::setuid",XS_POSIX_setuid);
5957 newXS_deffile("POSIX::sysconf", XS_POSIX_sysconf)Perl_newXS_deffile( "POSIX::sysconf",XS_POSIX_sysconf);
5958 newXS_deffile("POSIX::ttyname", XS_POSIX_ttyname)Perl_newXS_deffile( "POSIX::ttyname",XS_POSIX_ttyname);
5959 newXS_deffile("POSIX::getcwd", XS_POSIX_getcwd)Perl_newXS_deffile( "POSIX::getcwd",XS_POSIX_getcwd);
5960 newXS_deffile("POSIX::lchown", XS_POSIX_lchown)Perl_newXS_deffile( "POSIX::lchown",XS_POSIX_lchown);
5961
5962 /* Initialisation Section */
5963
5964#line 2 "./const-xs.inc"
5965 {
5966#if defined(dTHXstruct Perl___notused_struct) && !defined(PERL_NO_GET_CONTEXT)
5967 dTHXstruct Perl___notused_struct;
5968#endif
5969 HV *symbol_table = get_hv("POSIX::", GV_ADD)Perl_get_hv( "POSIX::",0x01);
5970
5971 static const struct iv_s values_for_iv[] =
5972 {
5973#ifdef ARG_MAX(512 * 1024)
5974 { "ARG_MAX", 7, ARG_MAX(512 * 1024) },
5975#endif
5976#ifdef B00
5977 { "B0", 2, B00 },
5978#endif
5979#ifdef B110110
5980 { "B110", 4, B110110 },
5981#endif
5982#ifdef B12001200
5983 { "B1200", 5, B12001200 },
5984#endif
5985#ifdef B134134
5986 { "B134", 4, B134134 },
5987#endif
5988#ifdef B150150
5989 { "B150", 4, B150150 },
5990#endif
5991#ifdef B18001800
5992 { "B1800", 5, B18001800 },
5993#endif
5994#ifdef B1920019200
5995 { "B19200", 6, B1920019200 },
5996#endif
5997#ifdef B200200
5998 { "B200", 4, B200200 },
5999#endif
6000#ifdef B24002400
6001 { "B2400", 5, B24002400 },
6002#endif
6003#ifdef B300300
6004 { "B300", 4, B300300 },
6005#endif
6006#ifdef B3840038400
6007 { "B38400", 6, B3840038400 },
6008#endif
6009#ifdef B48004800
6010 { "B4800", 5, B48004800 },
6011#endif
6012#ifdef B5050
6013 { "B50", 3, B5050 },
6014#endif
6015#ifdef B600600
6016 { "B600", 4, B600600 },
6017#endif
6018#ifdef B7575
6019 { "B75", 3, B7575 },
6020#endif
6021#ifdef B96009600
6022 { "B9600", 5, B96009600 },
6023#endif
6024#ifdef BRKINT0x00000002
6025 { "BRKINT", 6, BRKINT0x00000002 },
6026#endif
6027#ifdef BUFSIZ1024
6028 { "BUFSIZ", 6, BUFSIZ1024 },
6029#endif
6030#ifdef CHAR_BIT8
6031 { "CHAR_BIT", 8, CHAR_BIT8 },
6032#endif
6033#ifdef CHAR_MAX127
6034 { "CHAR_MAX", 8, CHAR_MAX127 },
6035#endif
6036#ifdef CHAR_MIN(-127 -1)
6037 { "CHAR_MIN", 8, CHAR_MIN(-127 -1) },
6038#endif
6039#ifdef CHILD_MAX80
6040 { "CHILD_MAX", 9, CHILD_MAX80 },
6041#endif
6042#ifdef CLOCAL0x00008000
6043 { "CLOCAL", 6, CLOCAL0x00008000 },
6044#endif
6045#ifdef CLOCKS_PER_SEC100
6046 { "CLOCKS_PER_SEC", 14, CLOCKS_PER_SEC100 },
6047#endif
6048#ifdef CREAD0x00000800
6049 { "CREAD", 5, CREAD0x00000800 },
6050#endif
6051#ifdef CS50x00000000
6052 { "CS5", 3, CS50x00000000 },
6053#endif
6054#ifdef CS60x00000100
6055 { "CS6", 3, CS60x00000100 },
6056#endif
6057#ifdef CS70x00000200
6058 { "CS7", 3, CS70x00000200 },
6059#endif
6060#ifdef CS80x00000300
6061 { "CS8", 3, CS80x00000300 },
6062#endif
6063#ifdef CSIZE0x00000300
6064 { "CSIZE", 5, CSIZE0x00000300 },
6065#endif
6066#ifdef CSTOPB0x00000400
6067 { "CSTOPB", 6, CSTOPB0x00000400 },
6068#endif
6069#ifdef E2BIG7
6070 { "E2BIG", 5, E2BIG7 },
6071#endif
6072#ifdef EACCES13
6073 { "EACCES", 6, EACCES13 },
6074#endif
6075#ifdef EADDRINUSE48
6076 { "EADDRINUSE", 10, EADDRINUSE48 },
6077#endif
6078#ifdef EADDRNOTAVAIL49
6079 { "EADDRNOTAVAIL", 13, EADDRNOTAVAIL49 },
6080#endif
6081#ifdef EAFNOSUPPORT47
6082 { "EAFNOSUPPORT", 12, EAFNOSUPPORT47 },
6083#endif
6084#ifdef EAGAIN35
6085 { "EAGAIN", 6, EAGAIN35 },
6086#endif
6087#ifdef EALREADY37
6088 { "EALREADY", 8, EALREADY37 },
6089#endif
6090#ifdef EBADF9
6091 { "EBADF", 5, EBADF9 },
6092#endif
6093#ifdef EBADMSG92
6094 { "EBADMSG", 7, EBADMSG92 },
6095#endif
6096#ifdef EBUSY16
6097 { "EBUSY", 5, EBUSY16 },
6098#endif
6099#ifdef ECANCELED88
6100 { "ECANCELED", 9, ECANCELED88 },
6101#endif
6102#ifdef ECHILD10
6103 { "ECHILD", 6, ECHILD10 },
6104#endif
6105#ifdef ECHO0x00000008
6106 { "ECHO", 4, ECHO0x00000008 },
6107#endif
6108#ifdef ECHOE0x00000002
6109 { "ECHOE", 5, ECHOE0x00000002 },
6110#endif
6111#ifdef ECHOK0x00000004
6112 { "ECHOK", 5, ECHOK0x00000004 },
6113#endif
6114#ifdef ECHONL0x00000010
6115 { "ECHONL", 6, ECHONL0x00000010 },
6116#endif
6117#ifdef ECONNABORTED53
6118 { "ECONNABORTED", 12, ECONNABORTED53 },
6119#endif
6120#ifdef ECONNREFUSED61
6121 { "ECONNREFUSED", 12, ECONNREFUSED61 },
6122#endif
6123#ifdef ECONNRESET54
6124 { "ECONNRESET", 10, ECONNRESET54 },
6125#endif
6126#ifdef EDEADLK11
6127 { "EDEADLK", 7, EDEADLK11 },
6128#endif
6129#ifdef EDESTADDRREQ39
6130 { "EDESTADDRREQ", 12, EDESTADDRREQ39 },
6131#endif
6132#ifdef EDOM33
6133 { "EDOM", 4, EDOM33 },
6134#endif
6135#ifdef EDQUOT69
6136 { "EDQUOT", 6, EDQUOT69 },
6137#endif
6138#ifdef EEXIST17
6139 { "EEXIST", 6, EEXIST17 },
6140#endif
6141#ifdef EFAULT14
6142 { "EFAULT", 6, EFAULT14 },
6143#endif
6144#ifdef EFBIG27
6145 { "EFBIG", 5, EFBIG27 },
6146#endif
6147#ifdef EHOSTDOWN64
6148 { "EHOSTDOWN", 9, EHOSTDOWN64 },
6149#endif
6150#ifdef EHOSTUNREACH65
6151 { "EHOSTUNREACH", 12, EHOSTUNREACH65 },
6152#endif
6153#ifdef EIDRM89
6154 { "EIDRM", 5, EIDRM89 },
6155#endif
6156#ifdef EILSEQ84
6157 { "EILSEQ", 6, EILSEQ84 },
6158#endif
6159#ifdef EINPROGRESS36
6160 { "EINPROGRESS", 11, EINPROGRESS36 },
6161#endif
6162#ifdef EINTR4
6163 { "EINTR", 5, EINTR4 },
6164#endif
6165#ifdef EINVAL22
6166 { "EINVAL", 6, EINVAL22 },
6167#endif
6168#ifdef EIO5
6169 { "EIO", 3, EIO5 },
6170#endif
6171#ifdef EISCONN56
6172 { "EISCONN", 7, EISCONN56 },
6173#endif
6174#ifdef EISDIR21
6175 { "EISDIR", 6, EISDIR21 },
6176#endif
6177#ifdef ELOOP62
6178 { "ELOOP", 5, ELOOP62 },
6179#endif
6180#ifdef EMFILE24
6181 { "EMFILE", 6, EMFILE24 },
6182#endif
6183#ifdef EMLINK31
6184 { "EMLINK", 6, EMLINK31 },
6185#endif
6186#ifdef EMSGSIZE40
6187 { "EMSGSIZE", 8, EMSGSIZE40 },
6188#endif
6189#ifdef ENAMETOOLONG63
6190 { "ENAMETOOLONG", 12, ENAMETOOLONG63 },
6191#endif
6192#ifdef ENETDOWN50
6193 { "ENETDOWN", 8, ENETDOWN50 },
6194#endif
6195#ifdef ENETRESET52
6196 { "ENETRESET", 9, ENETRESET52 },
6197#endif
6198#ifdef ENETUNREACH51
6199 { "ENETUNREACH", 11, ENETUNREACH51 },
6200#endif
6201#ifdef ENFILE23
6202 { "ENFILE", 6, ENFILE23 },
6203#endif
6204#ifdef ENOBUFS55
6205 { "ENOBUFS", 7, ENOBUFS55 },
6206#endif
6207#ifdef ENODATA
6208 { "ENODATA", 7, ENODATA },
6209#endif
6210#ifdef ENODEV19
6211 { "ENODEV", 6, ENODEV19 },
6212#endif
6213#ifdef ENOENT2
6214 { "ENOENT", 6, ENOENT2 },
6215#endif
6216#ifdef ENOEXEC8
6217 { "ENOEXEC", 7, ENOEXEC8 },
6218#endif
6219#ifdef ENOLCK77
6220 { "ENOLCK", 6, ENOLCK77 },
6221#endif
6222#ifdef ENOLINK
6223 { "ENOLINK", 7, ENOLINK },
6224#endif
6225#ifdef ENOMEM12
6226 { "ENOMEM", 6, ENOMEM12 },
6227#endif
6228#ifdef ENOMSG90
6229 { "ENOMSG", 6, ENOMSG90 },
6230#endif
6231#ifdef ENOPROTOOPT42
6232 { "ENOPROTOOPT", 11, ENOPROTOOPT42 },
6233#endif
6234#ifdef ENOSPC28
6235 { "ENOSPC", 6, ENOSPC28 },
6236#endif
6237#ifdef ENOSR
6238 { "ENOSR", 5, ENOSR },
6239#endif
6240#ifdef ENOSTR
6241 { "ENOSTR", 6, ENOSTR },
6242#endif
6243#ifdef ENOSYS78
6244 { "ENOSYS", 6, ENOSYS78 },
6245#endif
6246#ifdef ENOTBLK15
6247 { "ENOTBLK", 7, ENOTBLK15 },
6248#endif
6249#ifdef ENOTCONN57
6250 { "ENOTCONN", 8, ENOTCONN57 },
6251#endif
6252#ifdef ENOTDIR20
6253 { "ENOTDIR", 7, ENOTDIR20 },
6254#endif
6255#ifdef ENOTEMPTY66
6256 { "ENOTEMPTY", 9, ENOTEMPTY66 },
6257#endif
6258#ifdef ENOTRECOVERABLE93
6259 { "ENOTRECOVERABLE", 15, ENOTRECOVERABLE93 },
6260#endif
6261#ifdef ENOTSOCK38
6262 { "ENOTSOCK", 8, ENOTSOCK38 },
6263#endif
6264#ifdef ENOTSUP91
6265 { "ENOTSUP", 7, ENOTSUP91 },
6266#endif
6267#ifdef ENOTTY25
6268 { "ENOTTY", 6, ENOTTY25 },
6269#endif
6270#ifdef ENXIO6
6271 { "ENXIO", 5, ENXIO6 },
6272#endif
6273#ifdef EOF(-1)
6274 { "EOF", 3, EOF(-1) },
6275#endif
6276#ifdef EOPNOTSUPP45
6277 { "EOPNOTSUPP", 10, EOPNOTSUPP45 },
6278#endif
6279#ifdef EOTHER
6280 { "EOTHER", 6, EOTHER },
6281#endif
6282#ifdef EOVERFLOW87
6283 { "EOVERFLOW", 9, EOVERFLOW87 },
6284#endif
6285#ifdef EOWNERDEAD94
6286 { "EOWNERDEAD", 10, EOWNERDEAD94 },
6287#endif
6288#ifdef EPERM1
6289 { "EPERM", 5, EPERM1 },
6290#endif
6291#ifdef EPFNOSUPPORT46
6292 { "EPFNOSUPPORT", 12, EPFNOSUPPORT46 },
6293#endif
6294#ifdef EPIPE32
6295 { "EPIPE", 5, EPIPE32 },
6296#endif
6297#ifdef EPROCLIM67
6298 { "EPROCLIM", 8, EPROCLIM67 },
6299#endif
6300#ifdef EPROTO95
6301 { "EPROTO", 6, EPROTO95 },
6302#endif
6303#ifdef EPROTONOSUPPORT43
6304 { "EPROTONOSUPPORT", 15, EPROTONOSUPPORT43 },
6305#endif
6306#ifdef EPROTOTYPE41
6307 { "EPROTOTYPE", 10, EPROTOTYPE41 },
6308#endif
6309#ifdef ERANGE34
6310 { "ERANGE", 6, ERANGE34 },
6311#endif
6312#ifdef EREMOTE71
6313 { "EREMOTE", 7, EREMOTE71 },
6314#endif
6315#ifdef ERESTART
6316 { "ERESTART", 8, ERESTART },
6317#endif
6318#ifdef EROFS30
6319 { "EROFS", 5, EROFS30 },
6320#endif
6321#ifdef ESHUTDOWN58
6322 { "ESHUTDOWN", 9, ESHUTDOWN58 },
6323#endif
6324#ifdef ESOCKTNOSUPPORT44
6325 { "ESOCKTNOSUPPORT", 15, ESOCKTNOSUPPORT44 },
6326#endif
6327#ifdef ESPIPE29
6328 { "ESPIPE", 6, ESPIPE29 },
6329#endif
6330#ifdef ESRCH3
6331 { "ESRCH", 5, ESRCH3 },
6332#endif
6333#ifdef ESTALE70
6334 { "ESTALE", 6, ESTALE70 },
6335#endif
6336#ifdef ETIME
6337 { "ETIME", 5, ETIME },
6338#endif
6339#ifdef ETIMEDOUT60
6340 { "ETIMEDOUT", 9, ETIMEDOUT60 },
6341#endif
6342#ifdef ETOOMANYREFS59
6343 { "ETOOMANYREFS", 12, ETOOMANYREFS59 },
6344#endif
6345#ifdef ETXTBSY26
6346 { "ETXTBSY", 7, ETXTBSY26 },
6347#endif
6348#ifdef EUSERS68
6349 { "EUSERS", 6, EUSERS68 },
6350#endif
6351#ifdef EWOULDBLOCK35
6352 { "EWOULDBLOCK", 11, EWOULDBLOCK35 },
6353#endif
6354#ifdef EXDEV18
6355 { "EXDEV", 5, EXDEV18 },
6356#endif
6357#ifdef FILENAME_MAX1024
6358 { "FILENAME_MAX", 12, FILENAME_MAX1024 },
6359#endif
6360#ifdef F_OK0
6361 { "F_OK", 4, F_OK0 },
6362#endif
6363#ifdef HUPCL0x00004000
6364 { "HUPCL", 5, HUPCL0x00004000 },
6365#endif
6366#ifdef ICANON0x00000100
6367 { "ICANON", 6, ICANON0x00000100 },
6368#endif
6369#ifdef ICRNL0x00000100
6370 { "ICRNL", 5, ICRNL0x00000100 },
6371#endif
6372#ifdef IEXTEN0x00000400
6373 { "IEXTEN", 6, IEXTEN0x00000400 },
6374#endif
6375#ifdef IGNBRK0x00000001
6376 { "IGNBRK", 6, IGNBRK0x00000001 },
6377#endif
6378#ifdef IGNCR0x00000080
6379 { "IGNCR", 5, IGNCR0x00000080 },
6380#endif
6381#ifdef IGNPAR0x00000004
6382 { "IGNPAR", 6, IGNPAR0x00000004 },
6383#endif
6384#ifdef INLCR0x00000040
6385 { "INLCR", 5, INLCR0x00000040 },
6386#endif
6387#ifdef INPCK0x00000010
6388 { "INPCK", 5, INPCK0x00000010 },
6389#endif
6390#ifdef INT_MAX2147483647
6391 { "INT_MAX", 7, INT_MAX2147483647 },
6392#endif
6393#ifdef INT_MIN(-2147483647 -1)
6394 { "INT_MIN", 7, INT_MIN(-2147483647 -1) },
6395#endif
6396#ifdef ISIG0x00000080
6397 { "ISIG", 4, ISIG0x00000080 },
6398#endif
6399#ifdef ISTRIP0x00000020
6400 { "ISTRIP", 6, ISTRIP0x00000020 },
6401#endif
6402#ifdef IXOFF0x00000400
6403 { "IXOFF", 5, IXOFF0x00000400 },
6404#endif
6405#ifdef IXON0x00000200
6406 { "IXON", 4, IXON0x00000200 },
6407#endif
6408#ifdef LC_ADDRESS
6409 { "LC_ADDRESS", 10, LC_ADDRESS },
6410#endif
6411#ifdef LC_ALL0
6412 { "LC_ALL", 6, LC_ALL0 },
6413#endif
6414#ifdef LC_COLLATE1
6415 { "LC_COLLATE", 10, LC_COLLATE1 },
6416#endif
6417#ifdef LC_CTYPE2
6418 { "LC_CTYPE", 8, LC_CTYPE2 },
6419#endif
6420#ifdef LC_IDENTIFICATION
6421 { "LC_IDENTIFICATION", 17, LC_IDENTIFICATION },
6422#endif
6423#ifdef LC_MEASUREMENT
6424 { "LC_MEASUREMENT", 14, LC_MEASUREMENT },
6425#endif
6426#ifdef LC_MESSAGES6
6427 { "LC_MESSAGES", 11, LC_MESSAGES6 },
6428#endif
6429#ifdef LC_MONETARY3
6430 { "LC_MONETARY", 11, LC_MONETARY3 },
6431#endif
6432#ifdef LC_NUMERIC4
6433 { "LC_NUMERIC", 10, LC_NUMERIC4 },
6434#endif
6435#ifdef LC_PAPER
6436 { "LC_PAPER", 8, LC_PAPER },
6437#endif
6438#ifdef LC_TELEPHONE
6439 { "LC_TELEPHONE", 12, LC_TELEPHONE },
6440#endif
6441#ifdef LC_TIME5
6442 { "LC_TIME", 7, LC_TIME5 },
6443#endif
6444#ifdef LINK_MAX32767
6445 { "LINK_MAX", 8, LINK_MAX32767 },
6446#endif
6447#ifdef LONG_MAX9223372036854775807L
6448 { "LONG_MAX", 8, LONG_MAX9223372036854775807L },
6449#endif
6450#ifdef LONG_MIN(-9223372036854775807L -1L)
6451 { "LONG_MIN", 8, LONG_MIN(-9223372036854775807L -1L) },
6452#endif
6453#ifdef L_ctermid1024
6454 { "L_ctermid", 9, L_ctermid1024 },
6455#endif
6456#ifdef L_cuserid
6457 { "L_cuserid", 9, L_cuserid },
6458#endif
6459#ifdef MAX_CANON255
6460 { "MAX_CANON", 9, MAX_CANON255 },
6461#endif
6462#ifdef MAX_INPUT255
6463 { "MAX_INPUT", 9, MAX_INPUT255 },
6464#endif
6465#ifdef MB_LEN_MAX4
6466 { "MB_LEN_MAX", 10, MB_LEN_MAX4 },
6467#endif
6468#ifdef MSG_CTRUNC0x20
6469 { "MSG_CTRUNC", 10, MSG_CTRUNC0x20 },
6470#endif
6471#ifdef MSG_DONTROUTE0x4
6472 { "MSG_DONTROUTE", 13, MSG_DONTROUTE0x4 },
6473#endif
6474#ifdef MSG_EOR0x8
6475 { "MSG_EOR", 7, MSG_EOR0x8 },
6476#endif
6477#ifdef MSG_OOB0x1
6478 { "MSG_OOB", 7, MSG_OOB0x1 },
6479#endif
6480#ifdef MSG_PEEK0x2
6481 { "MSG_PEEK", 8, MSG_PEEK0x2 },
6482#endif
6483#ifdef MSG_TRUNC0x10
6484 { "MSG_TRUNC", 9, MSG_TRUNC0x10 },
6485#endif
6486#ifdef MSG_WAITALL0x40
6487 { "MSG_WAITALL", 11, MSG_WAITALL0x40 },
6488#endif
6489#ifdef NAME_MAX255
6490 { "NAME_MAX", 8, NAME_MAX255 },
6491#endif
6492#ifdef NCCS20
6493 { "NCCS", 4, NCCS20 },
6494#endif
6495#ifdef NGROUPS_MAX16
6496 { "NGROUPS_MAX", 11, NGROUPS_MAX16 },
6497#endif
6498#ifdef NOFLSH0x80000000
6499 { "NOFLSH", 6, NOFLSH0x80000000 },
6500#endif
6501#ifdef OPEN_MAX64
6502 { "OPEN_MAX", 8, OPEN_MAX64 },
6503#endif
6504#ifdef OPOST0x00000001
6505 { "OPOST", 5, OPOST0x00000001 },
6506#endif
6507#ifdef PARENB0x00001000
6508 { "PARENB", 6, PARENB0x00001000 },
6509#endif
6510#ifdef PARMRK0x00000008
6511 { "PARMRK", 6, PARMRK0x00000008 },
6512#endif
6513#ifdef PARODD0x00002000
6514 { "PARODD", 6, PARODD0x00002000 },
6515#endif
6516#ifdef PATH_MAX1024
6517 { "PATH_MAX", 8, PATH_MAX1024 },
6518#endif
6519#ifdef PIPE_BUF512
6520 { "PIPE_BUF", 8, PIPE_BUF512 },
6521#endif
6522#ifdef RAND_MAX0x7fffffff
6523 { "RAND_MAX", 8, RAND_MAX0x7fffffff },
6524#endif
6525#ifdef R_OK0x04
6526 { "R_OK", 4, R_OK0x04 },
6527#endif
6528#ifdef SCHAR_MAX127
6529 { "SCHAR_MAX", 9, SCHAR_MAX127 },
6530#endif
6531#ifdef SCHAR_MIN(-127 -1)
6532 { "SCHAR_MIN", 9, SCHAR_MIN(-127 -1) },
6533#endif
6534#ifdef SHRT_MAX32767
6535 { "SHRT_MAX", 8, SHRT_MAX32767 },
6536#endif
6537#ifdef SHRT_MIN(-32767 -1)
6538 { "SHRT_MIN", 8, SHRT_MIN(-32767 -1) },
6539#endif
6540#ifdef SIGABRT6
6541 { "SIGABRT", 7, SIGABRT6 },
6542#endif
6543#ifdef SIGALRM14
6544 { "SIGALRM", 7, SIGALRM14 },
6545#endif
6546#ifdef SIGCHLD20
6547 { "SIGCHLD", 7, SIGCHLD20 },
6548#endif
6549#ifdef SIGCONT19
6550 { "SIGCONT", 7, SIGCONT19 },
6551#endif
6552#ifdef SIGFPE8
6553 { "SIGFPE", 6, SIGFPE8 },
6554#endif
6555#ifdef SIGHUP1
6556 { "SIGHUP", 6, SIGHUP1 },
6557#endif
6558#ifdef SIGILL4
6559 { "SIGILL", 6, SIGILL4 },
6560#endif
6561#ifdef SIGINT2
6562 { "SIGINT", 6, SIGINT2 },
6563#endif
6564#ifdef SIGKILL9
6565 { "SIGKILL", 7, SIGKILL9 },
6566#endif
6567#ifdef SIGPIPE13
6568 { "SIGPIPE", 7, SIGPIPE13 },
6569#endif
6570#ifdef SIGQUIT3
6571 { "SIGQUIT", 7, SIGQUIT3 },
6572#endif
6573#ifdef SIGSEGV11
6574 { "SIGSEGV", 7, SIGSEGV11 },
6575#endif
6576#ifdef SIGSTOP17
6577 { "SIGSTOP", 7, SIGSTOP17 },
6578#endif
6579#ifdef SIGTERM15
6580 { "SIGTERM", 7, SIGTERM15 },
6581#endif
6582#ifdef SIGTSTP18
6583 { "SIGTSTP", 7, SIGTSTP18 },
6584#endif
6585#ifdef SIGTTIN21
6586 { "SIGTTIN", 7, SIGTTIN21 },
6587#endif
6588#ifdef SIGTTOU22
6589 { "SIGTTOU", 7, SIGTTOU22 },
6590#endif
6591#ifdef SIGUSR130
6592 { "SIGUSR1", 7, SIGUSR130 },
6593#endif
6594#ifdef SIGUSR231
6595 { "SIGUSR2", 7, SIGUSR231 },
6596#endif
6597#ifdef SIG_BLOCK1
6598 { "SIG_BLOCK", 9, SIG_BLOCK1 },
6599#endif
6600#ifdef SIG_SETMASK3
6601 { "SIG_SETMASK", 11, SIG_SETMASK3 },
6602#endif
6603#ifdef SIG_UNBLOCK2
6604 { "SIG_UNBLOCK", 11, SIG_UNBLOCK2 },
6605#endif
6606#ifdef SSIZE_MAX9223372036854775807L
6607 { "SSIZE_MAX", 9, SSIZE_MAX9223372036854775807L },
6608#endif
6609#ifdef SIGBUS10
6610 { "SIGBUS", 6, SIGBUS10 },
6611#endif
6612#ifdef SIGPOLL
6613 { "SIGPOLL", 7, SIGPOLL },
6614#endif
6615#ifdef SIGPROF27
6616 { "SIGPROF", 7, SIGPROF27 },
6617#endif
6618#ifdef SIGSYS12
6619 { "SIGSYS", 6, SIGSYS12 },
6620#endif
6621#ifdef SIGTRAP5
6622 { "SIGTRAP", 7, SIGTRAP5 },
6623#endif
6624#ifdef SIGURG16
6625 { "SIGURG", 6, SIGURG16 },
6626#endif
6627#ifdef SIGVTALRM26
6628 { "SIGVTALRM", 9, SIGVTALRM26 },
6629#endif
6630#ifdef SIGXCPU24
6631 { "SIGXCPU", 7, SIGXCPU24 },
6632#endif
6633#ifdef SIGXFSZ25
6634 { "SIGXFSZ", 7, SIGXFSZ25 },
6635#endif
6636#ifdef STDERR_FILENO2
6637 { "STDERR_FILENO", 13, STDERR_FILENO2 },
6638#endif
6639#ifdef STDIN_FILENO0
6640 { "STDIN_FILENO", 12, STDIN_FILENO0 },
6641#endif
6642#ifdef STDOUT_FILENO1
6643 { "STDOUT_FILENO", 13, STDOUT_FILENO1 },
6644#endif
6645#ifdef STREAM_MAX
6646 { "STREAM_MAX", 10, STREAM_MAX },
6647#endif
6648#ifdef TCIFLUSH1
6649 { "TCIFLUSH", 8, TCIFLUSH1 },
6650#endif
6651#ifdef TCIOFF3
6652 { "TCIOFF", 6, TCIOFF3 },
6653#endif
6654#ifdef TCIOFLUSH3
6655 { "TCIOFLUSH", 9, TCIOFLUSH3 },
6656#endif
6657#ifdef TCION4
6658 { "TCION", 5, TCION4 },
6659#endif
6660#ifdef TCOFLUSH2
6661 { "TCOFLUSH", 8, TCOFLUSH2 },
6662#endif
6663#ifdef TCOOFF1
6664 { "TCOOFF", 6, TCOOFF1 },
6665#endif
6666#ifdef TCOON2
6667 { "TCOON", 5, TCOON2 },
6668#endif
6669#ifdef TCSADRAIN1
6670 { "TCSADRAIN", 9, TCSADRAIN1 },
6671#endif
6672#ifdef TCSAFLUSH2
6673 { "TCSAFLUSH", 9, TCSAFLUSH2 },
6674#endif
6675#ifdef TCSANOW0
6676 { "TCSANOW", 7, TCSANOW0 },
6677#endif
6678#ifdef TMP_MAX0x7fffffff
6679 { "TMP_MAX", 7, TMP_MAX0x7fffffff },
6680#endif
6681#ifdef TOSTOP0x00400000
6682 { "TOSTOP", 6, TOSTOP0x00400000 },
6683#endif
6684#ifdef TZNAME_MAX
6685 { "TZNAME_MAX", 10, TZNAME_MAX },
6686#endif
6687#ifdef VEOF0
6688 { "VEOF", 4, VEOF0 },
6689#endif
6690#ifdef VEOL1
6691 { "VEOL", 4, VEOL1 },
6692#endif
6693#ifdef VERASE3
6694 { "VERASE", 6, VERASE3 },
6695#endif
6696#ifdef VINTR8
6697 { "VINTR", 5, VINTR8 },
6698#endif
6699#ifdef VKILL5
6700 { "VKILL", 5, VKILL5 },
6701#endif
6702#ifdef VMIN16
6703 { "VMIN", 4, VMIN16 },
6704#endif
6705#ifdef VQUIT9
6706 { "VQUIT", 5, VQUIT9 },
6707#endif
6708#ifdef VSTART12
6709 { "VSTART", 6, VSTART12 },
6710#endif
6711#ifdef VSTOP13
6712 { "VSTOP", 5, VSTOP13 },
6713#endif
6714#ifdef VSUSP10
6715 { "VSUSP", 5, VSUSP10 },
6716#endif
6717#ifdef VTIME17
6718 { "VTIME", 5, VTIME17 },
6719#endif
6720#ifdef WNOHANG1
6721 { "WNOHANG", 7, WNOHANG1 },
6722#endif
6723#ifdef WUNTRACED2
6724 { "WUNTRACED", 9, WUNTRACED2 },
6725#endif
6726#ifdef W_OK0x02
6727 { "W_OK", 4, W_OK0x02 },
6728#endif
6729#ifdef X_OK0x01
6730 { "X_OK", 4, X_OK0x01 },
6731#endif
6732#ifdef _PC_CHOWN_RESTRICTED7
6733 { "_PC_CHOWN_RESTRICTED", 20, _PC_CHOWN_RESTRICTED7 },
6734#endif
6735#ifdef _PC_LINK_MAX1
6736 { "_PC_LINK_MAX", 12, _PC_LINK_MAX1 },
6737#endif
6738#ifdef _PC_MAX_CANON2
6739 { "_PC_MAX_CANON", 13, _PC_MAX_CANON2 },
6740#endif
6741#ifdef _PC_MAX_INPUT3
6742 { "_PC_MAX_INPUT", 13, _PC_MAX_INPUT3 },
6743#endif
6744#ifdef _PC_NAME_MAX4
6745 { "_PC_NAME_MAX", 12, _PC_NAME_MAX4 },
6746#endif
6747#ifdef _PC_NO_TRUNC8
6748 { "_PC_NO_TRUNC", 12, _PC_NO_TRUNC8 },
6749#endif
6750#ifdef _PC_PATH_MAX5
6751 { "_PC_PATH_MAX", 12, _PC_PATH_MAX5 },
6752#endif
6753#ifdef _PC_PIPE_BUF6
6754 { "_PC_PIPE_BUF", 12, _PC_PIPE_BUF6 },
6755#endif
6756#ifdef _PC_VDISABLE9
6757 { "_PC_VDISABLE", 12, _PC_VDISABLE9 },
6758#endif
6759#ifdef _SC_ARG_MAX1
6760 { "_SC_ARG_MAX", 11, _SC_ARG_MAX1 },
6761#endif
6762#ifdef _SC_CHILD_MAX2
6763 { "_SC_CHILD_MAX", 13, _SC_CHILD_MAX2 },
6764#endif
6765#ifdef _SC_CLK_TCK3
6766 { "_SC_CLK_TCK", 11, _SC_CLK_TCK3 },
6767#endif
6768#ifdef _SC_JOB_CONTROL6
6769 { "_SC_JOB_CONTROL", 15, _SC_JOB_CONTROL6 },
6770#endif
6771#ifdef _SC_NGROUPS_MAX4
6772 { "_SC_NGROUPS_MAX", 15, _SC_NGROUPS_MAX4 },
6773#endif
6774#ifdef _SC_OPEN_MAX5
6775 { "_SC_OPEN_MAX", 12, _SC_OPEN_MAX5 },
6776#endif
6777#ifdef _SC_PAGESIZE28
6778 { "_SC_PAGESIZE", 12, _SC_PAGESIZE28 },
6779#endif
6780#ifdef _SC_SAVED_IDS7
6781 { "_SC_SAVED_IDS", 13, _SC_SAVED_IDS7 },
6782#endif
6783#ifdef _SC_STREAM_MAX26
6784 { "_SC_STREAM_MAX", 14, _SC_STREAM_MAX26 },
6785#endif
6786#ifdef _SC_TZNAME_MAX27
6787 { "_SC_TZNAME_MAX", 14, _SC_TZNAME_MAX27 },
6788#endif
6789#ifdef _SC_VERSION8
6790 { "_SC_VERSION", 11, _SC_VERSION8 },
6791#endif
6792#ifdef EAI_AGAIN-3
6793 { "EAI_AGAIN", 9, EAI_AGAIN-3 },
6794#endif
6795#ifdef EAI_BADFLAGS-1
6796 { "EAI_BADFLAGS", 12, EAI_BADFLAGS-1 },
6797#endif
6798#ifdef EAI_FAIL-4
6799 { "EAI_FAIL", 8, EAI_FAIL-4 },
6800#endif
6801#ifdef EAI_FAMILY-6
6802 { "EAI_FAMILY", 10, EAI_FAMILY-6 },
6803#endif
6804#ifdef EAI_MEMORY-10
6805 { "EAI_MEMORY", 10, EAI_MEMORY-10 },
6806#endif
6807#ifdef EAI_NONAME-2
6808 { "EAI_NONAME", 10, EAI_NONAME-2 },
6809#endif
6810#ifdef EAI_SERVICE-8
6811 { "EAI_SERVICE", 11, EAI_SERVICE-8 },
6812#endif
6813#ifdef EAI_SOCKTYPE-7
6814 { "EAI_SOCKTYPE", 12, EAI_SOCKTYPE-7 },
6815#endif
6816#ifdef EAI_SYSTEM-11
6817 { "EAI_SYSTEM", 10, EAI_SYSTEM-11 },
6818#endif
6819#ifdef EAI_OVERFLOW-14
6820 { "EAI_OVERFLOW", 12, EAI_OVERFLOW-14 },
6821#endif
6822#ifdef PRIO_PROCESS0
6823 { "PRIO_PROCESS", 12, PRIO_PROCESS0 },
6824#endif
6825#ifdef PRIO_PGRP1
6826 { "PRIO_PGRP", 9, PRIO_PGRP1 },
6827#endif
6828#ifdef PRIO_USER2
6829 { "PRIO_USER", 9, PRIO_USER2 },
6830#endif
6831#ifdef EXIT_FAILURE1
6832 { "EXIT_FAILURE", 12, EXIT_FAILURE1 },
6833#endif
6834#ifdef EXIT_SUCCESS0
6835 { "EXIT_SUCCESS", 12, EXIT_SUCCESS0 },
6836#endif
6837#ifdef NULL((void*)0)
6838 { "NULL", 4, 0 },
6839#endif
6840#ifdef FE_DOWNWARD0x400
6841 { "FE_DOWNWARD", 11, FE_DOWNWARD0x400 },
6842#endif
6843#ifdef FE_TONEAREST0x000
6844 { "FE_TONEAREST", 12, FE_TONEAREST0x000 },
6845#endif
6846#ifdef FE_TOWARDZERO0xc00
6847 { "FE_TOWARDZERO", 13, FE_TOWARDZERO0xc00 },
6848#endif
6849#ifdef FE_UPWARD0x800
6850 { "FE_UPWARD", 9, FE_UPWARD0x800 },
6851#endif
6852#ifdef _POSIX_ARG_MAX4096
6853 { "_POSIX_ARG_MAX", 14, _POSIX_ARG_MAX4096 },
6854#endif
6855#ifdef _POSIX_CHILD_MAX25
6856 { "_POSIX_CHILD_MAX", 16, _POSIX_CHILD_MAX25 },
6857#endif
6858#ifdef _POSIX_CHOWN_RESTRICTED1
6859 { "_POSIX_CHOWN_RESTRICTED", 23, _POSIX_CHOWN_RESTRICTED1 },
6860#endif
6861#ifdef _POSIX_LINK_MAX8
6862 { "_POSIX_LINK_MAX", 15, _POSIX_LINK_MAX8 },
6863#endif
6864#ifdef _POSIX_MAX_CANON255
6865 { "_POSIX_MAX_CANON", 16, _POSIX_MAX_CANON255 },
6866#endif
6867#ifdef _POSIX_MAX_INPUT255
6868 { "_POSIX_MAX_INPUT", 16, _POSIX_MAX_INPUT255 },
6869#endif
6870#ifdef _POSIX_NAME_MAX14
6871 { "_POSIX_NAME_MAX", 15, _POSIX_NAME_MAX14 },
6872#endif
6873#ifdef _POSIX_NGROUPS_MAX8
6874 { "_POSIX_NGROUPS_MAX", 18, _POSIX_NGROUPS_MAX8 },
6875#endif
6876#ifdef _POSIX_NO_TRUNC1
6877 { "_POSIX_NO_TRUNC", 15, _POSIX_NO_TRUNC1 },
6878#endif
6879#ifdef _POSIX_OPEN_MAX20
6880 { "_POSIX_OPEN_MAX", 15, _POSIX_OPEN_MAX20 },
6881#endif
6882#ifdef _POSIX_PATH_MAX256
6883 { "_POSIX_PATH_MAX", 15, _POSIX_PATH_MAX256 },
6884#endif
6885#ifdef _POSIX_PIPE_BUF512
6886 { "_POSIX_PIPE_BUF", 15, _POSIX_PIPE_BUF512 },
6887#endif
6888#ifdef _POSIX_SSIZE_MAX32767
6889 { "_POSIX_SSIZE_MAX", 16, _POSIX_SSIZE_MAX32767 },
6890#endif
6891#ifdef _POSIX_STREAM_MAX8
6892 { "_POSIX_STREAM_MAX", 17, _POSIX_STREAM_MAX8 },
6893#endif
6894#ifdef _POSIX_TZNAME_MAX6
6895 { "_POSIX_TZNAME_MAX", 17, _POSIX_TZNAME_MAX6 },
6896#endif
6897#ifdef _POSIX_VDISABLE(0377)
6898 { "_POSIX_VDISABLE", 15, _POSIX_VDISABLE(0377) },
6899#endif
6900#ifdef _POSIX_VERSION200809L
6901 { "_POSIX_VERSION", 14, _POSIX_VERSION200809L },
6902#endif
6903#ifdef ILL_ILLOPC1
6904 { "ILL_ILLOPC", 10, ILL_ILLOPC1 },
6905#endif
6906#ifdef ILL_ILLOPN2
6907 { "ILL_ILLOPN", 10, ILL_ILLOPN2 },
6908#endif
6909#ifdef ILL_ILLADR3
6910 { "ILL_ILLADR", 10, ILL_ILLADR3 },
6911#endif
6912#ifdef ILL_ILLTRP4
6913 { "ILL_ILLTRP", 10, ILL_ILLTRP4 },
6914#endif
6915#ifdef ILL_PRVOPC5
6916 { "ILL_PRVOPC", 10, ILL_PRVOPC5 },
6917#endif
6918#ifdef ILL_PRVREG6
6919 { "ILL_PRVREG", 10, ILL_PRVREG6 },
6920#endif
6921#ifdef ILL_COPROC7
6922 { "ILL_COPROC", 10, ILL_COPROC7 },
6923#endif
6924#ifdef ILL_BADSTK8
6925 { "ILL_BADSTK", 10, ILL_BADSTK8 },
6926#endif
6927#ifdef FPE_INTDIV1
6928 { "FPE_INTDIV", 10, FPE_INTDIV1 },
6929#endif
6930#ifdef FPE_INTOVF2
6931 { "FPE_INTOVF", 10, FPE_INTOVF2 },
6932#endif
6933#ifdef FPE_FLTDIV3
6934 { "FPE_FLTDIV", 10, FPE_FLTDIV3 },
6935#endif
6936#ifdef FPE_FLTOVF4
6937 { "FPE_FLTOVF", 10, FPE_FLTOVF4 },
6938#endif
6939#ifdef FPE_FLTUND5
6940 { "FPE_FLTUND", 10, FPE_FLTUND5 },
6941#endif
6942#ifdef FPE_FLTRES6
6943 { "FPE_FLTRES", 10, FPE_FLTRES6 },
6944#endif
6945#ifdef FPE_FLTINV7
6946 { "FPE_FLTINV", 10, FPE_FLTINV7 },
6947#endif
6948#ifdef FPE_FLTSUB8
6949 { "FPE_FLTSUB", 10, FPE_FLTSUB8 },
6950#endif
6951#ifdef SEGV_MAPERR1
6952 { "SEGV_MAPERR", 11, SEGV_MAPERR1 },
6953#endif
6954#ifdef SEGV_ACCERR2
6955 { "SEGV_ACCERR", 11, SEGV_ACCERR2 },
6956#endif
6957#ifdef BUS_ADRALN1
6958 { "BUS_ADRALN", 10, BUS_ADRALN1 },
6959#endif
6960#ifdef BUS_ADRERR2
6961 { "BUS_ADRERR", 10, BUS_ADRERR2 },
6962#endif
6963#ifdef BUS_OBJERR3
6964 { "BUS_OBJERR", 10, BUS_OBJERR3 },
6965#endif
6966#ifdef TRAP_BRKPT1
6967 { "TRAP_BRKPT", 10, TRAP_BRKPT1 },
6968#endif
6969#ifdef TRAP_TRACE2
6970 { "TRAP_TRACE", 10, TRAP_TRACE2 },
6971#endif
6972#ifdef CLD_EXITED1
6973 { "CLD_EXITED", 10, CLD_EXITED1 },
6974#endif
6975#ifdef CLD_KILLED2
6976 { "CLD_KILLED", 10, CLD_KILLED2 },
6977#endif
6978#ifdef CLD_DUMPED3
6979 { "CLD_DUMPED", 10, CLD_DUMPED3 },
6980#endif
6981#ifdef CLD_TRAPPED4
6982 { "CLD_TRAPPED", 11, CLD_TRAPPED4 },
6983#endif
6984#ifdef CLD_STOPPED5
6985 { "CLD_STOPPED", 11, CLD_STOPPED5 },
6986#endif
6987#ifdef CLD_CONTINUED6
6988 { "CLD_CONTINUED", 13, CLD_CONTINUED6 },
6989#endif
6990#ifdef POLL_IN
6991 { "POLL_IN", 7, POLL_IN },
6992#endif
6993#ifdef POLL_OUT
6994 { "POLL_OUT", 8, POLL_OUT },
6995#endif
6996#ifdef POLL_MSG
6997 { "POLL_MSG", 8, POLL_MSG },
6998#endif
6999#ifdef POLL_ERR
7000 { "POLL_ERR", 8, POLL_ERR },
7001#endif
7002#ifdef POLL_PRI
7003 { "POLL_PRI", 8, POLL_PRI },
7004#endif
7005#ifdef POLL_HUP
7006 { "POLL_HUP", 8, POLL_HUP },
7007#endif
7008#ifdef SI_USER0
7009 { "SI_USER", 7, SI_USER0 },
7010#endif
7011#ifdef SI_QUEUE(-2)
7012 { "SI_QUEUE", 8, SI_QUEUE(-2) },
7013#endif
7014#ifdef SI_TIMER(-3)
7015 { "SI_TIMER", 8, SI_TIMER(-3) },
7016#endif
7017#ifdef SI_ASYNCIO
7018 { "SI_ASYNCIO", 10, SI_ASYNCIO },
7019#endif
7020#ifdef SI_MESGQ
7021 { "SI_MESGQ", 8, SI_MESGQ },
7022#endif
7023#if 0
7024 { "SIGRTMAX", 8, SIGRTMAX },
7025#endif
7026#if 0
7027 { "SIGRTMIN", 8, SIGRTMIN },
7028#endif
7029#ifndef EXIT_FAILURE1
7030 /* This is the default value: */
7031 { "EXIT_FAILURE", 12, 1 },
7032#endif
7033#ifndef EXIT_SUCCESS0
7034 /* This is the default value: */
7035 { "EXIT_SUCCESS", 12, 0 },
7036#endif
7037#ifndef _POSIX_JOB_CONTROL1
7038 /* This is the default value: */
7039 { "_POSIX_JOB_CONTROL", 18, 0 },
7040#endif
7041#ifndef _POSIX_SAVED_IDS1
7042 /* This is the default value: */
7043 { "_POSIX_SAVED_IDS", 16, 0 },
7044#endif
7045#ifndef _POSIX_ARG_MAX4096
7046 /* This is the default value: */
7047 { "_POSIX_ARG_MAX", 14, 0 },
7048#endif
7049#ifndef _POSIX_CHILD_MAX25
7050 /* This is the default value: */
7051 { "_POSIX_CHILD_MAX", 16, 0 },
7052#endif
7053#ifndef _POSIX_CHOWN_RESTRICTED1
7054 /* This is the default value: */
7055 { "_POSIX_CHOWN_RESTRICTED", 23, 0 },
7056#endif
7057#ifndef _POSIX_LINK_MAX8
7058 /* This is the default value: */
7059 { "_POSIX_LINK_MAX", 15, 0 },
7060#endif
7061#ifndef _POSIX_MAX_CANON255
7062 /* This is the default value: */
7063 { "_POSIX_MAX_CANON", 16, 0 },
7064#endif
7065#ifndef _POSIX_MAX_INPUT255
7066 /* This is the default value: */
7067 { "_POSIX_MAX_INPUT", 16, 0 },
7068#endif
7069#ifndef _POSIX_NAME_MAX14
7070 /* This is the default value: */
7071 { "_POSIX_NAME_MAX", 15, 0 },
7072#endif
7073#ifndef _POSIX_NGROUPS_MAX8
7074 /* This is the default value: */
7075 { "_POSIX_NGROUPS_MAX", 18, 0 },
7076#endif
7077#ifndef _POSIX_NO_TRUNC1
7078 /* This is the default value: */
7079 { "_POSIX_NO_TRUNC", 15, 0 },
7080#endif
7081#ifndef _POSIX_OPEN_MAX20
7082 /* This is the default value: */
7083 { "_POSIX_OPEN_MAX", 15, 0 },
7084#endif
7085#ifndef _POSIX_PATH_MAX256
7086 /* This is the default value: */
7087 { "_POSIX_PATH_MAX", 15, 0 },
7088#endif
7089#ifndef _POSIX_PIPE_BUF512
7090 /* This is the default value: */
7091 { "_POSIX_PIPE_BUF", 15, 0 },
7092#endif
7093#ifndef _POSIX_SSIZE_MAX32767
7094 /* This is the default value: */
7095 { "_POSIX_SSIZE_MAX", 16, 0 },
7096#endif
7097#ifndef _POSIX_STREAM_MAX8
7098 /* This is the default value: */
7099 { "_POSIX_STREAM_MAX", 17, 0 },
7100#endif
7101#ifndef _POSIX_TZNAME_MAX6
7102 /* This is the default value: */
7103 { "_POSIX_TZNAME_MAX", 17, 0 },
7104#endif
7105#ifndef _POSIX_VDISABLE(0377)
7106 /* This is the default value: */
7107 { "_POSIX_VDISABLE", 15, 0 },
7108#endif
7109#ifndef _POSIX_VERSION200809L
7110 /* This is the default value: */
7111 { "_POSIX_VERSION", 14, 0 },
7112#endif
7113 { NULL((void*)0), 0, 0 } };
7114 const struct iv_s *value_for_iv = values_for_iv;
7115
7116 static const struct nv_s values_for_nv[] =
7117 {
7118#ifdef DBL_DIG15
7119 { "DBL_DIG", 7, DBL_DIG15 },
7120#endif
7121#ifdef DBL_MANT_DIG53
7122 { "DBL_MANT_DIG", 12, DBL_MANT_DIG53 },
7123#endif
7124#ifdef DBL_MAX_10_EXP308
7125 { "DBL_MAX_10_EXP", 14, DBL_MAX_10_EXP308 },
7126#endif
7127#ifdef DBL_MAX_EXP1024
7128 { "DBL_MAX_EXP", 11, DBL_MAX_EXP1024 },
7129#endif
7130#ifdef DBL_MIN_10_EXP(-307)
7131 { "DBL_MIN_10_EXP", 14, DBL_MIN_10_EXP(-307) },
7132#endif
7133#ifdef DBL_MIN_EXP(-1021)
7134 { "DBL_MIN_EXP", 11, DBL_MIN_EXP(-1021) },
7135#endif
7136#ifdef FLT_DIG6
7137 { "FLT_DIG", 7, FLT_DIG6 },
7138#endif
7139#ifdef FLT_MANT_DIG24
7140 { "FLT_MANT_DIG", 12, FLT_MANT_DIG24 },
7141#endif
7142#ifdef FLT_MAX_10_EXP38
7143 { "FLT_MAX_10_EXP", 14, FLT_MAX_10_EXP38 },
7144#endif
7145#ifdef FLT_MAX_EXP128
7146 { "FLT_MAX_EXP", 11, FLT_MAX_EXP128 },
7147#endif
7148#ifdef FLT_MIN_10_EXP(-37)
7149 { "FLT_MIN_10_EXP", 14, FLT_MIN_10_EXP(-37) },
7150#endif
7151#ifdef FLT_MIN_EXP(-125)
7152 { "FLT_MIN_EXP", 11, FLT_MIN_EXP(-125) },
7153#endif
7154#ifdef FLT_RADIX2
7155 { "FLT_RADIX", 9, FLT_RADIX2 },
7156#endif
7157#ifdef LDBL_DIG18
7158 { "LDBL_DIG", 8, LDBL_DIG18 },
7159#endif
7160#ifdef LDBL_MANT_DIG64
7161 { "LDBL_MANT_DIG", 13, LDBL_MANT_DIG64 },
7162#endif
7163#ifdef LDBL_MAX_10_EXP4932
7164 { "LDBL_MAX_10_EXP", 15, LDBL_MAX_10_EXP4932 },
7165#endif
7166#ifdef LDBL_MAX_EXP16384
7167 { "LDBL_MAX_EXP", 12, LDBL_MAX_EXP16384 },
7168#endif
7169#ifdef LDBL_MIN_10_EXP(-4931)
7170 { "LDBL_MIN_10_EXP", 15, LDBL_MIN_10_EXP(-4931) },
7171#endif
7172#ifdef LDBL_MIN_EXP(-16381)
7173 { "LDBL_MIN_EXP", 12, LDBL_MIN_EXP(-16381) },
7174#endif
7175#ifdef FP_ILOGB0(-2147483647)
7176 { "FP_ILOGB0", 9, FP_ILOGB0(-2147483647) },
7177#endif
7178#ifdef FP_ILOGBNAN2147483647
7179 { "FP_ILOGBNAN", 11, FP_ILOGBNAN2147483647 },
7180#endif
7181#ifdef FP_INFINITE0x01
7182 { "FP_INFINITE", 11, FP_INFINITE0x01 },
7183#endif
7184#ifdef FP_NAN0x02
7185 { "FP_NAN", 6, FP_NAN0x02 },
7186#endif
7187#ifdef FP_NORMAL0x04
7188 { "FP_NORMAL", 9, FP_NORMAL0x04 },
7189#endif
7190#ifdef FP_SUBNORMAL0x08
7191 { "FP_SUBNORMAL", 12, FP_SUBNORMAL0x08 },
7192#endif
7193#ifdef FP_ZERO0x10
7194 { "FP_ZERO", 7, FP_ZERO0x10 },
7195#endif
7196#ifdef M_1_PI((double)0.31830988618379067154)
7197 { "M_1_PI", 6, M_1_PI((double)0.31830988618379067154) },
7198#endif
7199#ifdef M_2_PI((double)0.63661977236758134308)
7200 { "M_2_PI", 6, M_2_PI((double)0.63661977236758134308) },
7201#endif
7202#ifdef M_2_SQRTPI((double)1.12837916709551257390)
7203 { "M_2_SQRTPI", 10, M_2_SQRTPI((double)1.12837916709551257390) },
7204#endif
7205#ifdef M_E((double)2.7182818284590452354)
7206 { "M_E", 3, M_E((double)2.7182818284590452354) },
7207#endif
7208#ifdef M_LN10((double)2.30258509299404568402)
7209 { "M_LN10", 6, M_LN10((double)2.30258509299404568402) },
7210#endif
7211#ifdef M_LN2((double)0.69314718055994530942)
7212 { "M_LN2", 5, M_LN2((double)0.69314718055994530942) },
7213#endif
7214#ifdef M_LOG10E((double)0.43429448190325182765)
7215 { "M_LOG10E", 8, M_LOG10E((double)0.43429448190325182765) },
7216#endif
7217#ifdef M_LOG2E((double)1.4426950408889634074)
7218 { "M_LOG2E", 7, M_LOG2E((double)1.4426950408889634074) },
7219#endif
7220#ifdef M_PI((double)3.14159265358979323846)
7221 { "M_PI", 4, M_PI((double)3.14159265358979323846) },
7222#endif
7223#ifdef M_PI_2((double)1.57079632679489661923)
7224 { "M_PI_2", 6, M_PI_2((double)1.57079632679489661923) },
7225#endif
7226#ifdef M_PI_4((double)0.78539816339744830962)
7227 { "M_PI_4", 6, M_PI_4((double)0.78539816339744830962) },
7228#endif
7229#ifdef M_SQRT1_2((double)0.70710678118654752440)
7230 { "M_SQRT1_2", 9, M_SQRT1_2((double)0.70710678118654752440) },
7231#endif
7232#ifdef M_SQRT2((double)1.41421356237309504880)
7233 { "M_SQRT2", 7, M_SQRT2((double)1.41421356237309504880) },
7234#endif
7235 { NULL((void*)0), 0, 0 } };
7236 const struct nv_s *value_for_nv = values_for_nv;
7237
7238 static const struct uv_s values_for_uv[] =
7239 {
7240#ifdef SA_NOCLDSTOP0x0008
7241 { "SA_NOCLDSTOP", 12, SA_NOCLDSTOP0x0008 },
7242#endif
7243#ifdef SA_NOCLDWAIT0x0020
7244 { "SA_NOCLDWAIT", 12, SA_NOCLDWAIT0x0020 },
7245#endif
7246#ifdef SA_NODEFER0x0010
7247 { "SA_NODEFER", 10, SA_NODEFER0x0010 },
7248#endif
7249#ifdef SA_ONSTACK0x0001
7250 { "SA_ONSTACK", 10, SA_ONSTACK0x0001 },
7251#endif
7252#ifdef SA_RESETHAND0x0004
7253 { "SA_RESETHAND", 12, SA_RESETHAND0x0004 },
7254#endif
7255#ifdef SA_RESTART0x0002
7256 { "SA_RESTART", 10, SA_RESTART0x0002 },
7257#endif
7258#ifdef SA_SIGINFO0x0040
7259 { "SA_SIGINFO", 10, SA_SIGINFO0x0040 },
7260#endif
7261#ifdef UCHAR_MAX(127*2 +1)
7262 { "UCHAR_MAX", 9, UCHAR_MAX(127*2 +1) },
7263#endif
7264#ifdef UINT_MAX(2147483647 *2U +1U)
7265 { "UINT_MAX", 8, UINT_MAX(2147483647 *2U +1U) },
7266#endif
7267#ifdef ULONG_MAX(9223372036854775807L *2UL+1UL)
7268 { "ULONG_MAX", 9, ULONG_MAX(9223372036854775807L *2UL+1UL) },
7269#endif
7270#ifdef USHRT_MAX(32767 *2 +1)
7271 { "USHRT_MAX", 9, USHRT_MAX(32767 *2 +1) },
7272#endif
7273 { NULL((void*)0), 0, 0 } };
7274 const struct uv_s *value_for_uv = values_for_uv;
7275
7276 static const struct yes_s values_for_yes[] =
7277 {
7278#ifdef _POSIX_JOB_CONTROL1
7279 { "_POSIX_JOB_CONTROL", 18 },
7280#endif
7281#ifdef _POSIX_SAVED_IDS1
7282 { "_POSIX_SAVED_IDS", 16 },
7283#endif
7284 { NULL((void*)0), 0 } };
7285 const struct yes_s *value_for_yes = values_for_yes;
7286 while (value_for_iv->name) {
7287 constant_add_symbol(aTHX_ symbol_table, value_for_iv->name,
7288 value_for_iv->namelen, newSViv(value_for_iv->value)Perl_newSViv( value_for_iv->value));
7289 ++value_for_iv;
7290 }
7291 while (value_for_nv->name) {
7292 constant_add_symbol(aTHX_ symbol_table, value_for_nv->name,
7293 value_for_nv->namelen, newSVnv(value_for_nv->value)Perl_newSVnv( value_for_nv->value));
7294 ++value_for_nv;
7295 }
7296 while (value_for_uv->name) {
7297 constant_add_symbol(aTHX_ symbol_table, value_for_uv->name,
7298 value_for_uv->namelen, newSVuv(value_for_uv->value)Perl_newSVuv( value_for_uv->value));
7299 ++value_for_uv;
7300 }
7301 while (value_for_yes->name) {
7302 constant_add_symbol(aTHX_ symbol_table, value_for_yes->name,
7303 value_for_yes->namelen, &PL_sv_yes(PL_sv_immortals[0]));
7304 ++value_for_yes;
7305 }
7306 if (C_ARRAY_LENGTH(values_for_notfound)(sizeof(values_for_notfound)/sizeof((values_for_notfound)[0])
)
> 1) {
7307#ifndef SYMBIAN
7308 HV *const constant_missing = get_missing_hash(aTHX);
7309#endif
7310 const struct notfound_s *value_for_notfound = values_for_notfound;
7311 do {
7312
7313 /* Need to add prototypes, else parsing will vary by platform. */
7314 HE *he = (HE*) hv_common_key_len(symbol_table,Perl_hv_common_key_len( symbol_table,value_for_notfound->name
,value_for_notfound->namelen,0x10,((void*)0),0)
7315 value_for_notfound->name,Perl_hv_common_key_len( symbol_table,value_for_notfound->name
,value_for_notfound->namelen,0x10,((void*)0),0)
7316 value_for_notfound->namelen,Perl_hv_common_key_len( symbol_table,value_for_notfound->name
,value_for_notfound->namelen,0x10,((void*)0),0)
7317 HV_FETCH_LVALUE, NULL, 0)Perl_hv_common_key_len( symbol_table,value_for_notfound->name
,value_for_notfound->namelen,0x10,((void*)0),0)
;
7318 SV *sv;
7319#ifndef SYMBIAN
7320 HEK *hek;
7321#endif
7322 if (!he) {
7323 croakPerl_croak("Couldn't add key '%s' to %%POSIX::",
7324 value_for_notfound->name);
7325 }
7326 sv = HeVAL(he)(he)->he_valu.hent_val;
7327 if (!SvOK(sv)((sv)->sv_flags & (0x00000100|0x00000200|0x00000400|0x00000800
| 0x00001000|0x00002000|0x00004000|0x00008000))
&& SvTYPE(sv)((svtype)((sv)->sv_flags & 0xff)) != SVt_PVGV) {
7328 /* Nothing was here before, so mark a prototype of "" */
7329 sv_setpvn(sv, "", 0)Perl_sv_setpvn( sv,"",0);
7330 } else if (SvPOK(sv)((sv)->sv_flags & 0x00000400) && SvCUR(sv)((XPV*) (sv)->sv_any)->xpv_cur == 0) {
7331 /* There is already a prototype of "" - do nothing */
7332 } else {
7333 /* Someone has been here before us - have to make a real
7334 typeglob. */
7335 /* It turns out to be incredibly hard to deal with all the
7336 corner cases of sub foo (); and reporting errors correctly,
7337 so lets cheat a bit. Start with a constant subroutine */
7338 CV *cv = newCONSTSUB(symbol_table,Perl_newCONSTSUB( symbol_table,value_for_notfound->name,&
(PL_sv_immortals[0]))
7339 value_for_notfound->name,Perl_newCONSTSUB( symbol_table,value_for_notfound->name,&
(PL_sv_immortals[0]))
7340 &PL_sv_yes)Perl_newCONSTSUB( symbol_table,value_for_notfound->name,&
(PL_sv_immortals[0]))
;
7341 /* and then turn it into a non constant declaration only. */
7342 SvREFCNT_dec(CvXSUBANY(cv).any_ptr)Perl_SvREFCNT_dec( ((SV *)({ void *_p = (((XPVCV*)({ void *_p
= ((cv)->sv_any); _p; }))->xcv_start_u.xcv_xsubany.any_ptr
); _p; })))
;
7343 CvCONST_off(cv)(((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_flags
&= ~0x0004)
;
7344 CvXSUB(cv)((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_root_u
.xcv_xsub
= NULL((void*)0);
7345 CvXSUBANY(cv)((XPVCV*)({ void *_p = ((cv)->sv_any); _p; }))->xcv_start_u
.xcv_xsubany
.any_ptr = NULL((void*)0);
7346 }
7347#ifndef SYMBIAN
7348 hek = HeKEY_hek(he)(he)->hent_hek;
7349 if (!hv_common(constant_missing, NULL, HEK_KEY(hek),Perl_hv_common( constant_missing,((void*)0),(hek)->hek_key
,(hek)->hek_len,(*((unsigned char *)((hek)->hek_key)+(hek
)->hek_len+1)),0x04,&(PL_sv_immortals[0]),(hek)->hek_hash
)
7350 HEK_LEN(hek), HEK_FLAGS(hek), HV_FETCH_ISSTORE,Perl_hv_common( constant_missing,((void*)0),(hek)->hek_key
,(hek)->hek_len,(*((unsigned char *)((hek)->hek_key)+(hek
)->hek_len+1)),0x04,&(PL_sv_immortals[0]),(hek)->hek_hash
)
7351 &PL_sv_yes, HEK_HASH(hek))Perl_hv_common( constant_missing,((void*)0),(hek)->hek_key
,(hek)->hek_len,(*((unsigned char *)((hek)->hek_key)+(hek
)->hek_len+1)),0x04,&(PL_sv_immortals[0]),(hek)->hek_hash
)
)
7352 croakPerl_croak("Couldn't add key '%s' to missing_hash",
7353 value_for_notfound->name);
7354#endif
7355 } while ((++value_for_notfound)->name);
7356 }
7357#ifdef CLK_TCK100
7358 {
7359 IV temp0;
7360 temp0 = CLK_TCK100;
7361 constant_add_symbol(aTHX_ symbol_table, "CLK_TCK",
7362 7, newSViv(temp0)Perl_newSViv( temp0));
7363 }
7364#endif
7365#ifdef MB_CUR_MAX__mb_cur_max()
7366 {
7367 IV temp0;
7368 temp0 = MB_CUR_MAX__mb_cur_max();
7369 constant_add_symbol(aTHX_ symbol_table, "MB_CUR_MAX",
7370 10, newSViv(temp0)Perl_newSViv( temp0));
7371 }
7372#endif
7373#ifdef SIG_DFL(void (*)(int))0
7374 {
7375 IV temp0;
7376 temp0 = PTR2IV(SIG_DFL)(IV)((void (*)(int))0);
7377 constant_add_symbol(aTHX_ symbol_table, "SIG_DFL",
7378 7, newSViv(temp0)Perl_newSViv( temp0));
7379 }
7380#endif
7381#ifdef SIG_ERR(void (*)(int))-1
7382 {
7383 IV temp0;
7384 temp0 = PTR2IV(SIG_ERR)(IV)((void (*)(int))-1);
7385 constant_add_symbol(aTHX_ symbol_table, "SIG_ERR",
7386 7, newSViv(temp0)Perl_newSViv( temp0));
7387 }
7388#endif
7389#ifdef SIG_IGN(void (*)(int))1
7390 {
7391 IV temp0;
7392 temp0 = PTR2IV(SIG_IGN)(IV)((void (*)(int))1);
7393 constant_add_symbol(aTHX_ symbol_table, "SIG_IGN",
7394 7, newSViv(temp0)Perl_newSViv( temp0));
7395 }
7396#endif
7397#ifdef FLT_ROUNDS(__builtin_flt_rounds())
7398 {
7399 NV temp0;
7400 temp0 = FLT_ROUNDS(__builtin_flt_rounds());
7401 constant_add_symbol(aTHX_ symbol_table, "FLT_ROUNDS",
7402 10, newSVnv(temp0)Perl_newSVnv( temp0));
7403 }
7404#endif
7405#if (defined(USE_LONG_DOUBLE) && defined(HUGE_VALL__builtin_huge_vall())) || defined(HUGE_VAL__builtin_huge_val())
7406 /* HUGE_VALL is admittedly non-POSIX but if we are using long doubles
7407 * we might as well use long doubles. --jhi */
7408 {
7409 NV temp0;
7410 temp0 =
7411#if defined(USE_LONG_DOUBLE) && defined(HUGE_VALL__builtin_huge_vall())
7412 HUGE_VALL__builtin_huge_vall()
7413#else
7414 HUGE_VAL__builtin_huge_val()
7415#endif
7416 ;
7417 constant_add_symbol(aTHX_ symbol_table, "HUGE_VAL",
7418 8, newSVnv(temp0)Perl_newSVnv( temp0));
7419 }
7420#endif
7421#ifdef INFINITY__builtin_inff()
7422 {
7423 NV temp0;
7424 temp0 = NV_INFPL_inf.nv;
7425 constant_add_symbol(aTHX_ symbol_table, "INFINITY",
7426 8, newSVnv(temp0)Perl_newSVnv( temp0));
7427 }
7428#endif
7429#ifdef InfPL_inf.nv
7430 {
7431 NV temp0;
7432 temp0 = NV_INFPL_inf.nv;
7433 constant_add_symbol(aTHX_ symbol_table, "Inf",
7434 3, newSVnv(temp0)Perl_newSVnv( temp0));
7435 }
7436#endif
7437#ifdef NAN__builtin_nanf("")
7438 {
7439 NV temp0;
7440 temp0 = NV_NANPL_nan.nv;
7441 constant_add_symbol(aTHX_ symbol_table, "NAN",
7442 3, newSVnv(temp0)Perl_newSVnv( temp0));
7443 }
7444#endif
7445#ifdef NaNPL_nan.nv
7446 {
7447 NV temp0;
7448 temp0 = NV_NANPL_nan.nv;
7449 constant_add_symbol(aTHX_ symbol_table, "NaN",
7450 3, newSVnv(temp0)Perl_newSVnv( temp0));
7451 }
7452#endif
7453#ifdef DBL_MAX1.7976931348623157e+308
7454 {
7455 NV temp0;
7456 temp0 = DBL_MAX1.7976931348623157e+308;
7457 constant_add_symbol(aTHX_ symbol_table, "DBL_MAX",
7458 7, newSVnv(temp0)Perl_newSVnv( temp0));
7459 }
7460#endif
7461#ifdef FLT_MAX3.40282347e+38F
7462 {
7463 NV temp0;
7464 temp0 = FLT_MAX3.40282347e+38F;
7465 constant_add_symbol(aTHX_ symbol_table, "FLT_MAX",
7466 7, newSVnv(temp0)Perl_newSVnv( temp0));
7467 }
7468#endif
7469#ifdef LDBL_MAX
7470 {
7471 NV temp0;
7472 temp0 = LDBL_MAX;
7473 constant_add_symbol(aTHX_ symbol_table, "LDBL_MAX",
7474 8, newSVnv(temp0)Perl_newSVnv( temp0));
7475 }
7476#endif
7477#ifdef LDBL_MIN
7478 {
7479 NV temp0;
7480 temp0 = LDBL_MIN;
7481 constant_add_symbol(aTHX_ symbol_table, "LDBL_MIN",
7482 8, newSVnv(temp0)Perl_newSVnv( temp0));
7483 }
7484#endif
7485#ifdef LDBL_EPSILON
7486 {
7487 NV temp0;
7488 temp0 = LDBL_EPSILON;
7489 constant_add_symbol(aTHX_ symbol_table, "LDBL_EPSILON",
7490 12, newSVnv(temp0)Perl_newSVnv( temp0));
7491 }
7492#endif
7493#ifdef DBL_EPSILON2.2204460492503131e-16
7494 {
7495 NV temp0;
7496 temp0 = DBL_EPSILON2.2204460492503131e-16;
7497 constant_add_symbol(aTHX_ symbol_table, "DBL_EPSILON",
7498 11, newSVnv(temp0)Perl_newSVnv( temp0));
7499 }
7500#endif
7501#ifdef DBL_MIN2.2250738585072014e-308
7502 {
7503 NV temp0;
7504 temp0 = DBL_MIN2.2250738585072014e-308;
7505 constant_add_symbol(aTHX_ symbol_table, "DBL_MIN",
7506 7, newSVnv(temp0)Perl_newSVnv( temp0));
7507 }
7508#endif
7509#ifdef FLT_EPSILON1.19209290e-7F
7510 {
7511 NV temp0;
7512 temp0 = FLT_EPSILON1.19209290e-7F;
7513 constant_add_symbol(aTHX_ symbol_table, "FLT_EPSILON",
7514 11, newSVnv(temp0)Perl_newSVnv( temp0));
7515 }
7516#endif
7517#ifdef FLT_MIN1.17549435e-38F
7518 {
7519 NV temp0;
7520 temp0 = FLT_MIN1.17549435e-38F;
7521 constant_add_symbol(aTHX_ symbol_table, "FLT_MIN",
7522 7, newSVnv(temp0)Perl_newSVnv( temp0));
7523 }
7524#endif
7525 /* As we've been creating subroutines, we better invalidate any cached
7526 methods */
7527 mro_method_changed_in(symbol_table)Perl_mro_method_changed_in( symbol_table);
7528 }
7529
7530#if XSubPPtmpAAAA1
7531#endif
7532#line 7533 "POSIX.c"
7533
7534 /* End of Initialisation Section */
7535
7536#if PERL_VERSION_LE(5, 21, 5)((5*1000000 + 32*1000 + 1) <= (5*1000000 + 21*1000 + 5))
7537# if PERL_VERSION_GE(5, 9, 0)((5*1000000 + 32*1000 + 1) >= (5*1000000 + 9*1000 + 0))
7538 if (PL_unitcheckav)
7539 call_list(PL_scopestack_ix, PL_unitcheckav)Perl_call_list( PL_scopestack_ix,PL_unitcheckav);
7540# endif
7541 XSRETURN_YESdo { (PL_stack_base[ax + (0)] = &(PL_sv_immortals[0]) ); do
{ const IV tmpXSoff = (1); ((void)0); PL_stack_sp = PL_stack_base
+ ax + (tmpXSoff - 1); return; } while (0); } while (0)
;
7542#else
7543 Perl_xs_boot_epilog(aTHX_ ax);
7544#endif
7545}
7546

../../inline.h

1/* inline.h
2 *
3 * Copyright (C) 2012 by Larry Wall and others
4 *
5 * You may distribute under the terms of either the GNU General Public
6 * License or the Artistic License, as specified in the README file.
7 *
8 * This file contains tables and code adapted from
9 * https://bjoern.hoehrmann.de/utf-8/decoder/dfa/, which requires this
10 * copyright notice:
11
12Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de>
13
14Permission is hereby granted, free of charge, to any person obtaining a copy of
15this software and associated documentation files (the "Software"), to deal in
16the Software without restriction, including without limitation the rights to
17use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
18of the Software, and to permit persons to whom the Software is furnished to do
19so, subject to the following conditions:
20
21The above copyright notice and this permission notice shall be included in all
22copies or substantial portions of the Software.
23
24THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30SOFTWARE.
31
32 *
33 * This file is a home for static inline functions that cannot go in other
34 * header files, because they depend on proto.h (included after most other
35 * headers) or struct definitions.
36 *
37 * Each section names the header file that the functions "belong" to.
38 */
39
40/* ------------------------------- av.h ------------------------------- */
41
42PERL_STATIC_INLINEstatic __inline__ SSize_tssize_t
43Perl_av_top_index(pTHX_ AV *av)
44{
45 PERL_ARGS_ASSERT_AV_TOP_INDEX((void)0);
46 assert(SvTYPE(av) == SVt_PVAV)((void)0);
47
48 return AvFILL(av)(((((const SV *) (av))->sv_flags & 0x00800000)) ? Perl_mg_size
( ((SV *)({ void *_p = (av); _p; }))) : ((XPVAV*) (av)->sv_any
)->xav_fill)
;
49}
50
51/* ------------------------------- cv.h ------------------------------- */
52
53PERL_STATIC_INLINEstatic __inline__ GV *
54Perl_CvGV(pTHX_ CV *sv)
55{
56 PERL_ARGS_ASSERT_CVGV((void)0);
57
58 return CvNAMED(sv)(((XPVCV*)({ void *_p = ((sv)->sv_any); _p; }))->xcv_flags
& 0x8000)
59 ? Perl_cvgv_from_hek(aTHX_ sv)
60 : ((XPVCV*)MUTABLE_PTR(SvANY(sv))({ void *_p = ((sv)->sv_any); _p; }))->xcv_gv_u.xcv_gv;
61}
62
63PERL_STATIC_INLINEstatic __inline__ I32 *
64Perl_CvDEPTH(const CV * const sv)
65{
66 PERL_ARGS_ASSERT_CVDEPTH((void)0);
67 assert(SvTYPE(sv) == SVt_PVCV || SvTYPE(sv) == SVt_PVFM)((void)0);
68
69 return &((XPVCV*)SvANY(sv)(sv)->sv_any)->xcv_depth;
70}
71
72/*
73 CvPROTO returns the prototype as stored, which is not necessarily what
74 the interpreter should be using. Specifically, the interpreter assumes
75 that spaces have been stripped, which has been the case if the prototype
76 was added by toke.c, but is generally not the case if it was added elsewhere.
77 Since we can't enforce the spacelessness at assignment time, this routine
78 provides a temporary copy at parse time with spaces removed.
79 I<orig> is the start of the original buffer, I<len> is the length of the
80 prototype and will be updated when this returns.
81 */
82
83#ifdef PERL_CORE
84PERL_STATIC_INLINEstatic __inline__ char *
85S_strip_spaces(pTHX_ const char * orig, STRLEN * const len)
86{
87 SV * tmpsv;
88 char * tmps;
89 tmpsv = newSVpvn_flags(orig, *len, SVs_TEMP)Perl_newSVpvn_flags( orig,*len,0x00080000);
90 tmps = SvPVX(tmpsv)((tmpsv)->sv_u.svu_pv);
91 while ((*len)--) {
92 if (!isSPACE(*orig)(( (sizeof(*orig) == 1) || !(((U64)((*orig) | 0)) & ~0xFF
)) && ((PL_charclass[(U8) (*orig)] & ((1U <<
(10)) | (1U << (14)))) == ((1U << (10)) | (1U <<
(14)))))
)
93 *tmps++ = *orig;
94 orig++;
95 }
96 *tmps = '\0';
97 *len = tmps - SvPVX(tmpsv)((tmpsv)->sv_u.svu_pv);
98 return SvPVX(tmpsv)((tmpsv)->sv_u.svu_pv);
99}
100#endif
101
102/* ------------------------------- mg.h ------------------------------- */
103
104#if defined(PERL_CORE) || defined(PERL_EXT)
105/* assumes get-magic and stringification have already occurred */
106PERL_STATIC_INLINEstatic __inline__ STRLEN
107S_MgBYTEPOS(pTHX_ MAGIC *mg, SV *sv, const char *s, STRLEN len)
108{
109 assert(mg->mg_type == PERL_MAGIC_regex_global)((void)0);
110 assert(mg->mg_len != -1)((void)0);
111 if (mg->mg_flags & MGf_BYTES0x40 || !DO_UTF8(sv)(((sv)->sv_flags & 0x20000000) && !__builtin_expect
(((((PL_curcop)->cop_hints + 0) & 0x00000008) ? (_Bool
)1 : (_Bool)0),(0)))
)
112 return (STRLEN)mg->mg_len;
113 else {
114 const STRLEN pos = (STRLEN)mg->mg_len;
115 /* Without this check, we may read past the end of the buffer: */
116 if (pos > sv_or_pv_len_utf8(sv, s, len)((((sv)->sv_flags & 0x00200000) || (((sv)->sv_flags
& 0x00000800) && ((((sv)->sv_u.svu_rv))->sv_flags
& 0x00100000) && ((((XPVMG*) (((sv)->sv_u.svu_rv
))->sv_any)->xmg_stash)->sv_flags & 0x10000000))
) ? Perl_utf8_length( (U8 *)(s),(U8 *)(s)+(len)) : Perl_sv_len_utf8
( sv))
) return len+1;
117 return sv_or_pv_pos_u2b(sv, s, pos, NULL)S_sv_or_pv_pos_u2b( sv,s,pos,((void*)0));
118 }
119}
120#endif
121
122/* ------------------------------- pad.h ------------------------------ */
123
124#if defined(PERL_IN_PAD_C) || defined(PERL_IN_OP_C)
125PERL_STATIC_INLINEstatic __inline__ bool_Bool
126S_PadnameIN_SCOPE(const PADNAME * const pn, const U32 seq)
127{
128 PERL_ARGS_ASSERT_PADNAMEIN_SCOPE;
129
130 /* is seq within the range _LOW to _HIGH ?
131 * This is complicated by the fact that PL_cop_seqmax
132 * may have wrapped around at some point */
133 if (COP_SEQ_RANGE_LOW(pn)(pn)->xpadn_low == PERL_PADSEQ_INTRO0xffffffffU)
134 return FALSE(0); /* not yet introduced */
135
136 if (COP_SEQ_RANGE_HIGH(pn)(pn)->xpadn_high == PERL_PADSEQ_INTRO0xffffffffU) {
137 /* in compiling scope */
138 if (
139 (seq > COP_SEQ_RANGE_LOW(pn)(pn)->xpadn_low)
140 ? (seq - COP_SEQ_RANGE_LOW(pn)(pn)->xpadn_low < (U32_MAX0xffffffffU >> 1))
141 : (COP_SEQ_RANGE_LOW(pn)(pn)->xpadn_low - seq > (U32_MAX0xffffffffU >> 1))
142 )
143 return TRUE(1);
144 }
145 else if (
146 (COP_SEQ_RANGE_LOW(pn)(pn)->xpadn_low > COP_SEQ_RANGE_HIGH(pn)(pn)->xpadn_high)
147 ?
148 ( seq > COP_SEQ_RANGE_LOW(pn)(pn)->xpadn_low
149 || seq <= COP_SEQ_RANGE_HIGH(pn)(pn)->xpadn_high)
150
151 : ( seq > COP_SEQ_RANGE_LOW(pn)(pn)->xpadn_low
152 && seq <= COP_SEQ_RANGE_HIGH(pn)(pn)->xpadn_high)
153 )
154 return TRUE(1);
155 return FALSE(0);
156}
157#endif
158
159/* ------------------------------- pp.h ------------------------------- */
160
161PERL_STATIC_INLINEstatic __inline__ I32
162Perl_TOPMARK(pTHXvoid)
163{
164 DEBUG_s(DEBUG_v(PerlIO_printf(Perl_debug_log,
165 "MARK top %p %" IVdf "\n",
166 PL_markstack_ptr,
167 (IV)*PL_markstack_ptr)));
168 return *PL_markstack_ptr;
169}
170
171PERL_STATIC_INLINEstatic __inline__ I32
172Perl_POPMARK(pTHXvoid)
173{
174 DEBUG_s(DEBUG_v(PerlIO_printf(Perl_debug_log,
175 "MARK pop %p %" IVdf "\n",
176 (PL_markstack_ptr-1),
177 (IV)*(PL_markstack_ptr-1))));
178 assert((PL_markstack_ptr > PL_markstack) || !"MARK underflow")((void)0);
179 return *PL_markstack_ptr--;
180}
181
182/* ----------------------------- regexp.h ----------------------------- */
183
184PERL_STATIC_INLINEstatic __inline__ struct regexp *
185Perl_ReANY(const REGEXP * const re)
186{
187 XPV* const p = (XPV*)SvANY(re)(re)->sv_any;
188
189 PERL_ARGS_ASSERT_REANY((void)0);
190 assert(isREGEXP(re))((void)0);
191
192 return SvTYPE(re)((svtype)((re)->sv_flags & 0xff)) == SVt_PVLV ? p->xpv_len_u.xpvlenu_rx
193 : (struct regexp *)p;
194}
195
196/* ------------------------------- sv.h ------------------------------- */
197
198PERL_STATIC_INLINEstatic __inline__ bool_Bool
199Perl_SvTRUE(pTHX_ SV *sv) {
200 if (!LIKELY(sv)__builtin_expect(((sv) ? (_Bool)1 : (_Bool)0),(1)))
23
Assuming 'sv' is non-null
24
'?' condition is true
25
Taking false branch
43
Assuming 'sv' is null
44
'?' condition is false
45
Taking true branch
201 return FALSE(0);
202 SvGETMAGIC(sv)((void)(__builtin_expect(((((sv)->sv_flags & 0x00200000
)) ? (_Bool)1 : (_Bool)0),(0)) && Perl_mg_get( sv)))
;
26
Assuming the condition is false
27
'?' condition is false
203 return SvTRUE_nomg_NN(sv)(( ((size_t)((sv) - &(PL_sv_immortals[0])) < 4) ? ((sv
) == &(PL_sv_immortals[0])) : !((sv)->sv_flags & (
0x00000100|0x00000200|0x00000400|0x00000800| 0x00001000|0x00002000
|0x00004000|0x00008000)) ? 0 : ((sv)->sv_flags & 0x00000400
) ? ( ((XPV*)((sv))->sv_any) && ( ((XPV*)((sv))->
sv_any)->xpv_cur > 1 || ( ((XPV*)((sv))->sv_any)->
xpv_cur && *(sv)->sv_u.svu_pv != '0' ) ) ) : ((sv)
->sv_flags & 0x00000100) ? (((XPVIV*) (sv)->sv_any)
->xiv_u.xivu_iv != 0 ) : (((sv)->sv_flags & 0x00000800
) && !( ((((sv)->sv_u.svu_rv))->sv_flags & 0x00100000
) && ((((XPVMG*) (((sv)->sv_u.svu_rv))->sv_any)
->xmg_stash)->sv_flags & 0x10000000))) ? (1) : (Perl_sv_2bool_flags
( sv,0))))
;
28
Assuming the condition is true
29
'?' condition is true
30
Returning without writing to 'sv->sv_u.svu_rv', which participates in a condition later
204}
205
206PERL_STATIC_INLINEstatic __inline__ SV *
207Perl_SvREFCNT_inc(SV *sv)
208{
209 if (LIKELY(sv != NULL)__builtin_expect(((sv != ((void*)0)) ? (_Bool)1 : (_Bool)0),(
1))
)
210 SvREFCNT(sv)(sv)->sv_refcnt++;
211 return sv;
212}
213PERL_STATIC_INLINEstatic __inline__ SV *
214Perl_SvREFCNT_inc_NN(SV *sv)
215{
216 PERL_ARGS_ASSERT_SVREFCNT_INC_NN((void)0);
217
218 SvREFCNT(sv)(sv)->sv_refcnt++;
219 return sv;
220}
221PERL_STATIC_INLINEstatic __inline__ void
222Perl_SvREFCNT_inc_void(SV *sv)
223{
224 if (LIKELY(sv != NULL)__builtin_expect(((sv != ((void*)0)) ? (_Bool)1 : (_Bool)0),(
1))
)
225 SvREFCNT(sv)(sv)->sv_refcnt++;
226}
227PERL_STATIC_INLINEstatic __inline__ void
228Perl_SvREFCNT_dec(pTHX_ SV *sv)
229{
230 if (LIKELY(sv != NULL)__builtin_expect(((sv != ((void*)0)) ? (_Bool)1 : (_Bool)0),(
1))
) {
231 U32 rc = SvREFCNT(sv)(sv)->sv_refcnt;
232 if (LIKELY(rc > 1)__builtin_expect(((rc > 1) ? (_Bool)1 : (_Bool)0),(1)))
233 SvREFCNT(sv)(sv)->sv_refcnt = rc - 1;
234 else
235 Perl_sv_free2(aTHX_ sv, rc);
236 }
237}
238
239PERL_STATIC_INLINEstatic __inline__ void
240Perl_SvREFCNT_dec_NN(pTHX_ SV *sv)
241{
242 U32 rc = SvREFCNT(sv)(sv)->sv_refcnt;
243
244 PERL_ARGS_ASSERT_SVREFCNT_DEC_NN((void)0);
245
246 if (LIKELY(rc > 1)__builtin_expect(((rc > 1) ? (_Bool)1 : (_Bool)0),(1)))
247 SvREFCNT(sv)(sv)->sv_refcnt = rc - 1;
248 else
249 Perl_sv_free2(aTHX_ sv, rc);
250}
251
252PERL_STATIC_INLINEstatic __inline__ void
253Perl_SvAMAGIC_on(SV *sv)
254{
255 PERL_ARGS_ASSERT_SVAMAGIC_ON((void)0);
256 assert(SvROK(sv))((void)0);
257
258 if (SvOBJECT(SvRV(sv))((((sv)->sv_u.svu_rv))->sv_flags & 0x00100000)) HvAMAGIC_on(SvSTASH(SvRV(sv)))((((XPVMG*) (((sv)->sv_u.svu_rv))->sv_any)->xmg_stash
)->sv_flags |= 0x10000000)
;
259}
260PERL_STATIC_INLINEstatic __inline__ void
261Perl_SvAMAGIC_off(SV *sv)
262{
263 PERL_ARGS_ASSERT_SVAMAGIC_OFF((void)0);
264
265 if (SvROK(sv)((sv)->sv_flags & 0x00000800) && SvOBJECT(SvRV(sv))((((sv)->sv_u.svu_rv))->sv_flags & 0x00100000))
266 HvAMAGIC_off(SvSTASH(SvRV(sv)))((((XPVMG*) (((sv)->sv_u.svu_rv))->sv_any)->xmg_stash
)->sv_flags &=~ 0x10000000)
;
267}
268
269PERL_STATIC_INLINEstatic __inline__ U32
270Perl_SvPADSTALE_on(SV *sv)
271{
272 assert(!(SvFLAGS(sv) & SVs_PADTMP))((void)0);
273 return SvFLAGS(sv)(sv)->sv_flags |= SVs_PADSTALE0x00040000;
274}
275PERL_STATIC_INLINEstatic __inline__ U32
276Perl_SvPADSTALE_off(SV *sv)
277{
278 assert(!(SvFLAGS(sv) & SVs_PADTMP))((void)0);
279 return SvFLAGS(sv)(sv)->sv_flags &= ~SVs_PADSTALE0x00040000;
280}
281#if defined(PERL_CORE) || defined (PERL_EXT)
282PERL_STATIC_INLINEstatic __inline__ STRLEN
283S_sv_or_pv_pos_u2b(pTHX_ SV *sv, const char *pv, STRLEN pos, STRLEN *lenp)
284{
285 PERL_ARGS_ASSERT_SV_OR_PV_POS_U2B((void)0); ((void)0);
286 if (SvGAMAGIC(sv)(((sv)->sv_flags & 0x00200000) || (((sv)->sv_flags &
0x00000800) && ((((sv)->sv_u.svu_rv))->sv_flags
& 0x00100000) && ((((XPVMG*) (((sv)->sv_u.svu_rv
))->sv_any)->xmg_stash)->sv_flags & 0x10000000))
)
) {
287 U8 *hopped = utf8_hopPerl_utf8_hop((U8 *)pv, pos);
288 if (lenp) *lenp = (STRLEN)(utf8_hopPerl_utf8_hop(hopped, *lenp) - hopped);
289 return (STRLEN)(hopped - (U8 *)pv);
290 }
291 return sv_pos_u2b_flags(sv,pos,lenp,SV_CONST_RETURN)Perl_sv_pos_u2b_flags( sv,pos,lenp,32);
292}
293#endif
294
295/* ------------------------------- utf8.h ------------------------------- */
296
297/*
298=head1 Unicode Support
299*/
300
301PERL_STATIC_INLINEstatic __inline__ void
302Perl_append_utf8_from_native_byte(const U8 byte, U8** dest)
303{
304 /* Takes an input 'byte' (Latin1 or EBCDIC) and appends it to the UTF-8
305 * encoded string at '*dest', updating '*dest' to include it */
306
307 PERL_ARGS_ASSERT_APPEND_UTF8_FROM_NATIVE_BYTE((void)0);
308
309 if (NATIVE_BYTE_IS_INVARIANT(byte)((((U64)(((UV) ((byte) | 0)))) < (((U8) (0xFF << 6))
& 0xB0)))
)
310 *((*dest)++) = byte;
311 else {
312 *((*dest)++) = UTF8_EIGHT_BIT_HI(byte)( ( ( ( ((U8) (((( ((U8) ((byte) | 0))) >> 6) | (((2) >
7) ? 0xFF : ((U8) (0xFE << (7-(2)))))) | 0))))))
;
313 *((*dest)++) = UTF8_EIGHT_BIT_LO(byte)( (( ( ((U8) (((( ((U8) ((byte) | 0))) & ((U8) ((1U <<
6) - 1))) | (((U8) (0xFF << 6)) & 0xB0)) | 0))))))
;
314 }
315}
316
317/*
318=for apidoc valid_utf8_to_uvchr
319Like C<L<perlapi/utf8_to_uvchr_buf>>, but should only be called when it is
320known that the next character in the input UTF-8 string C<s> is well-formed
321(I<e.g.>, it passes C<L<perlapi/isUTF8_CHAR>>. Surrogates, non-character code
322points, and non-Unicode code points are allowed.
323
324=cut
325
326 */
327
328PERL_STATIC_INLINEstatic __inline__ UV
329Perl_valid_utf8_to_uvchr(const U8 *s, STRLEN *retlen)
330{
331 const UV expectlen = UTF8SKIP(s)PL_utf8skip[*(const U8*)(s)];
332 const U8* send = s + expectlen;
333 UV uv = *s;
334
335 PERL_ARGS_ASSERT_VALID_UTF8_TO_UVCHR((void)0);
336
337 if (retlen) {
338 *retlen = expectlen;
339 }
340
341 /* An invariant is trivially returned */
342 if (expectlen == 1) {
343 return uv;
344 }
345
346 /* Remove the leading bits that indicate the number of bytes, leaving just
347 * the bits that are part of the value */
348 uv = NATIVE_UTF8_TO_I8(uv)( ((U8) ((uv) | 0))) & UTF_START_MASK(expectlen)(((expectlen) >= 7) ? 0x00 : (0x1F >> ((expectlen)-2
)))
;
349
350 /* Now, loop through the remaining bytes, accumulating each into the
351 * working total as we go. (I khw tried unrolling the loop for up to 4
352 * bytes, but there was no performance improvement) */
353 for (++s; s < send; s++) {
354 uv = UTF8_ACCUMULATE(uv, *s)( ((uv) << 6) | ((( ((U8) ((*s) | 0)))) & ((U8) ((1U
<< 6) - 1))))
;
355 }
356
357 return UNI_TO_NATIVE(uv)((UV) ((uv) | 0));
358
359}
360
361/*
362=for apidoc is_utf8_invariant_string
363
364Returns TRUE if the first C<len> bytes of the string C<s> are the same
365regardless of the UTF-8 encoding of the string (or UTF-EBCDIC encoding on
366EBCDIC machines); otherwise it returns FALSE. That is, it returns TRUE if they
367are UTF-8 invariant. On ASCII-ish machines, all the ASCII characters and only
368the ASCII characters fit this definition. On EBCDIC machines, the ASCII-range
369characters are invariant, but so also are the C1 controls.
370
371If C<len> is 0, it will be calculated using C<strlen(s)>, (which means if you
372use this option, that C<s> can't have embedded C<NUL> characters and has to
373have a terminating C<NUL> byte).
374
375See also
376C<L</is_utf8_string>>,
377C<L</is_utf8_string_flags>>,
378C<L</is_utf8_string_loc>>,
379C<L</is_utf8_string_loc_flags>>,
380C<L</is_utf8_string_loclen>>,
381C<L</is_utf8_string_loclen_flags>>,
382C<L</is_utf8_fixed_width_buf_flags>>,
383C<L</is_utf8_fixed_width_buf_loc_flags>>,
384C<L</is_utf8_fixed_width_buf_loclen_flags>>,
385C<L</is_strict_utf8_string>>,
386C<L</is_strict_utf8_string_loc>>,
387C<L</is_strict_utf8_string_loclen>>,
388C<L</is_c9strict_utf8_string>>,
389C<L</is_c9strict_utf8_string_loc>>,
390and
391C<L</is_c9strict_utf8_string_loclen>>.
392
393=cut
394
395*/
396
397#define is_utf8_invariant_string(s, len)Perl_is_utf8_invariant_string_loc(s, len, ((void*)0)) \
398 is_utf8_invariant_string_locPerl_is_utf8_invariant_string_loc(s, len, NULL((void*)0))
399
400/*
401=for apidoc is_utf8_invariant_string_loc
402
403Like C<L</is_utf8_invariant_string>> but upon failure, stores the location of
404the first UTF-8 variant character in the C<ep> pointer; if all characters are
405UTF-8 invariant, this function does not change the contents of C<*ep>.
406
407=cut
408
409*/
410
411PERL_STATIC_INLINEstatic __inline__ bool_Bool
412Perl_is_utf8_invariant_string_loc(const U8* const s, STRLEN len, const U8 ** ep)
413{
414 const U8* send;
415 const U8* x = s;
416
417 PERL_ARGS_ASSERT_IS_UTF8_INVARIANT_STRING_LOC((void)0);
418
419 if (len == 0) {
420 len = strlen((const char *)s);
421 }
422
423 send = s + len;
424
425/* This looks like 0x010101... */
426# define PERL_COUNT_MULTIPLIER (~ (UINTMAX_C(0)0ULL) / 0xFF)
427
428/* This looks like 0x808080... */
429# define PERL_VARIANTS_WORD_MASK (PERL_COUNT_MULTIPLIER * 0x80)
430# define PERL_WORDSIZE sizeof(PERL_UINTMAX_T)
431# define PERL_WORD_BOUNDARY_MASK (PERL_WORDSIZE - 1)
432
433/* Evaluates to 0 if 'x' is at a word boundary; otherwise evaluates to 1, by
434 * or'ing together the lowest bits of 'x'. Hopefully the final term gets
435 * optimized out completely on a 32-bit system, and its mask gets optimized out
436 * on a 64-bit system */
437# define PERL_IS_SUBWORD_ADDR(x)(1 & ( (UV)(x) | ( (UV)(x) >> 1) | ( ( ((UV)(x) &
PERL_WORD_BOUNDARY_MASK) >> 2))))
(1 & ( PTR2nat(x)(UV)(x) \
438 | ( PTR2nat(x)(UV)(x) >> 1) \
439 | ( ( (PTR2nat(x)(UV)(x) \
440 & PERL_WORD_BOUNDARY_MASK) >> 2))))
441
442#ifndef EBCDIC
443
444 /* Do the word-at-a-time iff there is at least one usable full word. That
445 * means that after advancing to a word boundary, there still is at least a
446 * full word left. The number of bytes needed to advance is 'wordsize -
447 * offset' unless offset is 0. */
448 if ((STRLEN) (send - x) >= PERL_WORDSIZE
449
450 /* This term is wordsize if subword; 0 if not */
451 + PERL_WORDSIZE * PERL_IS_SUBWORD_ADDR(x)(1 & ( (UV)(x) | ( (UV)(x) >> 1) | ( ( ((UV)(x) &
PERL_WORD_BOUNDARY_MASK) >> 2))))
452
453 /* 'offset' */
454 - (PTR2nat(x)(UV)(x) & PERL_WORD_BOUNDARY_MASK))
455 {
456
457 /* Process per-byte until reach word boundary. XXX This loop could be
458 * eliminated if we knew that this platform had fast unaligned reads */
459 while (PTR2nat(x)(UV)(x) & PERL_WORD_BOUNDARY_MASK) {
460 if (! UTF8_IS_INVARIANT(*x)((((U64)(((UV) (((*x) | 0) | 0)))) < (((U8) (0xFF <<
6)) & 0xB0)))
) {
461 if (ep) {
462 *ep = x;
463 }
464
465 return FALSE(0);
466 }
467 x++;
468 }
469
470 /* Here, we know we have at least one full word to process. Process
471 * per-word as long as we have at least a full word left */
472 do {
473 if ((* (PERL_UINTMAX_T *) x) & PERL_VARIANTS_WORD_MASK) {
474
475 /* Found a variant. Just return if caller doesn't want its
476 * exact position */
477 if (! ep) {
478 return FALSE(0);
479 }
480
481# if BYTEORDER0x12345678 == 0x1234 || BYTEORDER0x12345678 == 0x12345678 \
482 || BYTEORDER0x12345678 == 0x4321 || BYTEORDER0x12345678 == 0x87654321
483
484 *ep = x + variant_byte_numberPerl_variant_byte_number(* (PERL_UINTMAX_T *) x);
485 assert(*ep >= s && *ep < send)((void)0);
486
487 return FALSE(0);
488
489# else /* If weird byte order, drop into next loop to do byte-at-a-time
490 checks. */
491
492 break;
493# endif
494 }
495
496 x += PERL_WORDSIZE;
497
498 } while (x + PERL_WORDSIZE <= send);
499 }
500
501#endif /* End of ! EBCDIC */
502
503 /* Process per-byte */
504 while (x < send) {
505 if (! UTF8_IS_INVARIANT(*x)((((U64)(((UV) (((*x) | 0) | 0)))) < (((U8) (0xFF <<
6)) & 0xB0)))
) {
506 if (ep) {
507 *ep = x;
508 }
509
510 return FALSE(0);
511 }
512
513 x++;
514 }
515
516 return TRUE(1);
517}
518
519#ifndef EBCDIC
520
521PERL_STATIC_INLINEstatic __inline__ unsigned int
522Perl_variant_byte_number(PERL_UINTMAX_T word)
523{
524
525 /* This returns the position in a word (0..7) of the first variant byte in
526 * it. This is a helper function. Note that there are no branches */
527
528 assert(word)((void)0);
529
530 /* Get just the msb bits of each byte */
531 word &= PERL_VARIANTS_WORD_MASK;
532
533# if BYTEORDER0x12345678 == 0x1234 || BYTEORDER0x12345678 == 0x12345678
534
535 /* Bytes are stored like
536 * Byte8 ... Byte2 Byte1
537 * 63..56...15...8 7...0
538 *
539 * Isolate the lsb;
540 * https://stackoverflow.com/questions/757059/position-of-least-significant-bit-that-is-set
541 *
542 * The word will look like this, with a rightmost set bit in position 's':
543 * ('x's are don't cares)
544 * s
545 * x..x100..0
546 * x..xx10..0 Right shift (rightmost 0 is shifted off)
547 * x..xx01..1 Subtract 1, turns all the trailing zeros into 1's and
548 * the 1 just to their left into a 0; the remainder is
549 * untouched
550 * 0..0011..1 The xor with the original, x..xx10..0, clears that
551 * remainder, sets the bottom to all 1
552 * 0..0100..0 Add 1 to clear the word except for the bit in 's'
553 *
554 * Another method is to do 'word &= -word'; but it generates a compiler
555 * message on some platforms about taking the negative of an unsigned */
556
557 word >>= 1;
558 word = 1 + (word ^ (word - 1));
559
560# elif BYTEORDER0x12345678 == 0x4321 || BYTEORDER0x12345678 == 0x87654321
561
562 /* Bytes are stored like
563 * Byte1 Byte2 ... Byte8
564 * 63..56 55..47 ... 7...0
565 *
566 * Isolate the msb; http://codeforces.com/blog/entry/10330
567 *
568 * Only the most significant set bit matters. Or'ing word with its right
569 * shift of 1 makes that bit and the next one to its right both 1. Then
570 * right shifting by 2 makes for 4 1-bits in a row. ... We end with the
571 * msb and all to the right being 1. */
572 word |= word >> 1;
573 word |= word >> 2;
574 word |= word >> 4;
575 word |= word >> 8;
576 word |= word >> 16;
577 word |= word >> 32; /* This should get optimized out on 32-bit systems. */
578
579 /* Then subtracting the right shift by 1 clears all but the left-most of
580 * the 1 bits, which is our desired result */
581 word -= (word >> 1);
582
583# else
584# error Unexpected byte order
585# endif
586
587 /* Here 'word' has a single bit set: the msb of the first byte in which it
588 * is set. Calculate that position in the word. We can use this
589 * specialized solution: https://stackoverflow.com/a/32339674/1626653,
590 * assumes an 8-bit byte. (On a 32-bit machine, the larger numbers should
591 * just get shifted off at compile time) */
592 word = (word >> 7) * ((UINTMAX_C( 7)7ULL << 56) | (UINTMAX_C(15)15ULL << 48)
593 | (UINTMAX_C(23)23ULL << 40) | (UINTMAX_C(31)31ULL << 32)
594 | (39 << 24) | (47 << 16)
595 | (55 << 8) | (63 << 0));
596 word >>= PERL_WORDSIZE * 7; /* >> by either 56 or 24 */
597
598 /* Here, word contains the position 7..63 of that bit. Convert to 0..7 */
599 word = ((word + 1) >> 3) - 1;
600
601# if BYTEORDER0x12345678 == 0x4321 || BYTEORDER0x12345678 == 0x87654321
602
603 /* And invert the result */
604 word = CHARBITS8 - word - 1;
605
606# endif
607
608 return (unsigned int) word;
609}
610
611#endif
612#if defined(PERL_CORE) || defined(PERL_EXT)
613
614/*
615=for apidoc variant_under_utf8_count
616
617This function looks at the sequence of bytes between C<s> and C<e>, which are
618assumed to be encoded in ASCII/Latin1, and returns how many of them would
619change should the string be translated into UTF-8. Due to the nature of UTF-8,
620each of these would occupy two bytes instead of the single one in the input
621string. Thus, this function returns the precise number of bytes the string
622would expand by when translated to UTF-8.
623
624Unlike most of the other functions that have C<utf8> in their name, the input
625to this function is NOT a UTF-8-encoded string. The function name is slightly
626I<odd> to emphasize this.
627
628This function is internal to Perl because khw thinks that any XS code that
629would want this is probably operating too close to the internals. Presenting a
630valid use case could change that.
631
632See also
633C<L<perlapi/is_utf8_invariant_string>>
634and
635C<L<perlapi/is_utf8_invariant_string_loc>>,
636
637=cut
638
639*/
640
641PERL_STATIC_INLINEstatic __inline__ Size_tsize_t
642S_variant_under_utf8_count(const U8* const s, const U8* const e)
643{
644 const U8* x = s;
645 Size_tsize_t count = 0;
646
647 PERL_ARGS_ASSERT_VARIANT_UNDER_UTF8_COUNT((void)0); ((void)0);
648
649# ifndef EBCDIC
650
651 /* Test if the string is long enough to use word-at-a-time. (Logic is the
652 * same as for is_utf8_invariant_string()) */
653 if ((STRLEN) (e - x) >= PERL_WORDSIZE
654 + PERL_WORDSIZE * PERL_IS_SUBWORD_ADDR(x)(1 & ( (UV)(x) | ( (UV)(x) >> 1) | ( ( ((UV)(x) &
PERL_WORD_BOUNDARY_MASK) >> 2))))
655 - (PTR2nat(x)(UV)(x) & PERL_WORD_BOUNDARY_MASK))
656 {
657
658 /* Process per-byte until reach word boundary. XXX This loop could be
659 * eliminated if we knew that this platform had fast unaligned reads */
660 while (PTR2nat(x)(UV)(x) & PERL_WORD_BOUNDARY_MASK) {
661 count += ! UTF8_IS_INVARIANT(*x++)((((U64)(((UV) (((*x++) | 0) | 0)))) < (((U8) (0xFF <<
6)) & 0xB0)))
;
662 }
663
664 /* Process per-word as long as we have at least a full word left */
665 do { /* Commit 03c1e4ab1d6ee9062fb3f94b0ba31db6698724b1 contains an
666 explanation of how this works */
667 PERL_UINTMAX_T increment
668 = ((((* (PERL_UINTMAX_T *) x) & PERL_VARIANTS_WORD_MASK) >> 7)
669 * PERL_COUNT_MULTIPLIER)
670 >> ((PERL_WORDSIZE - 1) * CHARBITS8);
671 count += (Size_tsize_t) increment;
672 x += PERL_WORDSIZE;
673 } while (x + PERL_WORDSIZE <= e);
674 }
675
676# endif
677
678 /* Process per-byte */
679 while (x < e) {
680 if (! UTF8_IS_INVARIANT(*x)((((U64)(((UV) (((*x) | 0) | 0)))) < (((U8) (0xFF <<
6)) & 0xB0)))
) {
681 count++;
682 }
683
684 x++;
685 }
686
687 return count;
688}
689
690#endif
691
692#ifndef PERL_IN_REGEXEC_C /* Keep these around for that file */
693# undef PERL_WORDSIZE
694# undef PERL_COUNT_MULTIPLIER
695# undef PERL_WORD_BOUNDARY_MASK
696# undef PERL_VARIANTS_WORD_MASK
697#endif
698
699/*
700=for apidoc is_utf8_string
701
702Returns TRUE if the first C<len> bytes of string C<s> form a valid
703Perl-extended-UTF-8 string; returns FALSE otherwise. If C<len> is 0, it will
704be calculated using C<strlen(s)> (which means if you use this option, that C<s>
705can't have embedded C<NUL> characters and has to have a terminating C<NUL>
706byte). Note that all characters being ASCII constitute 'a valid UTF-8 string'.
707
708This function considers Perl's extended UTF-8 to be valid. That means that
709code points above Unicode, surrogates, and non-character code points are
710considered valid by this function. Use C<L</is_strict_utf8_string>>,
711C<L</is_c9strict_utf8_string>>, or C<L</is_utf8_string_flags>> to restrict what
712code points are considered valid.
713
714See also
715C<L</is_utf8_invariant_string>>,
716C<L</is_utf8_invariant_string_loc>>,
717C<L</is_utf8_string_loc>>,
718C<L</is_utf8_string_loclen>>,
719C<L</is_utf8_fixed_width_buf_flags>>,
720C<L</is_utf8_fixed_width_buf_loc_flags>>,
721C<L</is_utf8_fixed_width_buf_loclen_flags>>,
722
723=cut
724*/
725
726#define is_utf8_string(s, len)Perl_is_utf8_string_loclen(s, len, ((void*)0), ((void*)0)) is_utf8_string_loclenPerl_is_utf8_string_loclen(s, len, NULL((void*)0), NULL((void*)0))
727
728#if defined(PERL_CORE) || defined (PERL_EXT)
729
730/*
731=for apidoc is_utf8_non_invariant_string
732
733Returns TRUE if L<perlapi/is_utf8_invariant_string> returns FALSE for the first
734C<len> bytes of the string C<s>, but they are, nonetheless, legal Perl-extended
735UTF-8; otherwise returns FALSE.
736
737A TRUE return means that at least one code point represented by the sequence
738either is a wide character not representable as a single byte, or the
739representation differs depending on whether the sequence is encoded in UTF-8 or
740not.
741
742See also
743C<L<perlapi/is_utf8_invariant_string>>,
744C<L<perlapi/is_utf8_string>>
745
746=cut
747
748This is commonly used to determine if a SV's UTF-8 flag should be turned on.
749It generally needn't be if its string is entirely UTF-8 invariant, and it
750shouldn't be if it otherwise contains invalid UTF-8.
751
752It is an internal function because khw thinks that XS code shouldn't be working
753at this low a level. A valid use case could change that.
754
755*/
756
757PERL_STATIC_INLINEstatic __inline__ bool_Bool
758Perl_is_utf8_non_invariant_string(const U8* const s, STRLEN len)
759{
760 const U8 * first_variant;
761
762 PERL_ARGS_ASSERT_IS_UTF8_NON_INVARIANT_STRING((void)0);
763
764 if (is_utf8_invariant_string_locPerl_is_utf8_invariant_string_loc(s, len, &first_variant)) {
765 return FALSE(0);
766 }
767
768 return is_utf8_string(first_variant, len - (first_variant - s))Perl_is_utf8_string_loclen(first_variant, len - (first_variant
- s), ((void*)0), ((void*)0))
;
769}
770
771#endif
772
773/*
774=for apidoc is_strict_utf8_string
775
776Returns TRUE if the first C<len> bytes of string C<s> form a valid
777UTF-8-encoded string that is fully interchangeable by any application using
778Unicode rules; otherwise it returns FALSE. If C<len> is 0, it will be
779calculated using C<strlen(s)> (which means if you use this option, that C<s>
780can't have embedded C<NUL> characters and has to have a terminating C<NUL>
781byte). Note that all characters being ASCII constitute 'a valid UTF-8 string'.
782
783This function returns FALSE for strings containing any
784code points above the Unicode max of 0x10FFFF, surrogate code points, or
785non-character code points.
786
787See also
788C<L</is_utf8_invariant_string>>,
789C<L</is_utf8_invariant_string_loc>>,
790C<L</is_utf8_string>>,
791C<L</is_utf8_string_flags>>,
792C<L</is_utf8_string_loc>>,
793C<L</is_utf8_string_loc_flags>>,
794C<L</is_utf8_string_loclen>>,
795C<L</is_utf8_string_loclen_flags>>,
796C<L</is_utf8_fixed_width_buf_flags>>,
797C<L</is_utf8_fixed_width_buf_loc_flags>>,
798C<L</is_utf8_fixed_width_buf_loclen_flags>>,
799C<L</is_strict_utf8_string_loc>>,
800C<L</is_strict_utf8_string_loclen>>,
801C<L</is_c9strict_utf8_string>>,
802C<L</is_c9strict_utf8_string_loc>>,
803and
804C<L</is_c9strict_utf8_string_loclen>>.
805
806=cut
807*/
808
809#define is_strict_utf8_string(s, len)Perl_is_strict_utf8_string_loclen(s, len, ((void*)0), ((void*
)0))
is_strict_utf8_string_loclenPerl_is_strict_utf8_string_loclen(s, len, NULL((void*)0), NULL((void*)0))
810
811/*
812=for apidoc is_c9strict_utf8_string
813
814Returns TRUE if the first C<len> bytes of string C<s> form a valid
815UTF-8-encoded string that conforms to
816L<Unicode Corrigendum #9|http://www.unicode.org/versions/corrigendum9.html>;
817otherwise it returns FALSE. If C<len> is 0, it will be calculated using
818C<strlen(s)> (which means if you use this option, that C<s> can't have embedded
819C<NUL> characters and has to have a terminating C<NUL> byte). Note that all
820characters being ASCII constitute 'a valid UTF-8 string'.
821
822This function returns FALSE for strings containing any code points above the
823Unicode max of 0x10FFFF or surrogate code points, but accepts non-character
824code points per
825L<Corrigendum #9|http://www.unicode.org/versions/corrigendum9.html>.
826
827See also
828C<L</is_utf8_invariant_string>>,
829C<L</is_utf8_invariant_string_loc>>,
830C<L</is_utf8_string>>,
831C<L</is_utf8_string_flags>>,
832C<L</is_utf8_string_loc>>,
833C<L</is_utf8_string_loc_flags>>,
834C<L</is_utf8_string_loclen>>,
835C<L</is_utf8_string_loclen_flags>>,
836C<L</is_utf8_fixed_width_buf_flags>>,
837C<L</is_utf8_fixed_width_buf_loc_flags>>,
838C<L</is_utf8_fixed_width_buf_loclen_flags>>,
839C<L</is_strict_utf8_string>>,
840C<L</is_strict_utf8_string_loc>>,
841C<L</is_strict_utf8_string_loclen>>,
842C<L</is_c9strict_utf8_string_loc>>,
843and
844C<L</is_c9strict_utf8_string_loclen>>.
845
846=cut
847*/
848
849#define is_c9strict_utf8_string(s, len)Perl_is_c9strict_utf8_string_loclen(s, len, ((void*)0), 0) is_c9strict_utf8_string_loclenPerl_is_c9strict_utf8_string_loclen(s, len, NULL((void*)0), 0)
850
851/*
852=for apidoc is_utf8_string_flags
853
854Returns TRUE if the first C<len> bytes of string C<s> form a valid
855UTF-8 string, subject to the restrictions imposed by C<flags>;
856returns FALSE otherwise. If C<len> is 0, it will be calculated
857using C<strlen(s)> (which means if you use this option, that C<s> can't have
858embedded C<NUL> characters and has to have a terminating C<NUL> byte). Note
859that all characters being ASCII constitute 'a valid UTF-8 string'.
860
861If C<flags> is 0, this gives the same results as C<L</is_utf8_string>>; if
862C<flags> is C<UTF8_DISALLOW_ILLEGAL_INTERCHANGE>, this gives the same results
863as C<L</is_strict_utf8_string>>; and if C<flags> is
864C<UTF8_DISALLOW_ILLEGAL_C9_INTERCHANGE>, this gives the same results as
865C<L</is_c9strict_utf8_string>>. Otherwise C<flags> may be any
866combination of the C<UTF8_DISALLOW_I<foo>> flags understood by
867C<L</utf8n_to_uvchr>>, with the same meanings.
868
869See also
870C<L</is_utf8_invariant_string>>,
871C<L</is_utf8_invariant_string_loc>>,
872C<L</is_utf8_string>>,
873C<L</is_utf8_string_loc>>,
874C<L</is_utf8_string_loc_flags>>,
875C<L</is_utf8_string_loclen>>,
876C<L</is_utf8_string_loclen_flags>>,
877C<L</is_utf8_fixed_width_buf_flags>>,
878C<L</is_utf8_fixed_width_buf_loc_flags>>,
879C<L</is_utf8_fixed_width_buf_loclen_flags>>,
880C<L</is_strict_utf8_string>>,
881C<L</is_strict_utf8_string_loc>>,
882C<L</is_strict_utf8_string_loclen>>,
883C<L</is_c9strict_utf8_string>>,
884C<L</is_c9strict_utf8_string_loc>>,
885and
886C<L</is_c9strict_utf8_string_loclen>>.
887
888=cut
889*/
890
891PERL_STATIC_INLINEstatic __inline__ bool_Bool
892Perl_is_utf8_string_flags(const U8 *s, STRLEN len, const U32 flags)
893{
894 const U8 * first_variant;
895
896 PERL_ARGS_ASSERT_IS_UTF8_STRING_FLAGS((void)0);
897 assert(0 == (flags & ~(UTF8_DISALLOW_ILLEGAL_INTERCHANGE((void)0)
898 |UTF8_DISALLOW_PERL_EXTENDED)))((void)0);
899
900 if (len == 0) {
901 len = strlen((const char *)s);
902 }
903
904 if (flags == 0) {
905 return is_utf8_string(s, len)Perl_is_utf8_string_loclen(s, len, ((void*)0), ((void*)0));
906 }
907
908 if ((flags & ~UTF8_DISALLOW_PERL_EXTENDED0x4000)
909 == UTF8_DISALLOW_ILLEGAL_INTERCHANGE((0x1000|0x0100)|0x0400))
910 {
911 return is_strict_utf8_string(s, len)Perl_is_strict_utf8_string_loclen(s, len, ((void*)0), ((void*
)0))
;
912 }
913
914 if ((flags & ~UTF8_DISALLOW_PERL_EXTENDED0x4000)
915 == UTF8_DISALLOW_ILLEGAL_C9_INTERCHANGE(0x1000|0x0100))
916 {
917 return is_c9strict_utf8_string(s, len)Perl_is_c9strict_utf8_string_loclen(s, len, ((void*)0), 0);
918 }
919
920 if (! is_utf8_invariant_string_locPerl_is_utf8_invariant_string_loc(s, len, &first_variant)) {
921 const U8* const send = s + len;
922 const U8* x = first_variant;
923
924 while (x < send) {
925 STRLEN cur_len = isUTF8_CHAR_flags(x, send, flags)(__builtin_expect((((send) <= (x)) ? (_Bool)1 : (_Bool)0),
(0)) ? 0 : (((((U64)(((UV) (((*x) | 0) | 0)))) < (((U8) (0xFF
<< 6)) & 0xB0)))) ? 1 : __builtin_expect(((((send)
- (x)) < PL_utf8skip[*(const U8*)(x)]) ? (_Bool)1 : (_Bool
)0),(0)) ? 0 : Perl_is_utf8_char_helper(x, send, flags))
;
926 if (UNLIKELY(! cur_len)__builtin_expect(((! cur_len) ? (_Bool)1 : (_Bool)0),(0))) {
927 return FALSE(0);
928 }
929 x += cur_len;
930 }
931 }
932
933 return TRUE(1);
934}
935
936/*
937
938=for apidoc is_utf8_string_loc
939
940Like C<L</is_utf8_string>> but stores the location of the failure (in the
941case of "utf8ness failure") or the location C<s>+C<len> (in the case of
942"utf8ness success") in the C<ep> pointer.
943
944See also C<L</is_utf8_string_loclen>>.
945
946=cut
947*/
948
949#define is_utf8_string_loc(s, len, ep)Perl_is_utf8_string_loclen(s, len, ep, 0) is_utf8_string_loclenPerl_is_utf8_string_loclen(s, len, ep, 0)
950
951/*
952
953=for apidoc is_utf8_string_loclen
954
955Like C<L</is_utf8_string>> but stores the location of the failure (in the
956case of "utf8ness failure") or the location C<s>+C<len> (in the case of
957"utf8ness success") in the C<ep> pointer, and the number of UTF-8
958encoded characters in the C<el> pointer.
959
960See also C<L</is_utf8_string_loc>>.
961
962=cut
963*/
964
965PERL_STATIC_INLINEstatic __inline__ bool_Bool
966Perl_is_utf8_string_loclen(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el)
967{
968 const U8 * first_variant;
969
970 PERL_ARGS_ASSERT_IS_UTF8_STRING_LOCLEN((void)0);
971
972 if (len == 0) {
973 len = strlen((const char *) s);
974 }
975
976 if (is_utf8_invariant_string_locPerl_is_utf8_invariant_string_loc(s, len, &first_variant)) {
977 if (el)
978 *el = len;
979
980 if (ep) {
981 *ep = s + len;
982 }
983
984 return TRUE(1);
985 }
986
987 {
988 const U8* const send = s + len;
989 const U8* x = first_variant;
990 STRLEN outlen = first_variant - s;
991
992 while (x < send) {
993 const STRLEN cur_len = isUTF8_CHARPerl_isUTF8_CHAR(x, send);
994 if (UNLIKELY(! cur_len)__builtin_expect(((! cur_len) ? (_Bool)1 : (_Bool)0),(0))) {
995 break;
996 }
997 x += cur_len;
998 outlen++;
999 }
1000
1001 if (el)
1002 *el = outlen;
1003
1004 if (ep) {
1005 *ep = x;
1006 }
1007
1008 return (x == send);
1009 }
1010}
1011
1012/*
1013
1014=for apidoc isUTF8_CHAR
1015
1016Evaluates to non-zero if the first few bytes of the string starting at C<s> and
1017looking no further than S<C<e - 1>> are well-formed UTF-8, as extended by Perl,
1018that represents some code point; otherwise it evaluates to 0. If non-zero, the
1019value gives how many bytes starting at C<s> comprise the code point's
1020representation. Any bytes remaining before C<e>, but beyond the ones needed to
1021form the first code point in C<s>, are not examined.
1022
1023The code point can be any that will fit in an IV on this machine, using Perl's
1024extension to official UTF-8 to represent those higher than the Unicode maximum
1025of 0x10FFFF. That means that this macro is used to efficiently decide if the
1026next few bytes in C<s> is legal UTF-8 for a single character.
1027
1028Use C<L</isSTRICT_UTF8_CHAR>> to restrict the acceptable code points to those
1029defined by Unicode to be fully interchangeable across applications;
1030C<L</isC9_STRICT_UTF8_CHAR>> to use the L<Unicode Corrigendum
1031#9|http://www.unicode.org/versions/corrigendum9.html> definition of allowable
1032code points; and C<L</isUTF8_CHAR_flags>> for a more customized definition.
1033
1034Use C<L</is_utf8_string>>, C<L</is_utf8_string_loc>>, and
1035C<L</is_utf8_string_loclen>> to check entire strings.
1036
1037Note also that a UTF-8 "invariant" character (i.e. ASCII on non-EBCDIC
1038machines) is a valid UTF-8 character.
1039
1040=cut
1041
1042This uses an adaptation of the table and algorithm given in
1043https://bjoern.hoehrmann.de/utf-8/decoder/dfa/, which provides comprehensive
1044documentation of the original version. A copyright notice for the original
1045version is given at the beginning of this file. The Perl adapation is
1046documented at the definition of PL_extended_utf8_dfa_tab[].
1047
1048*/
1049
1050PERL_STATIC_INLINEstatic __inline__ Size_tsize_t
1051Perl_isUTF8_CHAR(const U8 * const s0, const U8 * const e)
1052{
1053 const U8 * s = s0;
1054 UV state = 0;
1055
1056 PERL_ARGS_ASSERT_ISUTF8_CHAR((void)0); ((void)0);
1057
1058 /* This dfa is fast. If it accepts the input, it was for a well-formed,
1059 * code point, which can be returned immediately. Otherwise, it is either
1060 * malformed, or for the start byte FF which the dfa doesn't handle (except
1061 * on 32-bit ASCII platforms where it trivially is an error). Call a
1062 * helper function for the other platforms. */
1063
1064 while (s < e && LIKELY(state != 1)__builtin_expect(((state != 1) ? (_Bool)1 : (_Bool)0),(1))) {
1065 state = PL_extended_utf8_dfa_tab[256
1066 + state
1067 + PL_extended_utf8_dfa_tab[*s]];
1068 if (state != 0) {
1069 s++;
1070 continue;
1071 }
1072
1073 return s - s0 + 1;
1074 }
1075
1076#if defined(UV_IS_QUAD) || defined(EBCDIC)
1077
1078 if (NATIVE_UTF8_TO_I8(*s0)( ((U8) ((*s0) | 0))) == 0xFF && e - s0 >= UTF8_MAXBYTES13) {
1079 return is_utf8_char_helperPerl_is_utf8_char_helper(s0, e, 0);
1080 }
1081
1082#endif
1083
1084 return 0;
1085}
1086
1087/*
1088
1089=for apidoc isSTRICT_UTF8_CHAR
1090
1091Evaluates to non-zero if the first few bytes of the string starting at C<s> and
1092looking no further than S<C<e - 1>> are well-formed UTF-8 that represents some
1093Unicode code point completely acceptable for open interchange between all
1094applications; otherwise it evaluates to 0. If non-zero, the value gives how
1095many bytes starting at C<s> comprise the code point's representation. Any
1096bytes remaining before C<e>, but beyond the ones needed to form the first code
1097point in C<s>, are not examined.
1098
1099The largest acceptable code point is the Unicode maximum 0x10FFFF, and must not
1100be a surrogate nor a non-character code point. Thus this excludes any code
1101point from Perl's extended UTF-8.
1102
1103This is used to efficiently decide if the next few bytes in C<s> is
1104legal Unicode-acceptable UTF-8 for a single character.
1105
1106Use C<L</isC9_STRICT_UTF8_CHAR>> to use the L<Unicode Corrigendum
1107#9|http://www.unicode.org/versions/corrigendum9.html> definition of allowable
1108code points; C<L</isUTF8_CHAR>> to check for Perl's extended UTF-8;
1109and C<L</isUTF8_CHAR_flags>> for a more customized definition.
1110
1111Use C<L</is_strict_utf8_string>>, C<L</is_strict_utf8_string_loc>>, and
1112C<L</is_strict_utf8_string_loclen>> to check entire strings.
1113
1114=cut
1115
1116This uses an adaptation of the tables and algorithm given in
1117https://bjoern.hoehrmann.de/utf-8/decoder/dfa/, which provides comprehensive
1118documentation of the original version. A copyright notice for the original
1119version is given at the beginning of this file. The Perl adapation is
1120documented at the definition of strict_extended_utf8_dfa_tab[].
1121
1122*/
1123
1124PERL_STATIC_INLINEstatic __inline__ Size_tsize_t
1125Perl_isSTRICT_UTF8_CHAR(const U8 * const s0, const U8 * const e)
1126{
1127 const U8 * s = s0;
1128 UV state = 0;
1129
1130 PERL_ARGS_ASSERT_ISSTRICT_UTF8_CHAR((void)0); ((void)0);
1131
1132 while (s < e && LIKELY(state != 1)__builtin_expect(((state != 1) ? (_Bool)1 : (_Bool)0),(1))) {
1133 state = PL_strict_utf8_dfa_tab[256 + state + PL_strict_utf8_dfa_tab[*s]];
1134
1135 if (state != 0) {
1136 s++;
1137 continue;
1138 }
1139
1140 return s - s0 + 1;
1141 }
1142
1143#ifndef EBCDIC
1144
1145 /* The dfa above drops out for certain Hanguls; handle them specially */
1146 if (is_HANGUL_ED_utf8_safe(s0, e)( ( ( ( ( ((e) - (s0)) >= 3 ) && ( 0xED == ((const
U8*)s0)[0] ) ) && ( ( ( (sizeof(((const U8*)s0)[1]) ==
sizeof(U8)) ? ( (((U64) (((((U8) (((const U8*)s0)[1])))) - (
((0x80)) | 0))) <= (((U64) ((((0x9F) - (0x80))) | 0))))) :
(sizeof(((const U8*)s0)[1]) == sizeof(U32)) ? ( (((U64) ((((
(U32) (((const U8*)s0)[1])))) - (((0x80)) | 0))) <= (((U64
) ((((0x9F) - (0x80))) | 0))))) : ( ( (((U64) (((((U64) (((const
U8*)s0)[1])))) - (((0x80)) | 0))) <= (((U64) ((((0x9F) - (
0x80))) | 0)))))))) ) ) && ( ( ( (sizeof(((const U8*)
s0)[2]) == sizeof(U8)) ? ( (((U64) (((((U8) (((const U8*)s0)[
2])))) - (((0x80)) | 0))) <= (((U64) ((((0xBF) - (0x80))) |
0))))) : (sizeof(((const U8*)s0)[2]) == sizeof(U32)) ? ( (((
U64) (((((U32) (((const U8*)s0)[2])))) - (((0x80)) | 0))) <=
(((U64) ((((0xBF) - (0x80))) | 0))))) : ( ( (((U64) (((((U64
) (((const U8*)s0)[2])))) - (((0x80)) | 0))) <= (((U64) ((
((0xBF) - (0x80))) | 0)))))))) ) ) ? 3 : 0 )
) {
1147 return 3;
1148 }
1149
1150#endif
1151
1152 return 0;
1153}
1154
1155/*
1156
1157=for apidoc isC9_STRICT_UTF8_CHAR
1158
1159Evaluates to non-zero if the first few bytes of the string starting at C<s> and
1160looking no further than S<C<e - 1>> are well-formed UTF-8 that represents some
1161Unicode non-surrogate code point; otherwise it evaluates to 0. If non-zero,
1162the value gives how many bytes starting at C<s> comprise the code point's
1163representation. Any bytes remaining before C<e>, but beyond the ones needed to
1164form the first code point in C<s>, are not examined.
1165
1166The largest acceptable code point is the Unicode maximum 0x10FFFF. This
1167differs from C<L</isSTRICT_UTF8_CHAR>> only in that it accepts non-character
1168code points. This corresponds to
1169L<Unicode Corrigendum #9|http://www.unicode.org/versions/corrigendum9.html>.
1170which said that non-character code points are merely discouraged rather than
1171completely forbidden in open interchange. See
1172L<perlunicode/Noncharacter code points>.
1173
1174Use C<L</isUTF8_CHAR>> to check for Perl's extended UTF-8; and
1175C<L</isUTF8_CHAR_flags>> for a more customized definition.
1176
1177Use C<L</is_c9strict_utf8_string>>, C<L</is_c9strict_utf8_string_loc>>, and
1178C<L</is_c9strict_utf8_string_loclen>> to check entire strings.
1179
1180=cut
1181
1182This uses an adaptation of the tables and algorithm given in
1183https://bjoern.hoehrmann.de/utf-8/decoder/dfa/, which provides comprehensive
1184documentation of the original version. A copyright notice for the original
1185version is given at the beginning of this file. The Perl adapation is
1186documented at the definition of PL_c9_utf8_dfa_tab[].
1187
1188*/
1189
1190PERL_STATIC_INLINEstatic __inline__ Size_tsize_t
1191Perl_isC9_STRICT_UTF8_CHAR(const U8 * const s0, const U8 * const e)
1192{
1193 const U8 * s = s0;
1194 UV state = 0;
1195
1196 PERL_ARGS_ASSERT_ISC9_STRICT_UTF8_CHAR((void)0); ((void)0);
1197
1198 while (s < e && LIKELY(state != 1)__builtin_expect(((state != 1) ? (_Bool)1 : (_Bool)0),(1))) {
1199 state = PL_c9_utf8_dfa_tab[256 + state + PL_c9_utf8_dfa_tab[*s]];
1200
1201 if (state != 0) {
1202 s++;
1203 continue;
1204 }
1205
1206 return s - s0 + 1;
1207 }
1208
1209 return 0;
1210}
1211
1212/*
1213
1214=for apidoc is_strict_utf8_string_loc
1215
1216Like C<L</is_strict_utf8_string>> but stores the location of the failure (in the
1217case of "utf8ness failure") or the location C<s>+C<len> (in the case of
1218"utf8ness success") in the C<ep> pointer.
1219
1220See also C<L</is_strict_utf8_string_loclen>>.
1221
1222=cut
1223*/
1224
1225#define is_strict_utf8_string_loc(s, len, ep)Perl_is_strict_utf8_string_loclen(s, len, ep, 0) \
1226 is_strict_utf8_string_loclenPerl_is_strict_utf8_string_loclen(s, len, ep, 0)
1227
1228/*
1229
1230=for apidoc is_strict_utf8_string_loclen
1231
1232Like C<L</is_strict_utf8_string>> but stores the location of the failure (in the
1233case of "utf8ness failure") or the location C<s>+C<len> (in the case of
1234"utf8ness success") in the C<ep> pointer, and the number of UTF-8
1235encoded characters in the C<el> pointer.
1236
1237See also C<L</is_strict_utf8_string_loc>>.
1238
1239=cut
1240*/
1241
1242PERL_STATIC_INLINEstatic __inline__ bool_Bool
1243Perl_is_strict_utf8_string_loclen(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el)
1244{
1245 const U8 * first_variant;
1246
1247 PERL_ARGS_ASSERT_IS_STRICT_UTF8_STRING_LOCLEN((void)0);
1248
1249 if (len == 0) {
1250 len = strlen((const char *) s);
1251 }
1252
1253 if (is_utf8_invariant_string_locPerl_is_utf8_invariant_string_loc(s, len, &first_variant)) {
1254 if (el)
1255 *el = len;
1256
1257 if (ep) {
1258 *ep = s + len;
1259 }
1260
1261 return TRUE(1);
1262 }
1263
1264 {
1265 const U8* const send = s + len;
1266 const U8* x = first_variant;
1267 STRLEN outlen = first_variant - s;
1268
1269 while (x < send) {
1270 const STRLEN cur_len = isSTRICT_UTF8_CHARPerl_isSTRICT_UTF8_CHAR(x, send);
1271 if (UNLIKELY(! cur_len)__builtin_expect(((! cur_len) ? (_Bool)1 : (_Bool)0),(0))) {
1272 break;
1273 }
1274 x += cur_len;
1275 outlen++;
1276 }
1277
1278 if (el)
1279 *el = outlen;
1280
1281 if (ep) {
1282 *ep = x;
1283 }
1284
1285 return (x == send);
1286 }
1287}
1288
1289/*
1290
1291=for apidoc is_c9strict_utf8_string_loc
1292
1293Like C<L</is_c9strict_utf8_string>> but stores the location of the failure (in
1294the case of "utf8ness failure") or the location C<s>+C<len> (in the case of
1295"utf8ness success") in the C<ep> pointer.
1296
1297See also C<L</is_c9strict_utf8_string_loclen>>.
1298
1299=cut
1300*/
1301
1302#define is_c9strict_utf8_string_loc(s, len, ep)Perl_is_c9strict_utf8_string_loclen(s, len, ep, 0) \
1303 is_c9strict_utf8_string_loclenPerl_is_c9strict_utf8_string_loclen(s, len, ep, 0)
1304
1305/*
1306
1307=for apidoc is_c9strict_utf8_string_loclen
1308
1309Like C<L</is_c9strict_utf8_string>> but stores the location of the failure (in
1310the case of "utf8ness failure") or the location C<s>+C<len> (in the case of
1311"utf8ness success") in the C<ep> pointer, and the number of UTF-8 encoded
1312characters in the C<el> pointer.
1313
1314See also C<L</is_c9strict_utf8_string_loc>>.
1315
1316=cut
1317*/
1318
1319PERL_STATIC_INLINEstatic __inline__ bool_Bool
1320Perl_is_c9strict_utf8_string_loclen(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el)
1321{
1322 const U8 * first_variant;
1323
1324 PERL_ARGS_ASSERT_IS_C9STRICT_UTF8_STRING_LOCLEN((void)0);
1325
1326 if (len == 0) {
1327 len = strlen((const char *) s);
1328 }
1329
1330 if (is_utf8_invariant_string_locPerl_is_utf8_invariant_string_loc(s, len, &first_variant)) {
1331 if (el)
1332 *el = len;
1333
1334 if (ep) {
1335 *ep = s + len;
1336 }
1337
1338 return TRUE(1);
1339 }
1340
1341 {
1342 const U8* const send = s + len;
1343 const U8* x = first_variant;
1344 STRLEN outlen = first_variant - s;
1345
1346 while (x < send) {
1347 const STRLEN cur_len = isC9_STRICT_UTF8_CHARPerl_isC9_STRICT_UTF8_CHAR(x, send);
1348 if (UNLIKELY(! cur_len)__builtin_expect(((! cur_len) ? (_Bool)1 : (_Bool)0),(0))) {
1349 break;
1350 }
1351 x += cur_len;
1352 outlen++;
1353 }
1354
1355 if (el)
1356 *el = outlen;
1357
1358 if (ep) {
1359 *ep = x;
1360 }
1361
1362 return (x == send);
1363 }
1364}
1365
1366/*
1367
1368=for apidoc is_utf8_string_loc_flags
1369
1370Like C<L</is_utf8_string_flags>> but stores the location of the failure (in the
1371case of "utf8ness failure") or the location C<s>+C<len> (in the case of
1372"utf8ness success") in the C<ep> pointer.
1373
1374See also C<L</is_utf8_string_loclen_flags>>.
1375
1376=cut
1377*/
1378
1379#define is_utf8_string_loc_flags(s, len, ep, flags)Perl_is_utf8_string_loclen_flags(s, len, ep, 0, flags) \
1380 is_utf8_string_loclen_flagsPerl_is_utf8_string_loclen_flags(s, len, ep, 0, flags)
1381
1382
1383/* The above 3 actual functions could have been moved into the more general one
1384 * just below, and made #defines that call it with the right 'flags'. They are
1385 * currently kept separate to increase their chances of getting inlined */
1386
1387/*
1388
1389=for apidoc is_utf8_string_loclen_flags
1390
1391Like C<L</is_utf8_string_flags>> but stores the location of the failure (in the
1392case of "utf8ness failure") or the location C<s>+C<len> (in the case of
1393"utf8ness success") in the C<ep> pointer, and the number of UTF-8
1394encoded characters in the C<el> pointer.
1395
1396See also C<L</is_utf8_string_loc_flags>>.
1397
1398=cut
1399*/
1400
1401PERL_STATIC_INLINEstatic __inline__ bool_Bool
1402Perl_is_utf8_string_loclen_flags(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el, const U32 flags)
1403{
1404 const U8 * first_variant;
1405
1406 PERL_ARGS_ASSERT_IS_UTF8_STRING_LOCLEN_FLAGS((void)0);
1407 assert(0 == (flags & ~(UTF8_DISALLOW_ILLEGAL_INTERCHANGE((void)0)
1408 |UTF8_DISALLOW_PERL_EXTENDED)))((void)0);
1409
1410 if (len == 0) {
1411 len = strlen((const char *) s);
1412 }
1413
1414 if (flags == 0) {
1415 return is_utf8_string_loclenPerl_is_utf8_string_loclen(s, len, ep, el);
1416 }
1417
1418 if ((flags & ~UTF8_DISALLOW_PERL_EXTENDED0x4000)
1419 == UTF8_DISALLOW_ILLEGAL_INTERCHANGE((0x1000|0x0100)|0x0400))
1420 {
1421 return is_strict_utf8_string_loclenPerl_is_strict_utf8_string_loclen(s, len, ep, el);
1422 }
1423
1424 if ((flags & ~UTF8_DISALLOW_PERL_EXTENDED0x4000)
1425 == UTF8_DISALLOW_ILLEGAL_C9_INTERCHANGE(0x1000|0x0100))
1426 {
1427 return is_c9strict_utf8_string_loclenPerl_is_c9strict_utf8_string_loclen(s, len, ep, el);
1428 }
1429
1430 if (is_utf8_invariant_string_locPerl_is_utf8_invariant_string_loc(s, len, &first_variant)) {
1431 if (el)
1432 *el = len;
1433
1434 if (ep) {
1435 *ep = s + len;
1436 }
1437
1438 return TRUE(1);
1439 }
1440
1441 {
1442 const U8* send = s + len;
1443 const U8* x = first_variant;
1444 STRLEN outlen = first_variant - s;
1445
1446 while (x < send) {
1447 const STRLEN cur_len = isUTF8_CHAR_flags(x, send, flags)(__builtin_expect((((send) <= (x)) ? (_Bool)1 : (_Bool)0),
(0)) ? 0 : (((((U64)(((UV) (((*x) | 0) | 0)))) < (((U8) (0xFF
<< 6)) & 0xB0)))) ? 1 : __builtin_expect(((((send)
- (x)) < PL_utf8skip[*(const U8*)(x)]) ? (_Bool)1 : (_Bool
)0),(0)) ? 0 : Perl_is_utf8_char_helper(x, send, flags))
;
1448 if (UNLIKELY(! cur_len)__builtin_expect(((! cur_len) ? (_Bool)1 : (_Bool)0),(0))) {
1449 break;
1450 }
1451 x += cur_len;
1452 outlen++;
1453 }
1454
1455 if (el)
1456 *el = outlen;
1457
1458 if (ep) {
1459 *ep = x;
1460 }
1461
1462 return (x == send);
1463 }
1464}
1465
1466/*
1467=for apidoc utf8_distance
1468
1469Returns the number of UTF-8 characters between the UTF-8 pointers C<a>
1470and C<b>.
1471
1472WARNING: use only if you *know* that the pointers point inside the
1473same UTF-8 buffer.
1474
1475=cut
1476*/
1477
1478PERL_STATIC_INLINEstatic __inline__ IV
1479Perl_utf8_distance(pTHX_ const U8 *a, const U8 *b)
1480{
1481 PERL_ARGS_ASSERT_UTF8_DISTANCE((void)0); ((void)0);
1482
1483 return (a < b) ? -1 * (IV) utf8_length(a, b)Perl_utf8_length( a,b) : (IV) utf8_length(b, a)Perl_utf8_length( b,a);
1484}
1485
1486/*
1487=for apidoc utf8_hop
1488
1489Return the UTF-8 pointer C<s> displaced by C<off> characters, either
1490forward or backward.
1491
1492WARNING: do not use the following unless you *know* C<off> is within
1493the UTF-8 data pointed to by C<s> *and* that on entry C<s> is aligned
1494on the first byte of character or just after the last byte of a character.
1495
1496=cut
1497*/
1498
1499PERL_STATIC_INLINEstatic __inline__ U8 *
1500Perl_utf8_hop(const U8 *s, SSize_tssize_t off)
1501{
1502 PERL_ARGS_ASSERT_UTF8_HOP((void)0);
1503
1504 /* Note: cannot use UTF8_IS_...() too eagerly here since e.g
1505 * the bitops (especially ~) can create illegal UTF-8.
1506 * In other words: in Perl UTF-8 is not just for Unicode. */
1507
1508 if (off >= 0) {
1509 while (off--)
1510 s += UTF8SKIP(s)PL_utf8skip[*(const U8*)(s)];
1511 }
1512 else {
1513 while (off++) {
1514 s--;
1515 while (UTF8_IS_CONTINUATION(*s)( (((( ((U8) ((*s) | 0))) & ((U8) (0xFF << 6))) == (
((U8) (0xFF << 6)) & 0xB0))))
)
1516 s--;
1517 }
1518 }
1519 GCC_DIAG_IGNORE(-Wcast-qual)GCC diagnostic push GCC diagnostic ignored "-Wcast-qual"
1520 return (U8 *)s;
1521 GCC_DIAG_RESTOREGCC diagnostic pop
1522}
1523
1524/*
1525=for apidoc utf8_hop_forward
1526
1527Return the UTF-8 pointer C<s> displaced by up to C<off> characters,
1528forward.
1529
1530C<off> must be non-negative.
1531
1532C<s> must be before or equal to C<end>.
1533
1534When moving forward it will not move beyond C<end>.
1535
1536Will not exceed this limit even if the string is not valid "UTF-8".
1537
1538=cut
1539*/
1540
1541PERL_STATIC_INLINEstatic __inline__ U8 *
1542Perl_utf8_hop_forward(const U8 *s, SSize_tssize_t off, const U8 *end)
1543{
1544 PERL_ARGS_ASSERT_UTF8_HOP_FORWARD((void)0); ((void)0);
1545
1546 /* Note: cannot use UTF8_IS_...() too eagerly here since e.g
1547 * the bitops (especially ~) can create illegal UTF-8.
1548 * In other words: in Perl UTF-8 is not just for Unicode. */
1549
1550 assert(s <= end)((void)0);
1551 assert(off >= 0)((void)0);
1552
1553 while (off--) {
1554 STRLEN skip = UTF8SKIP(s)PL_utf8skip[*(const U8*)(s)];
1555 if ((STRLEN)(end - s) <= skip) {
1556 GCC_DIAG_IGNORE(-Wcast-qual)GCC diagnostic push GCC diagnostic ignored "-Wcast-qual"
1557 return (U8 *)end;
1558 GCC_DIAG_RESTOREGCC diagnostic pop
1559 }
1560 s += skip;
1561 }
1562
1563 GCC_DIAG_IGNORE(-Wcast-qual)GCC diagnostic push GCC diagnostic ignored "-Wcast-qual"
1564 return (U8 *)s;
1565 GCC_DIAG_RESTOREGCC diagnostic pop
1566}
1567
1568/*
1569=for apidoc utf8_hop_back
1570
1571Return the UTF-8 pointer C<s> displaced by up to C<off> characters,
1572backward.
1573
1574C<off> must be non-positive.
1575
1576C<s> must be after or equal to C<start>.
1577
1578When moving backward it will not move before C<start>.
1579
1580Will not exceed this limit even if the string is not valid "UTF-8".
1581
1582=cut
1583*/
1584
1585PERL_STATIC_INLINEstatic __inline__ U8 *
1586Perl_utf8_hop_back(const U8 *s, SSize_tssize_t off, const U8 *start)
1587{
1588 PERL_ARGS_ASSERT_UTF8_HOP_BACK((void)0); ((void)0);
1589
1590 /* Note: cannot use UTF8_IS_...() too eagerly here since e.g
1591 * the bitops (especially ~) can create illegal UTF-8.
1592 * In other words: in Perl UTF-8 is not just for Unicode. */
1593
1594 assert(start <= s)((void)0);
1595 assert(off <= 0)((void)0);
1596
1597 while (off++ && s > start) {
1598 do {
1599 s--;
1600 } while (UTF8_IS_CONTINUATION(*s)( (((( ((U8) ((*s) | 0))) & ((U8) (0xFF << 6))) == (
((U8) (0xFF << 6)) & 0xB0))))
&& s > start);
1601 }
1602
1603 GCC_DIAG_IGNORE(-Wcast-qual)GCC diagnostic push GCC diagnostic ignored "-Wcast-qual"
1604 return (U8 *)s;
1605 GCC_DIAG_RESTOREGCC diagnostic pop
1606}
1607
1608/*
1609=for apidoc utf8_hop_safe
1610
1611Return the UTF-8 pointer C<s> displaced by up to C<off> characters,
1612either forward or backward.
1613
1614When moving backward it will not move before C<start>.
1615
1616When moving forward it will not move beyond C<end>.
1617
1618Will not exceed those limits even if the string is not valid "UTF-8".
1619
1620=cut
1621*/
1622
1623PERL_STATIC_INLINEstatic __inline__ U8 *
1624Perl_utf8_hop_safe(const U8 *s, SSize_tssize_t off, const U8 *start, const U8 *end)
1625{
1626 PERL_ARGS_ASSERT_UTF8_HOP_SAFE((void)0); ((void)0); ((void)0);
1627
1628 /* Note: cannot use UTF8_IS_...() too eagerly here since e.g
1629 * the bitops (especially ~) can create illegal UTF-8.
1630 * In other words: in Perl UTF-8 is not just for Unicode. */
1631
1632 assert(start <= s && s <= end)((void)0);
1633
1634 if (off >= 0) {
1635 return utf8_hop_forwardPerl_utf8_hop_forward(s, off, end);
1636 }
1637 else {
1638 return utf8_hop_backPerl_utf8_hop_back(s, off, start);
1639 }
1640}
1641
1642/*
1643
1644=for apidoc is_utf8_valid_partial_char
1645
1646Returns 0 if the sequence of bytes starting at C<s> and looking no further than
1647S<C<e - 1>> is the UTF-8 encoding, as extended by Perl, for one or more code
1648points. Otherwise, it returns 1 if there exists at least one non-empty
1649sequence of bytes that when appended to sequence C<s>, starting at position
1650C<e> causes the entire sequence to be the well-formed UTF-8 of some code point;
1651otherwise returns 0.
1652
1653In other words this returns TRUE if C<s> points to a partial UTF-8-encoded code
1654point.
1655
1656This is useful when a fixed-length buffer is being tested for being well-formed
1657UTF-8, but the final few bytes in it don't comprise a full character; that is,
1658it is split somewhere in the middle of the final code point's UTF-8
1659representation. (Presumably when the buffer is refreshed with the next chunk
1660of data, the new first bytes will complete the partial code point.) This
1661function is used to verify that the final bytes in the current buffer are in
1662fact the legal beginning of some code point, so that if they aren't, the
1663failure can be signalled without having to wait for the next read.
1664
1665=cut
1666*/
1667#define is_utf8_valid_partial_char(s, e)Perl_is_utf8_valid_partial_char_flags(s, e, 0) \
1668 is_utf8_valid_partial_char_flagsPerl_is_utf8_valid_partial_char_flags(s, e, 0)
1669
1670/*
1671
1672=for apidoc is_utf8_valid_partial_char_flags
1673
1674Like C<L</is_utf8_valid_partial_char>>, it returns a boolean giving whether
1675or not the input is a valid UTF-8 encoded partial character, but it takes an
1676extra parameter, C<flags>, which can further restrict which code points are
1677considered valid.
1678
1679If C<flags> is 0, this behaves identically to
1680C<L</is_utf8_valid_partial_char>>. Otherwise C<flags> can be any combination
1681of the C<UTF8_DISALLOW_I<foo>> flags accepted by C<L</utf8n_to_uvchr>>. If
1682there is any sequence of bytes that can complete the input partial character in
1683such a way that a non-prohibited character is formed, the function returns
1684TRUE; otherwise FALSE. Non character code points cannot be determined based on
1685partial character input. But many of the other possible excluded types can be
1686determined from just the first one or two bytes.
1687
1688=cut
1689 */
1690
1691PERL_STATIC_INLINEstatic __inline__ bool_Bool
1692Perl_is_utf8_valid_partial_char_flags(const U8 * const s, const U8 * const e, const U32 flags)
1693{
1694 PERL_ARGS_ASSERT_IS_UTF8_VALID_PARTIAL_CHAR_FLAGS((void)0); ((void)0);
1695
1696 assert(0 == (flags & ~(UTF8_DISALLOW_ILLEGAL_INTERCHANGE((void)0)
1697 |UTF8_DISALLOW_PERL_EXTENDED)))((void)0);
1698
1699 if (s >= e || s + UTF8SKIP(s)PL_utf8skip[*(const U8*)(s)] <= e) {
1700 return FALSE(0);
1701 }
1702
1703 return cBOOL(is_utf8_char_helper(s, e, flags))((Perl_is_utf8_char_helper(s, e, flags)) ? (_Bool)1 : (_Bool)
0)
;
1704}
1705
1706/*
1707
1708=for apidoc is_utf8_fixed_width_buf_flags
1709
1710Returns TRUE if the fixed-width buffer starting at C<s> with length C<len>
1711is entirely valid UTF-8, subject to the restrictions given by C<flags>;
1712otherwise it returns FALSE.
1713
1714If C<flags> is 0, any well-formed UTF-8, as extended by Perl, is accepted
1715without restriction. If the final few bytes of the buffer do not form a
1716complete code point, this will return TRUE anyway, provided that
1717C<L</is_utf8_valid_partial_char_flags>> returns TRUE for them.
1718
1719If C<flags> in non-zero, it can be any combination of the
1720C<UTF8_DISALLOW_I<foo>> flags accepted by C<L</utf8n_to_uvchr>>, and with the
1721same meanings.
1722
1723This function differs from C<L</is_utf8_string_flags>> only in that the latter
1724returns FALSE if the final few bytes of the string don't form a complete code
1725point.
1726
1727=cut
1728 */
1729#define is_utf8_fixed_width_buf_flags(s, len, flags)Perl_is_utf8_fixed_width_buf_loclen_flags(s, len, 0, 0, flags
)
\
1730 is_utf8_fixed_width_buf_loclen_flagsPerl_is_utf8_fixed_width_buf_loclen_flags(s, len, 0, 0, flags)
1731
1732/*
1733
1734=for apidoc is_utf8_fixed_width_buf_loc_flags
1735
1736Like C<L</is_utf8_fixed_width_buf_flags>> but stores the location of the
1737failure in the C<ep> pointer. If the function returns TRUE, C<*ep> will point
1738to the beginning of any partial character at the end of the buffer; if there is
1739no partial character C<*ep> will contain C<s>+C<len>.
1740
1741See also C<L</is_utf8_fixed_width_buf_loclen_flags>>.
1742
1743=cut
1744*/
1745
1746#define is_utf8_fixed_width_buf_loc_flags(s, len, loc, flags)Perl_is_utf8_fixed_width_buf_loclen_flags(s, len, loc, 0, flags
)
\
1747 is_utf8_fixed_width_buf_loclen_flagsPerl_is_utf8_fixed_width_buf_loclen_flags(s, len, loc, 0, flags)
1748
1749/*
1750
1751=for apidoc is_utf8_fixed_width_buf_loclen_flags
1752
1753Like C<L</is_utf8_fixed_width_buf_loc_flags>> but stores the number of
1754complete, valid characters found in the C<el> pointer.
1755
1756=cut
1757*/
1758
1759PERL_STATIC_INLINEstatic __inline__ bool_Bool
1760Perl_is_utf8_fixed_width_buf_loclen_flags(const U8 * const s,
1761 STRLEN len,
1762 const U8 **ep,
1763 STRLEN *el,
1764 const U32 flags)
1765{
1766 const U8 * maybe_partial;
1767
1768 PERL_ARGS_ASSERT_IS_UTF8_FIXED_WIDTH_BUF_LOCLEN_FLAGS((void)0);
1769
1770 if (! ep) {
1771 ep = &maybe_partial;
1772 }
1773
1774 /* If it's entirely valid, return that; otherwise see if the only error is
1775 * that the final few bytes are for a partial character */
1776 return is_utf8_string_loclen_flagsPerl_is_utf8_string_loclen_flags(s, len, ep, el, flags)
1777 || is_utf8_valid_partial_char_flagsPerl_is_utf8_valid_partial_char_flags(*ep, s + len, flags);
1778}
1779
1780PERL_STATIC_INLINEstatic __inline__ UV
1781Perl_utf8n_to_uvchr_msgs(const U8 *s,
1782 STRLEN curlen,
1783 STRLEN *retlen,
1784 const U32 flags,
1785 U32 * errors,
1786 AV ** msgs)
1787{
1788 /* This is the inlined portion of utf8n_to_uvchr_msgs. It handles the
1789 * simple cases, and, if necessary calls a helper function to deal with the
1790 * more complex ones. Almost all well-formed non-problematic code points
1791 * are considered simple, so that it's unlikely that the helper function
1792 * will need to be called.
1793 *
1794 * This is an adaptation of the tables and algorithm given in
1795 * https://bjoern.hoehrmann.de/utf-8/decoder/dfa/, which provides
1796 * comprehensive documentation of the original version. A copyright notice
1797 * for the original version is given at the beginning of this file. The
1798 * Perl adapation is documented at the definition of PL_strict_utf8_dfa_tab[].
1799 */
1800
1801 const U8 * const s0 = s;
1802 const U8 * send = s0 + curlen;
1803 UV uv = 0; /* The 0 silences some stupid compilers */
1804 UV state = 0;
1805
1806 PERL_ARGS_ASSERT_UTF8N_TO_UVCHR_MSGS((void)0);
1807
1808 /* This dfa is fast. If it accepts the input, it was for a well-formed,
1809 * non-problematic code point, which can be returned immediately.
1810 * Otherwise we call a helper function to figure out the more complicated
1811 * cases. */
1812
1813 while (s < send && LIKELY(state != 1)__builtin_expect(((state != 1) ? (_Bool)1 : (_Bool)0),(1))) {
1814 UV type = PL_strict_utf8_dfa_tab[*s];
1815
1816 uv = (state == 0)
1817 ? ((0xff >> type) & NATIVE_UTF8_TO_I8(*s)( ((U8) ((*s) | 0))))
1818 : UTF8_ACCUMULATE(uv, *s)( ((uv) << 6) | ((( ((U8) ((*s) | 0)))) & ((U8) ((1U
<< 6) - 1))))
;
1819 state = PL_strict_utf8_dfa_tab[256 + state + type];
1820
1821 if (state != 0) {
1822 s++;
1823 continue;
1824 }
1825
1826 if (retlen) {
1827 *retlen = s - s0 + 1;
1828 }
1829 if (errors) {
1830 *errors = 0;
1831 }
1832 if (msgs) {
1833 *msgs = NULL((void*)0);
1834 }
1835
1836 return UNI_TO_NATIVE(uv)((UV) ((uv) | 0));
1837 }
1838
1839 /* Here is potentially problematic. Use the full mechanism */
1840 return _utf8n_to_uvchr_msgs_helperPerl__utf8n_to_uvchr_msgs_helper(s0, curlen, retlen, flags, errors, msgs);
1841}
1842
1843PERL_STATIC_INLINEstatic __inline__ UV
1844Perl_utf8_to_uvchr_buf_helper(pTHX_ const U8 *s, const U8 *send, STRLEN *retlen)
1845{
1846 PERL_ARGS_ASSERT_UTF8_TO_UVCHR_BUF_HELPER((void)0); ((void)0);
1847
1848 assert(s < send)((void)0);
1849
1850 if (! ckWARN_d(WARN_UTF8)Perl_ckwarn_d( (44 ))) {
1851
1852 /* EMPTY is not really allowed, and asserts on debugging builds. But
1853 * on non-debugging we have to deal with it, and this causes it to
1854 * return the REPLACEMENT CHARACTER, as the documentation indicates */
1855 return utf8n_to_uvchr(s, send - s, retlen,Perl_utf8n_to_uvchr_msgs(s, send - s, retlen, (( 0x0002 |0x0004
|0x0008 |0x0010 |0x0080) | 0x0001), 0, 0)
1856 (UTF8_ALLOW_ANY | UTF8_ALLOW_EMPTY))Perl_utf8n_to_uvchr_msgs(s, send - s, retlen, (( 0x0002 |0x0004
|0x0008 |0x0010 |0x0080) | 0x0001), 0, 0)
;
1857 }
1858 else {
1859 UV ret = utf8n_to_uvchr(s, send - s, retlen, 0)Perl_utf8n_to_uvchr_msgs(s, send - s, retlen, 0, 0, 0);
1860 if (retlen && ret == 0 && *s != '\0') {
1861 *retlen = (STRLEN) -1;
1862 }
1863
1864 return ret;
1865 }
1866}
1867
1868/* ------------------------------- perl.h ----------------------------- */
1869
1870/*
1871=head1 Miscellaneous Functions
1872
1873=for apidoc is_safe_syscall
1874
1875Test that the given C<pv> (with length C<len>) doesn't contain any internal
1876C<NUL> characters.
1877If it does, set C<errno> to C<ENOENT>, optionally warn using the C<syscalls>
1878category, and return FALSE.
1879
1880Return TRUE if the name is safe.
1881
1882C<what> and C<op_name> are used in any warning.
1883
1884Used by the C<IS_SAFE_SYSCALL()> macro.
1885
1886=cut
1887*/
1888
1889PERL_STATIC_INLINEstatic __inline__ bool_Bool
1890Perl_is_safe_syscall(pTHX_ const char *pv, STRLEN len, const char *what, const char *op_name)
1891{
1892 /* While the Windows CE API provides only UCS-16 (or UTF-16) APIs
1893 * perl itself uses xce*() functions which accept 8-bit strings.
1894 */
1895
1896 PERL_ARGS_ASSERT_IS_SAFE_SYSCALL((void)0); ((void)0); ((void)0);
1897
1898 if (len > 1) {
1899 char *null_at;
1900 if (UNLIKELY((null_at = (char *)memchr(pv, 0, len-1)) != NULL)__builtin_expect((((null_at = (char *)memchr(pv, 0, len-1)) !=
((void*)0)) ? (_Bool)1 : (_Bool)0),(0))
) {
1901 SETERRNO(ENOENT, LIB_INVARG)((*__errno()) = (2));
1902 Perl_ck_warner(aTHX_ packWARN(WARN_SYSCALLS)(57 ),
1903 "Invalid \\0 character in %s for %s: %s\\0%s",
1904 what, op_name, pv, null_at+1);
1905 return FALSE(0);
1906 }
1907 }
1908
1909 return TRUE(1);
1910}
1911
1912/*
1913
1914Return true if the supplied filename has a newline character
1915immediately before the first (hopefully only) NUL.
1916
1917My original look at this incorrectly used the len from SvPV(), but
1918that's incorrect, since we allow for a NUL in pv[len-1].
1919
1920So instead, strlen() and work from there.
1921
1922This allow for the user reading a filename, forgetting to chomp it,
1923then calling:
1924
1925 open my $foo, "$file\0";
1926
1927*/
1928
1929#ifdef PERL_CORE
1930
1931PERL_STATIC_INLINEstatic __inline__ bool_Bool
1932S_should_warn_nl(const char *pv)
1933{
1934 STRLEN len;
1935
1936 PERL_ARGS_ASSERT_SHOULD_WARN_NL;
1937
1938 len = strlen(pv);
1939
1940 return len > 0 && pv[len-1] == '\n';
1941}
1942
1943#endif
1944
1945#if defined(PERL_IN_PP_C) || defined(PERL_IN_PP_HOT_C)
1946
1947PERL_STATIC_INLINEstatic __inline__ bool_Bool
1948S_lossless_NV_to_IV(const NV nv, IV *ivp)
1949{
1950 /* This function determines if the input NV 'nv' may be converted without
1951 * loss of data to an IV. If not, it returns FALSE taking no other action.
1952 * But if it is possible, it does the conversion, returning TRUE, and
1953 * storing the converted result in '*ivp' */
1954
1955 PERL_ARGS_ASSERT_LOSSLESS_NV_TO_IV;
1956
1957# if defined(Perl_isnan)
1958
1959 if (UNLIKELY(Perl_isnan(nv))__builtin_expect(((((sizeof (nv) == sizeof (float)) ? __isnanf
(nv) : (sizeof (nv) == sizeof (double)) ? __isnan(nv) : __isnanl
(nv))) ? (_Bool)1 : (_Bool)0),(0))
) {
1960 return FALSE(0);
1961 }
1962
1963# endif
1964
1965 if (UNLIKELY(nv < IV_MIN)__builtin_expect(((nv < (-((IV) ((~(UV)0) >> 1)) - (
(3 & -1) == 3))) ? (_Bool)1 : (_Bool)0),(0))
|| UNLIKELY(nv > IV_MAX)__builtin_expect(((nv > ((IV) ((~(UV)0) >> 1))) ? (_Bool
)1 : (_Bool)0),(0))
) {
1966 return FALSE(0);
1967 }
1968
1969 if ((IV) nv != nv) {
1970 return FALSE(0);
1971 }
1972
1973 *ivp = (IV) nv;
1974 return TRUE(1);
1975}
1976
1977#endif
1978
1979/* ------------------ regcomp.c, toke.c ------------ */
1980
1981#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_TOKE_C)
1982
1983/*
1984 - regcurly - a little FSA that accepts {\d+,?\d*}
1985 Pulled from reg.c.
1986 */
1987PERL_STATIC_INLINEstatic __inline__ bool_Bool
1988S_regcurly(const char *s)
1989{
1990 PERL_ARGS_ASSERT_REGCURLY;
1991
1992 if (*s++ != '{')
1993 return FALSE(0);
1994 if (!isDIGIT(*s)( ( (sizeof(*s) == sizeof(U8)) ? ( (((U64) (((((U8) (*s)))) -
((('0')) | 0))) <= (((U64) (((('9') - ('0'))) | 0))))) : (
sizeof(*s) == sizeof(U32)) ? ( (((U64) (((((U32) (*s)))) - ((
('0')) | 0))) <= (((U64) (((('9') - ('0'))) | 0))))) : ( (
(((U64) (((((U64) (*s)))) - ((('0')) | 0))) <= (((U64) ((
(('9') - ('0'))) | 0))))))))
)
1995 return FALSE(0);
1996 while (isDIGIT(*s)( ( (sizeof(*s) == sizeof(U8)) ? ( (((U64) (((((U8) (*s)))) -
((('0')) | 0))) <= (((U64) (((('9') - ('0'))) | 0))))) : (
sizeof(*s) == sizeof(U32)) ? ( (((U64) (((((U32) (*s)))) - ((
('0')) | 0))) <= (((U64) (((('9') - ('0'))) | 0))))) : ( (
(((U64) (((((U64) (*s)))) - ((('0')) | 0))) <= (((U64) ((
(('9') - ('0'))) | 0))))))))
)
1997 s++;
1998 if (*s == ',') {
1999 s++;
2000 while (isDIGIT(*s)( ( (sizeof(*s) == sizeof(U8)) ? ( (((U64) (((((U8) (*s)))) -
((('0')) | 0))) <= (((U64) (((('9') - ('0'))) | 0))))) : (
sizeof(*s) == sizeof(U32)) ? ( (((U64) (((((U32) (*s)))) - ((
('0')) | 0))) <= (((U64) (((('9') - ('0'))) | 0))))) : ( (
(((U64) (((((U64) (*s)))) - ((('0')) | 0))) <= (((U64) ((
(('9') - ('0'))) | 0))))))))
)
2001 s++;
2002 }
2003
2004 return *s == '}';
2005}
2006
2007#endif
2008
2009/* ------------------ pp.c, regcomp.c, toke.c, universal.c ------------ */
2010
2011#if defined(PERL_IN_PP_C) || defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_TOKE_C) || defined(PERL_IN_UNIVERSAL_C)
2012
2013#define MAX_CHARSET_NAME_LENGTH 2
2014
2015PERL_STATIC_INLINEstatic __inline__ const char *
2016S_get_regex_charset_name(const U32 flags, STRLEN* const lenp)
2017{
2018 PERL_ARGS_ASSERT_GET_REGEX_CHARSET_NAME;
2019
2020 /* Returns a string that corresponds to the name of the regex character set
2021 * given by 'flags', and *lenp is set the length of that string, which
2022 * cannot exceed MAX_CHARSET_NAME_LENGTH characters */
2023
2024 *lenp = 1;
2025 switch (get_regex_charset(flags)) {
2026 case REGEX_DEPENDS_CHARSET: return DEPENDS_PAT_MODS"d";
2027 case REGEX_LOCALE_CHARSET: return LOCALE_PAT_MODS"l";
2028 case REGEX_UNICODE_CHARSET: return UNICODE_PAT_MODS"u";
2029 case REGEX_ASCII_RESTRICTED_CHARSET: return ASCII_RESTRICT_PAT_MODS"a";
2030 case REGEX_ASCII_MORE_RESTRICTED_CHARSET:
2031 *lenp = 2;
2032 return ASCII_MORE_RESTRICT_PAT_MODS"aa";
2033 }
2034 /* The NOT_REACHED; hides an assert() which has a rather complex
2035 * definition in perl.h. */
2036 NOT_REACHED((!"UNREACHABLE") ? (void) 0 : __builtin_unreachable()); /* NOTREACHED */
2037 return "?"; /* Unknown */
2038}
2039
2040#endif
2041
2042/*
2043
2044Return false if any get magic is on the SV other than taint magic.
2045
2046*/
2047
2048PERL_STATIC_INLINEstatic __inline__ bool_Bool
2049Perl_sv_only_taint_gmagic(SV *sv)
2050{
2051 MAGIC *mg = SvMAGIC(sv)((XPVMG*) (sv)->sv_any)->xmg_u.xmg_magic;
2052
2053 PERL_ARGS_ASSERT_SV_ONLY_TAINT_GMAGIC((void)0);
2054
2055 while (mg) {
2056 if (mg->mg_type != PERL_MAGIC_taint't'
2057 && !(mg->mg_flags & MGf_GSKIP4)
2058 && mg->mg_virtual->svt_get) {
2059 return FALSE(0);
2060 }
2061 mg = mg->mg_moremagic;
2062 }
2063
2064 return TRUE(1);
2065}
2066
2067/* ------------------ cop.h ------------------------------------------- */
2068
2069/* implement GIMME_V() macro */
2070
2071PERL_STATIC_INLINEstatic __inline__ U8
2072Perl_gimme_V(pTHXvoid)
2073{
2074 I32 cxix;
2075 U8 gimme = (PL_op->op_flags & OPf_WANT3);
2076
2077 if (gimme)
2078 return gimme;
2079 cxix = PL_curstackinfo->si_cxsubix;
2080 if (cxix < 0)
2081 return G_VOID1;
2082 assert(cxstack[cxix].blk_gimme & G_WANT)((void)0);
2083 return (cxstack(PL_curstackinfo->si_cxstack)[cxix].blk_gimmecx_u.cx_blk.blku_gimme & G_WANT3);
2084}
2085
2086
2087/* Enter a block. Push a new base context and return its address. */
2088
2089PERL_STATIC_INLINEstatic __inline__ PERL_CONTEXT *
2090Perl_cx_pushblock(pTHX_ U8 type, U8 gimme, SV** sp, I32 saveix)
2091{
2092 PERL_CONTEXT * cx;
2093
2094 PERL_ARGS_ASSERT_CX_PUSHBLOCK((void)0);
2095
2096 CXINC((PL_curstackinfo->si_cxix) < (PL_curstackinfo->si_cxmax
) ? ++(PL_curstackinfo->si_cxix) : ((PL_curstackinfo->si_cxix
) = Perl_cxinc()))
;
2097 cx = CX_CUR()(&(PL_curstackinfo->si_cxstack)[(PL_curstackinfo->si_cxix
)])
;
2098 cx->cx_typecx_u.cx_subst.sbu_type = type;
2099 cx->blk_gimmecx_u.cx_blk.blku_gimme = gimme;
2100 cx->blk_oldsaveixcx_u.cx_blk.blku_oldsaveix = saveix;
2101 cx->blk_oldspcx_u.cx_blk.blku_oldsp = (I32)(sp - PL_stack_base);
2102 cx->blk_oldcopcx_u.cx_blk.blku_oldcop = PL_curcop;
2103 cx->blk_oldmarkspcx_u.cx_blk.blku_oldmarksp = (I32)(PL_markstack_ptr - PL_markstack);
2104 cx->blk_oldscopespcx_u.cx_blk.blku_oldscopesp = PL_scopestack_ix;
2105 cx->blk_oldpmcx_u.cx_blk.blku_oldpm = PL_curpm;
2106 cx->blk_old_tmpsfloorcx_u.cx_blk.blku_old_tmpsfloor = PL_tmps_floor;
2107
2108 PL_tmps_floor = PL_tmps_ix;
2109 CX_DEBUG(cx, "PUSH");;
2110 return cx;
2111}
2112
2113
2114/* Exit a block (RETURN and LAST). */
2115
2116PERL_STATIC_INLINEstatic __inline__ void
2117Perl_cx_popblock(pTHX_ PERL_CONTEXT *cx)
2118{
2119 PERL_ARGS_ASSERT_CX_POPBLOCK((void)0);
2120
2121 CX_DEBUG(cx, "POP");;
2122 /* these 3 are common to cx_popblock and cx_topblock */
2123 PL_markstack_ptr = PL_markstack + cx->blk_oldmarkspcx_u.cx_blk.blku_oldmarksp;
2124 PL_scopestack_ix = cx->blk_oldscopespcx_u.cx_blk.blku_oldscopesp;
2125 PL_curpm = cx->blk_oldpmcx_u.cx_blk.blku_oldpm;
2126
2127 /* LEAVE_SCOPE() should have made this true. /(?{})/ cheats
2128 * and leaves a CX entry lying around for repeated use, so
2129 * skip for multicall */ \
2130 assert( (CxTYPE(cx) == CXt_SUB && CxMULTICALL(cx))((void)0)
2131 || PL_savestack_ix == cx->blk_oldsaveix)((void)0);
2132 PL_curcop = cx->blk_oldcopcx_u.cx_blk.blku_oldcop;
2133 PL_tmps_floor = cx->blk_old_tmpsfloorcx_u.cx_blk.blku_old_tmpsfloor;
2134}
2135
2136/* Continue a block elsewhere (e.g. NEXT, REDO, GOTO).
2137 * Whereas cx_popblock() restores the state to the point just before
2138 * cx_pushblock() was called, cx_topblock() restores it to the point just
2139 * *after* cx_pushblock() was called. */
2140
2141PERL_STATIC_INLINEstatic __inline__ void
2142Perl_cx_topblock(pTHX_ PERL_CONTEXT *cx)
2143{
2144 PERL_ARGS_ASSERT_CX_TOPBLOCK((void)0);
2145
2146 CX_DEBUG(cx, "TOP");;
2147 /* these 3 are common to cx_popblock and cx_topblock */
2148 PL_markstack_ptr = PL_markstack + cx->blk_oldmarkspcx_u.cx_blk.blku_oldmarksp;
2149 PL_scopestack_ix = cx->blk_oldscopespcx_u.cx_blk.blku_oldscopesp;
2150 PL_curpm = cx->blk_oldpmcx_u.cx_blk.blku_oldpm;
2151
2152 PL_stack_sp = PL_stack_base + cx->blk_oldspcx_u.cx_blk.blku_oldsp;
2153}
2154
2155
2156PERL_STATIC_INLINEstatic __inline__ void
2157Perl_cx_pushsub(pTHX_ PERL_CONTEXT *cx, CV *cv, OP *retop, bool_Bool hasargs)
2158{
2159 U8 phlags = CX_PUSHSUB_GET_LVALUE_MASK(Perl_was_lvalue_sub)( (PL_op->op_flags & 3) ? (0x80|0x01) : !(PL_op->op_private
& (0x80|0x01)) ? 0 : (U8)Perl_was_lvalue_sub() )
;
2160
2161 PERL_ARGS_ASSERT_CX_PUSHSUB((void)0); ((void)0);
2162
2163 PERL_DTRACE_PROBE_ENTRY(cv);
2164 cx->blk_subcx_u.cx_blk.blk_u.blku_sub.old_cxsubix = PL_curstackinfo->si_cxsubix;
2165 PL_curstackinfo->si_cxsubix = cx - PL_curstackinfo->si_cxstack;
2166 cx->blk_subcx_u.cx_blk.blk_u.blku_sub.cv = cv;
2167 cx->blk_subcx_u.cx_blk.blk_u.blku_sub.olddepth = CvDEPTH(cv)(*Perl_CvDEPTH((const CV *)cv));
2168 cx->blk_subcx_u.cx_blk.blk_u.blku_sub.prevcomppad = PL_comppad;
2169 cx->cx_typecx_u.cx_subst.sbu_type |= (hasargs) ? CXp_HASARGS0x20 : 0;
2170 cx->blk_subcx_u.cx_blk.blk_u.blku_sub.retop = retop;
2171 SvREFCNT_inc_simple_void_NN(cv)(void)(++(((SV *)({ void *_p = (cv); _p; })))->sv_refcnt);
2172 cx->blk_u16cx_u.cx_blk.blku_u16 = PL_op->op_private & (phlags|OPpDEREF0x30);
2173}
2174
2175
2176/* subsets of cx_popsub() */
2177
2178PERL_STATIC_INLINEstatic __inline__ void
2179Perl_cx_popsub_common(pTHX_ PERL_CONTEXT *cx)
2180{
2181 CV *cv;
2182
2183 PERL_ARGS_ASSERT_CX_POPSUB_COMMON((void)0);
2184 assert(CxTYPE(cx) == CXt_SUB)((void)0);
2185
2186 PL_comppad = cx->blk_subcx_u.cx_blk.blk_u.blku_sub.prevcomppad;
2187 PL_curpad = LIKELY(PL_comppad)__builtin_expect(((PL_comppad) ? (_Bool)1 : (_Bool)0),(1)) ? AvARRAY(PL_comppad)((PL_comppad)->sv_u.svu_array) : NULL((void*)0);
2188 cv = cx->blk_subcx_u.cx_blk.blk_u.blku_sub.cv;
2189 CvDEPTH(cv)(*Perl_CvDEPTH((const CV *)cv)) = cx->blk_subcx_u.cx_blk.blk_u.blku_sub.olddepth;
2190 cx->blk_subcx_u.cx_blk.blk_u.blku_sub.cv = NULL((void*)0);
2191 SvREFCNT_dec(cv)Perl_SvREFCNT_dec( ((SV *)({ void *_p = (cv); _p; })));
2192 PL_curstackinfo->si_cxsubix = cx->blk_subcx_u.cx_blk.blk_u.blku_sub.old_cxsubix;
2193}
2194
2195
2196/* handle the @_ part of leaving a sub */
2197
2198PERL_STATIC_INLINEstatic __inline__ void
2199Perl_cx_popsub_args(pTHX_ PERL_CONTEXT *cx)
2200{
2201 AV *av;
2202
2203 PERL_ARGS_ASSERT_CX_POPSUB_ARGS((void)0);
2204 assert(CxTYPE(cx) == CXt_SUB)((void)0);
2205 assert(AvARRAY(MUTABLE_AV(((void)0)
2206 PadlistARRAY(CvPADLIST(cx->blk_sub.cv))[((void)0)
2207 CvDEPTH(cx->blk_sub.cv)])) == PL_curpad)((void)0);
2208
2209 CX_POP_SAVEARRAY(cx)do { AV *cx_pop_savearray_av = ((0+(PL_defgv)->sv_u.svu_gp
)->gp_av); ((0+(PL_defgv)->sv_u.svu_gp)->gp_av) = cx
->cx_u.cx_blk.blk_u.blku_sub.savearray; cx->cx_u.cx_blk
.blk_u.blku_sub.savearray = ((void*)0); Perl_SvREFCNT_dec( ((
SV *)({ void *_p = (cx_pop_savearray_av); _p; }))); } while (
0)
;
2210 av = MUTABLE_AV(PAD_SVl(0))((AV *)({ void *_p = ((PL_curpad[0])); _p; }));
2211 if (UNLIKELY(AvREAL(av))__builtin_expect(((((av)->sv_flags & 0x40000000)) ? (_Bool
)1 : (_Bool)0),(0))
)
2212 /* abandon @_ if it got reified */
2213 clear_defarray(av, 0)Perl_clear_defarray( av,0);
2214 else {
2215 CLEAR_ARGARRAY(av)do { ((XPVAV*) (av)->sv_any)->xav_max += ((av)->sv_u
.svu_array) - ((XPVAV*) (av)->sv_any)->xav_alloc; ((av)
->sv_u.svu_array) = ((XPVAV*) (av)->sv_any)->xav_alloc
; ((XPVAV*) (av)->sv_any)->xav_fill = -1; } while (0)
;
2216 }
2217}
2218
2219
2220PERL_STATIC_INLINEstatic __inline__ void
2221Perl_cx_popsub(pTHX_ PERL_CONTEXT *cx)
2222{
2223 PERL_ARGS_ASSERT_CX_POPSUB((void)0);
2224 assert(CxTYPE(cx) == CXt_SUB)((void)0);
2225
2226 PERL_DTRACE_PROBE_RETURN(cx->blk_sub.cv);
2227
2228 if (CxHASARGS(cx)(((cx)->cx_u.cx_subst.sbu_type & 0x20) == 0x20))
2229 cx_popsub_args(cx)Perl_cx_popsub_args( cx);
2230 cx_popsub_common(cx)Perl_cx_popsub_common( cx);
2231}
2232
2233
2234PERL_STATIC_INLINEstatic __inline__ void
2235Perl_cx_pushformat(pTHX_ PERL_CONTEXT *cx, CV *cv, OP *retop, GV *gv)
2236{
2237 PERL_ARGS_ASSERT_CX_PUSHFORMAT((void)0); ((void)0);
2238
2239 cx->blk_formatcx_u.cx_blk.blk_u.blku_format.old_cxsubix = PL_curstackinfo->si_cxsubix;
2240 PL_curstackinfo->si_cxsubix= cx - PL_curstackinfo->si_cxstack;
2241 cx->blk_formatcx_u.cx_blk.blk_u.blku_format.cv = cv;
2242 cx->blk_formatcx_u.cx_blk.blk_u.blku_format.retop = retop;
2243 cx->blk_formatcx_u.cx_blk.blk_u.blku_format.gv = gv;
2244 cx->blk_formatcx_u.cx_blk.blk_u.blku_format.dfoutgv = PL_defoutgv;
2245 cx->blk_formatcx_u.cx_blk.blk_u.blku_format.prevcomppad = PL_comppad;
2246 cx->blk_u16cx_u.cx_blk.blku_u16 = 0;
2247
2248 SvREFCNT_inc_simple_void_NN(cv)(void)(++(((SV *)({ void *_p = (cv); _p; })))->sv_refcnt);
2249 CvDEPTH(cv)(*Perl_CvDEPTH((const CV *)cv))++;
2250 SvREFCNT_inc_void(cx->blk_format.dfoutgv)Perl_SvREFCNT_inc_void(((SV *)({ void *_p = (cx->cx_u.cx_blk
.blk_u.blku_format.dfoutgv); _p; })))
;
2251}
2252
2253
2254PERL_STATIC_INLINEstatic __inline__ void
2255Perl_cx_popformat(pTHX_ PERL_CONTEXT *cx)
2256{
2257 CV *cv;
2258 GV *dfout;
2259
2260 PERL_ARGS_ASSERT_CX_POPFORMAT((void)0);
2261 assert(CxTYPE(cx) == CXt_FORMAT)((void)0);
2262
2263 dfout = cx->blk_formatcx_u.cx_blk.blk_u.blku_format.dfoutgv;
2264 setdefout(dfout)Perl_setdefout( dfout);
2265 cx->blk_formatcx_u.cx_blk.blk_u.blku_format.dfoutgv = NULL((void*)0);
2266 SvREFCNT_dec_NN(dfout)Perl_SvREFCNT_dec_NN( ((SV *)({ void *_p = (dfout); _p; })));
2267
2268 PL_comppad = cx->blk_formatcx_u.cx_blk.blk_u.blku_format.prevcomppad;
2269 PL_curpad = LIKELY(PL_comppad)__builtin_expect(((PL_comppad) ? (_Bool)1 : (_Bool)0),(1)) ? AvARRAY(PL_comppad)((PL_comppad)->sv_u.svu_array) : NULL((void*)0);
2270 cv = cx->blk_formatcx_u.cx_blk.blk_u.blku_format.cv;
2271 cx->blk_formatcx_u.cx_blk.blk_u.blku_format.cv = NULL((void*)0);
2272 --CvDEPTH(cv)(*Perl_CvDEPTH((const CV *)cv));
2273 SvREFCNT_dec_NN(cv)Perl_SvREFCNT_dec_NN( ((SV *)({ void *_p = (cv); _p; })));
2274 PL_curstackinfo->si_cxsubix = cx->blk_formatcx_u.cx_blk.blk_u.blku_format.old_cxsubix;
2275}
2276
2277
2278PERL_STATIC_INLINEstatic __inline__ void
2279Perl_cx_pusheval(pTHX_ PERL_CONTEXT *cx, OP *retop, SV *namesv)
2280{
2281 PERL_ARGS_ASSERT_CX_PUSHEVAL((void)0);
2282
2283 cx->blk_evalcx_u.cx_blk.blk_u.blku_eval.old_cxsubix = PL_curstackinfo->si_cxsubix;
2284 PL_curstackinfo->si_cxsubix= cx - PL_curstackinfo->si_cxstack;
2285 cx->blk_evalcx_u.cx_blk.blk_u.blku_eval.retop = retop;
2286 cx->blk_evalcx_u.cx_blk.blk_u.blku_eval.old_namesv = namesv;
2287 cx->blk_evalcx_u.cx_blk.blk_u.blku_eval.old_eval_root = PL_eval_root;
2288 cx->blk_evalcx_u.cx_blk.blk_u.blku_eval.cur_text = PL_parser ? PL_parser->linestr : NULL((void*)0);
2289 cx->blk_evalcx_u.cx_blk.blk_u.blku_eval.cv = NULL((void*)0); /* later set by doeval_compile() */
2290 cx->blk_evalcx_u.cx_blk.blk_u.blku_eval.cur_top_env = PL_top_env;
2291
2292 assert(!(PL_in_eval & ~ 0x3F))((void)0);
2293 assert(!(PL_op->op_type & ~0x1FF))((void)0);
2294 cx->blk_u16cx_u.cx_blk.blku_u16 = (PL_in_eval & 0x3F) | ((U16)PL_op->op_type << 7);
2295}
2296
2297
2298PERL_STATIC_INLINEstatic __inline__ void
2299Perl_cx_popeval(pTHX_ PERL_CONTEXT *cx)
2300{
2301 SV *sv;
2302
2303 PERL_ARGS_ASSERT_CX_POPEVAL((void)0);
2304 assert(CxTYPE(cx) == CXt_EVAL)((void)0);
2305
2306 PL_in_eval = CxOLD_IN_EVAL(cx)(((cx)->cx_u.cx_blk.blku_u16) & 0x3F);
2307 assert(!(PL_in_eval & 0xc0))((void)0);
2308 PL_eval_root = cx->blk_evalcx_u.cx_blk.blk_u.blku_eval.old_eval_root;
2309 sv = cx->blk_evalcx_u.cx_blk.blk_u.blku_eval.cur_text;
2310 if (sv && CxEVAL_TXT_REFCNTED(cx)(((cx)->cx_u.cx_blk.blku_u16) & 0x40)) {
2311 cx->blk_evalcx_u.cx_blk.blk_u.blku_eval.cur_text = NULL((void*)0);
2312 SvREFCNT_dec_NN(sv)Perl_SvREFCNT_dec_NN( ((SV *)({ void *_p = (sv); _p; })));
2313 }
2314
2315 sv = cx->blk_evalcx_u.cx_blk.blk_u.blku_eval.old_namesv;
2316 if (sv) {
2317 cx->blk_evalcx_u.cx_blk.blk_u.blku_eval.old_namesv = NULL((void*)0);
2318 SvREFCNT_dec_NN(sv)Perl_SvREFCNT_dec_NN( ((SV *)({ void *_p = (sv); _p; })));
2319 }
2320 PL_curstackinfo->si_cxsubix = cx->blk_evalcx_u.cx_blk.blk_u.blku_eval.old_cxsubix;
2321}
2322
2323
2324/* push a plain loop, i.e.
2325 * { block }
2326 * while (cond) { block }
2327 * for (init;cond;continue) { block }
2328 * This loop can be last/redo'ed etc.
2329 */
2330
2331PERL_STATIC_INLINEstatic __inline__ void
2332Perl_cx_pushloop_plain(pTHX_ PERL_CONTEXT *cx)
2333{
2334 PERL_ARGS_ASSERT_CX_PUSHLOOP_PLAIN((void)0);
2335 cx->blk_loopcx_u.cx_blk.blk_u.blku_loop.my_op = cLOOP((LOOP*)(PL_op));
2336}
2337
2338
2339/* push a true for loop, i.e.
2340 * for var (list) { block }
2341 */
2342
2343PERL_STATIC_INLINEstatic __inline__ void
2344Perl_cx_pushloop_for(pTHX_ PERL_CONTEXT *cx, void *itervarp, SV* itersave)
2345{
2346 PERL_ARGS_ASSERT_CX_PUSHLOOP_FOR((void)0); ((void)0);
2347
2348 /* this one line is common with cx_pushloop_plain */
2349 cx->blk_loopcx_u.cx_blk.blk_u.blku_loop.my_op = cLOOP((LOOP*)(PL_op));
2350
2351 cx->blk_loopcx_u.cx_blk.blk_u.blku_loop.itervar_u.svp = (SV**)itervarp;
2352 cx->blk_loopcx_u.cx_blk.blk_u.blku_loop.itersave = itersave;
2353#ifdef USE_ITHREADS
2354 cx->blk_loopcx_u.cx_blk.blk_u.blku_loop.oldcomppad = PL_comppad;
2355#endif
2356}
2357
2358
2359/* pop all loop types, including plain */
2360
2361PERL_STATIC_INLINEstatic __inline__ void
2362Perl_cx_poploop(pTHX_ PERL_CONTEXT *cx)
2363{
2364 PERL_ARGS_ASSERT_CX_POPLOOP((void)0);
2365
2366 assert(CxTYPE_is_LOOP(cx))((void)0);
2367 if ( CxTYPE(cx)((cx)->cx_u.cx_subst.sbu_type & 0xf) == CXt_LOOP_ARY4
2368 || CxTYPE(cx)((cx)->cx_u.cx_subst.sbu_type & 0xf) == CXt_LOOP_LAZYSV5)
2369 {
2370 /* Free ary or cur. This assumes that state_u.ary.ary
2371 * aligns with state_u.lazysv.cur. See cx_dup() */
2372 SV *sv = cx->blk_loopcx_u.cx_blk.blk_u.blku_loop.state_u.lazysv.cur;
2373 cx->blk_loopcx_u.cx_blk.blk_u.blku_loop.state_u.lazysv.cur = NULL((void*)0);
2374 SvREFCNT_dec_NN(sv)Perl_SvREFCNT_dec_NN( ((SV *)({ void *_p = (sv); _p; })));
2375 if (CxTYPE(cx)((cx)->cx_u.cx_subst.sbu_type & 0xf) == CXt_LOOP_LAZYSV5) {
2376 sv = cx->blk_loopcx_u.cx_blk.blk_u.blku_loop.state_u.lazysv.end;
2377 cx->blk_loopcx_u.cx_blk.blk_u.blku_loop.state_u.lazysv.end = NULL((void*)0);
2378 SvREFCNT_dec_NN(sv)Perl_SvREFCNT_dec_NN( ((SV *)({ void *_p = (sv); _p; })));
2379 }
2380 }
2381 if (cx->cx_typecx_u.cx_subst.sbu_type & (CXp_FOR_PAD0x80|CXp_FOR_GV0x40)) {
2382 SV *cursv;
2383 SV **svp = (cx)->blk_loopcx_u.cx_blk.blk_u.blku_loop.itervar_u.svp;
2384 if ((cx->cx_typecx_u.cx_subst.sbu_type & CXp_FOR_GV0x40))
2385 svp = &GvSV((GV*)svp)((0+((GV*)svp)->sv_u.svu_gp)->gp_sv);
2386 cursv = *svp;
2387 *svp = cx->blk_loopcx_u.cx_blk.blk_u.blku_loop.itersave;
2388 cx->blk_loopcx_u.cx_blk.blk_u.blku_loop.itersave = NULL((void*)0);
2389 SvREFCNT_dec(cursv)Perl_SvREFCNT_dec( ((SV *)({ void *_p = (cursv); _p; })));
2390 }
2391}
2392
2393
2394PERL_STATIC_INLINEstatic __inline__ void
2395Perl_cx_pushwhen(pTHX_ PERL_CONTEXT *cx)
2396{
2397 PERL_ARGS_ASSERT_CX_PUSHWHEN((void)0);
2398
2399 cx->blk_givwhencx_u.cx_blk.blk_u.blku_givwhen.leave_op = cLOGOP((LOGOP*)(PL_op))->op_other;
2400}
2401
2402
2403PERL_STATIC_INLINEstatic __inline__ void
2404Perl_cx_popwhen(pTHX_ PERL_CONTEXT *cx)
2405{
2406 PERL_ARGS_ASSERT_CX_POPWHEN((void)0);
2407 assert(CxTYPE(cx) == CXt_WHEN)((void)0);
2408
2409 PERL_UNUSED_ARG(cx)((void)sizeof(cx));
2410 PERL_UNUSED_CONTEXT;
2411 /* currently NOOP */
2412}
2413
2414
2415PERL_STATIC_INLINEstatic __inline__ void
2416Perl_cx_pushgiven(pTHX_ PERL_CONTEXT *cx, SV *orig_defsv)
2417{
2418 PERL_ARGS_ASSERT_CX_PUSHGIVEN((void)0);
2419
2420 cx->blk_givwhencx_u.cx_blk.blk_u.blku_givwhen.leave_op = cLOGOP((LOGOP*)(PL_op))->op_other;
2421 cx->blk_givwhencx_u.cx_blk.blk_u.blku_givwhen.defsv_save = orig_defsv;
2422}
2423
2424
2425PERL_STATIC_INLINEstatic __inline__ void
2426Perl_cx_popgiven(pTHX_ PERL_CONTEXT *cx)
2427{
2428 SV *sv;
2429
2430 PERL_ARGS_ASSERT_CX_POPGIVEN((void)0);
2431 assert(CxTYPE(cx) == CXt_GIVEN)((void)0);
2432
2433 sv = GvSV(PL_defgv)((0+(PL_defgv)->sv_u.svu_gp)->gp_sv);
2434 GvSV(PL_defgv)((0+(PL_defgv)->sv_u.svu_gp)->gp_sv) = cx->blk_givwhencx_u.cx_blk.blk_u.blku_givwhen.defsv_save;
2435 cx->blk_givwhencx_u.cx_blk.blk_u.blku_givwhen.defsv_save = NULL((void*)0);
2436 SvREFCNT_dec(sv)Perl_SvREFCNT_dec( ((SV *)({ void *_p = (sv); _p; })));
2437}
2438
2439/* ------------------ util.h ------------------------------------------- */
2440
2441/*
2442=head1 Miscellaneous Functions
2443
2444=for apidoc foldEQ
2445
2446Returns true if the leading C<len> bytes of the strings C<s1> and C<s2> are the
2447same
2448case-insensitively; false otherwise. Uppercase and lowercase ASCII range bytes
2449match themselves and their opposite case counterparts. Non-cased and non-ASCII
2450range bytes match only themselves.
2451
2452=cut
2453*/
2454
2455PERL_STATIC_INLINEstatic __inline__ I32
2456Perl_foldEQ(const char *s1, const char *s2, I32 len)
2457{
2458 const U8 *a = (const U8 *)s1;
2459 const U8 *b = (const U8 *)s2;
2460
2461 PERL_ARGS_ASSERT_FOLDEQ((void)0); ((void)0);
2462
2463 assert(len >= 0)((void)0);
2464
2465 while (len--) {
2466 if (*a != *b && *a != PL_fold[*b])
2467 return 0;
2468 a++,b++;
2469 }
2470 return 1;
2471}
2472
2473PERL_STATIC_INLINEstatic __inline__ I32
2474Perl_foldEQ_latin1(const char *s1, const char *s2, I32 len)
2475{
2476 /* Compare non-UTF-8 using Unicode (Latin1) semantics. Works on all folds
2477 * representable without UTF-8, except for LATIN_SMALL_LETTER_SHARP_S, and
2478 * does not check for this. Nor does it check that the strings each have
2479 * at least 'len' characters. */
2480
2481 const U8 *a = (const U8 *)s1;
2482 const U8 *b = (const U8 *)s2;
2483
2484 PERL_ARGS_ASSERT_FOLDEQ_LATIN1((void)0); ((void)0);
2485
2486 assert(len >= 0)((void)0);
2487
2488 while (len--) {
2489 if (*a != *b && *a != PL_fold_latin1[*b]) {
2490 return 0;
2491 }
2492 a++, b++;
2493 }
2494 return 1;
2495}
2496
2497/*
2498=for apidoc foldEQ_locale
2499
2500Returns true if the leading C<len> bytes of the strings C<s1> and C<s2> are the
2501same case-insensitively in the current locale; false otherwise.
2502
2503=cut
2504*/
2505
2506PERL_STATIC_INLINEstatic __inline__ I32
2507Perl_foldEQ_locale(const char *s1, const char *s2, I32 len)
2508{
2509 dVARstruct Perl___notused_struct;
2510 const U8 *a = (const U8 *)s1;
2511 const U8 *b = (const U8 *)s2;
2512
2513 PERL_ARGS_ASSERT_FOLDEQ_LOCALE((void)0); ((void)0);
2514
2515 assert(len >= 0)((void)0);
2516
2517 while (len--) {
2518 if (*a != *b && *a != PL_fold_locale[*b])
2519 return 0;
2520 a++,b++;
2521 }
2522 return 1;
2523}
2524
2525/*
2526=for apidoc my_strnlen
2527
2528The C library C<strnlen> if available, or a Perl implementation of it.
2529
2530C<my_strnlen()> computes the length of the string, up to C<maxlen>
2531characters. It will never attempt to address more than C<maxlen>
2532characters, making it suitable for use with strings that are not
2533guaranteed to be NUL-terminated.
2534
2535=cut
2536
2537Description stolen from http://man.openbsd.org/strnlen.3,
2538implementation stolen from PostgreSQL.
2539*/
2540#ifndef HAS_STRNLEN
2541
2542PERL_STATIC_INLINEstatic __inline__ Size_tsize_t
2543Perl_my_strnlen(const char *str, Size_tsize_t maxlen)
2544{
2545 const char *end = (char *) memchr(str, '\0', maxlen);
2546
2547 PERL_ARGS_ASSERT_MY_STRNLEN;
2548
2549 if (end == NULL((void*)0)) return maxlen;
2550 return end - str;
2551}
2552
2553#endif
2554
2555#if ! defined (HAS_MEMRCHR) && (defined(PERL_CORE) || defined(PERL_EXT))
2556
2557PERL_STATIC_INLINEstatic __inline__ void *
2558S_my_memrchr(const char * s, const char c, const STRLEN len)
2559{
2560 /* memrchr(), since many platforms lack it */
2561
2562 const char * t = s + len - 1;
2563
2564 PERL_ARGS_ASSERT_MY_MEMRCHR;
2565
2566 while (t >= s) {
2567 if (*t == c) {
2568 return (void *) t;
2569 }
2570 t--;
2571 }
2572
2573 return NULL((void*)0);
2574}
2575
2576#endif
2577
2578PERL_STATIC_INLINEstatic __inline__ char *
2579Perl_mortal_getenv(const char * str)
2580{
2581 /* This implements a (mostly) thread-safe, sequential-call-safe getenv().
2582 *
2583 * It's (mostly) thread-safe because it uses a mutex to prevent
2584 * simultaneous access from other threads that use the same mutex, and
2585 * makes a copy of the result before releasing that mutex. All of the Perl
2586 * core uses that mutex, but, like all mutexes, everything has to cooperate
2587 * for it to completely work. It is possible for code from, say XS, to not
2588 * use this mutex, defeating the safety.
2589 *
2590 * On some platforms, getenv() is not sequential-call-safe, because
2591 * subsequent calls destroy the static storage inside the C library
2592 * returned by an earlier call. The result must be copied or completely
2593 * acted upon before a subsequent getenv call. Those calls could come from
2594 * another thread. Again, making a copy while controlling the mutex
2595 * prevents these problems..
2596 *
2597 * To prevent leaks, the copy is made by creating a new SV containing it,
2598 * mortalizing the SV, and returning the SV's string (the copy). Thus this
2599 * is a drop-in replacement for getenv().
2600 *
2601 * A complication is that this can be called during phases where the
2602 * mortalization process isn't available. These are in interpreter
2603 * destruction or early in construction. khw believes that at these times
2604 * there shouldn't be anything else going on, so plain getenv is safe AS
2605 * LONG AS the caller acts on the return before calling it again. */
2606
2607 char * ret;
2608 dTHXstruct Perl___notused_struct;
2609
2610 PERL_ARGS_ASSERT_MORTAL_GETENV((void)0);
2611
2612 /* Can't mortalize without stacks. khw believes that no other threads
2613 * should be running, so no need to lock things, and this may be during a
2614 * phase when locking isn't even available */
2615 if (UNLIKELY(PL_scopestack_ix == 0)__builtin_expect(((PL_scopestack_ix == 0) ? (_Bool)1 : (_Bool
)0),(0))
) {
2616 return getenv(str);
2617 }
2618
2619 ENV_LOCK(void)0;;
2620
2621 ret = getenv(str);
2622
2623 if (ret != NULL((void*)0)) {
2624 ret = SvPVX(sv_2mortal(newSVpv(ret, 0)))((Perl_sv_2mortal( Perl_newSVpv( ret,0)))->sv_u.svu_pv);
2625 }
2626
2627 ENV_UNLOCK(void)0;;
2628 return ret;
2629}
2630
2631/*
2632 * ex: set ts=8 sts=4 sw=4 et:
2633 */