~ubuntu-branches/ubuntu/lucid/postgresql-8.4/lucid-security

« back to all changes in this revision

Viewing changes to src/pl/plperl/ppport.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-03-20 12:00:13 UTC
  • Revision ID: james.westby@ubuntu.com-20090320120013-hogj7egc5mjncc5g
Tags: upstream-8.4~0cvs20090328
ImportĀ upstreamĀ versionĀ 8.4~0cvs20090328

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/* ppport.h -- Perl/Pollution/Portability Version 2.011
 
3
 *
 
4
 * Automatically Created by Devel::PPPort on Sun Jul  4 09:11:52 2004
 
5
 *
 
6
 * Do NOT edit this file directly! -- Edit PPPort.pm instead.
 
7
 *
 
8
 * Version 2.x, Copyright (C) 2001, Paul Marquess.
 
9
 * Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
 
10
 * This code may be used and distributed under the same license as any
 
11
 * version of Perl.
 
12
 *
 
13
 * This version of ppport.h is designed to support operation with Perl
 
14
 * installations back to 5.004, and has been tested up to 5.8.1.
 
15
 *
 
16
 * If this version of ppport.h is failing during the compilation of this
 
17
 * module, please check if a newer version of Devel::PPPort is available
 
18
 * on CPAN before sending a bug report.
 
19
 *
 
20
 * If you are using the latest version of Devel::PPPort and it is failing
 
21
 * during compilation of this module, please send a report to perlbug@perl.com
 
22
 *
 
23
 * Include all following information:
 
24
 *
 
25
 *      1. The complete output from running "perl -V"
 
26
 *
 
27
 *      2. This file.
 
28
 *
 
29
 *      3. The name & version of the module you were trying to build.
 
30
 *
 
31
 *      4. A full log of the build that failed.
 
32
 *
 
33
 *      5. Any other information that you think could be relevant.
 
34
 *
 
35
 *
 
36
 * For the latest version of this code, please retreive the Devel::PPPort
 
37
 * module from CPAN.
 
38
 *
 
39
 */
 
40
 
 
41
/*
 
42
 * In order for a Perl extension module to be as portable as possible
 
43
 * across differing versions of Perl itself, certain steps need to be taken.
 
44
 * Including this header is the first major one, then using dTHR is all the
 
45
 * appropriate places and using a PL_ prefix to refer to global Perl
 
46
 * variables is the second.
 
47
 *
 
48
 */
 
49
 
 
50
 
 
51
/* If you use one of a few functions that were not present in earlier
 
52
 * versions of Perl, please add a define before the inclusion of ppport.h
 
53
 * for a static include, or use the GLOBAL request in a single module to
 
54
 * produce a global definition that can be referenced from the other
 
55
 * modules.
 
56
 *
 
57
 * Function:                    Static define:                   Extern define:
 
58
 * newCONSTSUB()                NEED_newCONSTSUB                 NEED_newCONSTSUB_GLOBAL
 
59
 *
 
60
 */
 
61
 
 
62
 
 
63
/* To verify whether ppport.h is needed for your module, and whether any
 
64
 * special defines should be used, ppport.h can be run through Perl to check
 
65
 * your source code. Simply say:
 
66
 *
 
67
 *      perl -x ppport.h *.c *.h *.xs foo/bar*.c [etc]
 
68
 *
 
69
 * The result will be a list of patches suggesting changes that should at
 
70
 * least be acceptable, if not necessarily the most efficient solution, or a
 
71
 * fix for all possible problems. It won't catch where dTHR is needed, and
 
72
 * doesn't attempt to account for global macro or function definitions,
 
73
 * nested includes, typemaps, etc.
 
74
 *
 
75
 * In order to test for the need of dTHR, please try your module under a
 
76
 * recent version of Perl that has threading compiled-in.
 
77
 *
 
78
 */
 
79
 
 
80
 
 
81
/*
 
82
#!/usr/bin/perl
 
83
@ARGV = ("*.xs") if !@ARGV;
 
84
%badmacros = %funcs = %macros = (); $replace = 0;
 
85
foreach (<DATA>) {
 
86
        $funcs{$1} = 1 if /Provide:\s+(\S+)/;
 
87
        $macros{$1} = 1 if /^#\s*define\s+([a-zA-Z0-9_]+)/;
 
88
        $replace = $1 if /Replace:\s+(\d+)/;
 
89
        $badmacros{$2}=$1 if $replace and /^#\s*define\s+([a-zA-Z0-9_]+).*?\s+([a-zA-Z0-9_]+)/;
 
90
        $badmacros{$1}=$2 if /Replace (\S+) with (\S+)/;
 
91
}
 
92
foreach $filename (map(glob($_),@ARGV)) {
 
93
        unless (open(IN, "<$filename")) {
 
94
                warn "Unable to read from $file: $!\n";
 
95
                next;
 
96
        }
 
97
        print "Scanning $filename...\n";
 
98
        $c = ""; while (<IN>) { $c .= $_; } close(IN);
 
99
        $need_include = 0; %add_func = (); $changes = 0;
 
100
        $has_include = ($c =~ /#.*include.*ppport/m);
 
101
 
 
102
        foreach $func (keys %funcs) {
 
103
                if ($c =~ /#.*define.*\bNEED_$func(_GLOBAL)?\b/m) {
 
104
                        if ($c !~ /\b$func\b/m) {
 
105
                                print "If $func isn't needed, you don't need to request it.\n" if
 
106
                                $changes += ($c =~ s/^.*#.*define.*\bNEED_$func\b.*\n//m);
 
107
                        } else {
 
108
                                print "Uses $func\n";
 
109
                                $need_include = 1;
 
110
                        }
 
111
                } else {
 
112
                        if ($c =~ /\b$func\b/m) {
 
113
                                $add_func{$func} =1 ;
 
114
                                print "Uses $func\n";
 
115
                                $need_include = 1;
 
116
                        }
 
117
                }
 
118
        }
 
119
 
 
120
        if (not $need_include) {
 
121
                foreach $macro (keys %macros) {
 
122
                        if ($c =~ /\b$macro\b/m) {
 
123
                                print "Uses $macro\n";
 
124
                                $need_include = 1;
 
125
                        }
 
126
                }
 
127
        }
 
128
 
 
129
        foreach $badmacro (keys %badmacros) {
 
130
                if ($c =~ /\b$badmacro\b/m) {
 
131
                        $changes += ($c =~ s/\b$badmacro\b/$badmacros{$badmacro}/gm);
 
132
                        print "Uses $badmacros{$badmacro} (instead of $badmacro)\n";
 
133
                        $need_include = 1;
 
134
                }
 
135
        }
 
136
 
 
137
        if (scalar(keys %add_func) or $need_include != $has_include) {
 
138
                if (!$has_include) {
 
139
                        $inc = join('',map("#define NEED_$_\n", sort keys %add_func)).
 
140
                                   "#include \"ppport.h\"\n";
 
141
                        $c = "$inc$c" unless $c =~ s/#.*include.*XSUB.*\n/$&$inc/m;
 
142
                } elsif (keys %add_func) {
 
143
                        $inc = join('',map("#define NEED_$_\n", sort keys %add_func));
 
144
                        $c = "$inc$c" unless $c =~ s/^.*#.*include.*ppport.*$/$inc$&/m;
 
145
                }
 
146
                if (!$need_include) {
 
147
                        print "Doesn't seem to need ppport.h.\n";
 
148
                        $c =~ s/^.*#.*include.*ppport.*\n//m;
 
149
                }
 
150
                $changes++;
 
151
        }
 
152
 
 
153
        if ($changes) {
 
154
                open(OUT,">/tmp/ppport.h.$$");
 
155
                print OUT $c;
 
156
                close(OUT);
 
157
                open(DIFF, "diff -u $filename /tmp/ppport.h.$$|");
 
158
                while (<DIFF>) { s!/tmp/ppport\.h\.$$!$filename.patched!; print STDOUT; }
 
159
                close(DIFF);
 
160
                unlink("/tmp/ppport.h.$$");
 
161
        } else {
 
162
                print "Looks OK\n";
 
163
        }
 
164
}
 
165
__DATA__
 
166
*/
 
167
 
 
168
#ifndef _P_P_PORTABILITY_H_
 
169
#define _P_P_PORTABILITY_H_
 
170
 
 
171
#ifndef PERL_REVISION
 
172
#ifndef __PATCHLEVEL_H_INCLUDED__
 
173
#define PERL_PATCHLEVEL_H_IMPLICIT
 
174
#include <patchlevel.h>
 
175
#endif
 
176
#if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
 
177
#include <could_not_find_Perl_patchlevel.h>
 
178
#endif
 
179
#ifndef PERL_REVISION
 
180
#define PERL_REVISION    (5)
 
181
 /* Replace: 1 */
 
182
#define PERL_VERSION PATCHLEVEL
 
183
#define PERL_SUBVERSION  SUBVERSION
 
184
 /* Replace PERL_PATCHLEVEL with PERL_VERSION */
 
185
 /* Replace: 0 */
 
186
#endif
 
187
#endif
 
188
 
 
189
#define PERL_BCDVERSION ((PERL_REVISION * 0x1000000L) + (PERL_VERSION * 0x1000L) + PERL_SUBVERSION)
 
190
 
 
191
/* It is very unlikely that anyone will try to use this with Perl 6
 
192
   (or greater), but who knows.
 
193
 */
 
194
#if PERL_REVISION != 5
 
195
#error ppport.h only works with Perl version 5
 
196
#endif   /* PERL_REVISION != 5 */
 
197
 
 
198
#ifndef ERRSV
 
199
#define ERRSV perl_get_sv("@",FALSE)
 
200
#endif
 
201
 
 
202
#if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5))
 
203
/* Replace: 1 */
 
204
#define PL_Sv            Sv
 
205
#define PL_compiling compiling
 
206
#define PL_copline       copline
 
207
#define PL_curcop        curcop
 
208
#define PL_curstash  curstash
 
209
#define PL_defgv         defgv
 
210
#define PL_dirty         dirty
 
211
#define PL_dowarn        dowarn
 
212
#define PL_hints         hints
 
213
#define PL_na            na
 
214
#define PL_perldb        perldb
 
215
#define PL_rsfp_filters  rsfp_filters
 
216
#define PL_rsfpv         rsfp
 
217
#define PL_stdingv       stdingv
 
218
#define PL_sv_no         sv_no
 
219
#define PL_sv_undef  sv_undef
 
220
#define PL_sv_yes        sv_yes
 
221
/* Replace: 0 */
 
222
#endif
 
223
 
 
224
#ifndef PERL_UNUSED_DECL
 
225
#ifdef HASATTRIBUTE
 
226
#if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER)
 
227
#define PERL_UNUSED_DECL
 
228
#else
 
229
#define PERL_UNUSED_DECL __attribute__((unused))
 
230
#endif
 
231
#else
 
232
#define PERL_UNUSED_DECL
 
233
#endif
 
234
#endif
 
235
 
 
236
#ifndef dNOOP
 
237
#define NOOP (void)0
 
238
#define dNOOP extern int Perl___notused PERL_UNUSED_DECL
 
239
#endif
 
240
 
 
241
#ifndef dTHR
 
242
#define dTHR              dNOOP
 
243
#endif
 
244
 
 
245
#ifndef dTHX
 
246
#define dTHX              dNOOP
 
247
#define dTHXa(x)          dNOOP
 
248
#define dTHXoa(x)         dNOOP
 
249
#endif
 
250
 
 
251
#ifndef pTHX
 
252
#define pTHX    void
 
253
#define pTHX_
 
254
#define aTHX
 
255
#define aTHX_
 
256
#endif
 
257
 
 
258
#ifndef dAX
 
259
#define dAX I32 ax = MARK - PL_stack_base + 1
 
260
#endif
 
261
#ifndef dITEMS
 
262
#define dITEMS I32 items = SP - MARK
 
263
#endif
 
264
 
 
265
/* IV could also be a quad (say, a long long), but Perls
 
266
 * capable of those should have IVSIZE already. */
 
267
#if !defined(IVSIZE) && defined(LONGSIZE)
 
268
#define IVSIZE LONGSIZE
 
269
#endif
 
270
#ifndef IVSIZE
 
271
#define IVSIZE 4                                /* A bold guess, but the best we can make. */
 
272
#endif
 
273
 
 
274
#ifndef UVSIZE
 
275
#define UVSIZE IVSIZE
 
276
#endif
 
277
 
 
278
#ifndef NVTYPE
 
279
#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
 
280
#define NVTYPE long double
 
281
#else
 
282
#define NVTYPE double
 
283
#endif
 
284
typedef NVTYPE NV;
 
285
#endif
 
286
 
 
287
#ifndef INT2PTR
 
288
 
 
289
#if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
 
290
#define PTRV                              UV
 
291
#define INT2PTR(any,d)            (any)(d)
 
292
#else
 
293
#if PTRSIZE == LONGSIZE
 
294
#define PTRV                            unsigned long
 
295
#else
 
296
#define PTRV                            unsigned
 
297
#endif
 
298
#define INT2PTR(any,d)            (any)(PTRV)(d)
 
299
#endif
 
300
#define NUM2PTR(any,d)  (any)(PTRV)(d)
 
301
#define PTR2IV(p)               INT2PTR(IV,p)
 
302
#define PTR2UV(p)               INT2PTR(UV,p)
 
303
#define PTR2NV(p)               NUM2PTR(NV,p)
 
304
#if PTRSIZE == LONGSIZE
 
305
#define PTR2ul(p)         (unsigned long)(p)
 
306
#else
 
307
#define PTR2ul(p)         INT2PTR(unsigned long,p)
 
308
#endif
 
309
#endif   /* !INT2PTR */
 
310
 
 
311
#ifndef boolSV
 
312
#define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no)
 
313
#endif
 
314
 
 
315
#ifndef gv_stashpvn
 
316
#define gv_stashpvn(str,len,flags) gv_stashpv(str,flags)
 
317
#endif
 
318
 
 
319
#ifndef newSVpvn
 
320
#define newSVpvn(data,len) ((len) ? newSVpv ((data), (len)) : newSVpv ("", 0))
 
321
#endif
 
322
 
 
323
#ifndef newRV_inc
 
324
/* Replace: 1 */
 
325
#define newRV_inc(sv) newRV(sv)
 
326
/* Replace: 0 */
 
327
#endif
 
328
 
 
329
/* DEFSV appears first in 5.004_56 */
 
330
#ifndef DEFSV
 
331
#define DEFSV GvSV(PL_defgv)
 
332
#endif
 
333
 
 
334
#ifndef SAVE_DEFSV
 
335
#define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv))
 
336
#endif
 
337
 
 
338
#ifndef newRV_noinc
 
339
#ifdef __GNUC__
 
340
#define newRV_noinc(sv)                           \
 
341
          ({                                                              \
 
342
                  SV *nsv = (SV*)newRV(sv);               \
 
343
                  SvREFCNT_dec(sv);                               \
 
344
                  nsv;                                                    \
 
345
          })
 
346
#else
 
347
#if defined(USE_THREADS)
 
348
static SV  *
 
349
newRV_noinc(SV *sv)
 
350
{
 
351
        SV                 *nsv = (SV *) newRV(sv);
 
352
 
 
353
        SvREFCNT_dec(sv);
 
354
        return nsv;
 
355
}
 
356
#else
 
357
#define newRV_noinc(sv)    \
 
358
                (PL_Sv=(SV*)newRV(sv), SvREFCNT_dec(sv), (SV*)PL_Sv)
 
359
#endif
 
360
#endif
 
361
#endif
 
362
 
 
363
/* Provide: newCONSTSUB */
 
364
 
 
365
/* newCONSTSUB from IO.xs is in the core starting with 5.004_63 */
 
366
#if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION < 63))
 
367
 
 
368
#if defined(NEED_newCONSTSUB)
 
369
static
 
370
#else
 
371
extern void newCONSTSUB(HV *stash, char *name, SV *sv);
 
372
#endif
 
373
 
 
374
#if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL)
 
375
void
 
376
newCONSTSUB(stash, name, sv)
 
377
HV                 *stash;
 
378
char       *name;
 
379
SV                 *sv;
 
380
{
 
381
        U32                     oldhints = PL_hints;
 
382
        HV                 *old_cop_stash = PL_curcop->cop_stash;
 
383
        HV                 *old_curstash = PL_curstash;
 
384
        line_t          oldline = PL_curcop->cop_line;
 
385
 
 
386
        PL_curcop->cop_line = PL_copline;
 
387
 
 
388
        PL_hints &= ~HINT_BLOCK_SCOPE;
 
389
        if (stash)
 
390
                PL_curstash = PL_curcop->cop_stash = stash;
 
391
 
 
392
        newSUB(
 
393
 
 
394
#if (PERL_VERSION < 3) || ((PERL_VERSION == 3) && (PERL_SUBVERSION < 22))
 
395
        /* before 5.003_22 */
 
396
                   start_subparse(),
 
397
#else
 
398
#if (PERL_VERSION == 3) && (PERL_SUBVERSION == 22)
 
399
        /* 5.003_22 */
 
400
                   start_subparse(0),
 
401
#else
 
402
        /* 5.003_23  onwards */
 
403
                   start_subparse(FALSE, 0),
 
404
#endif
 
405
#endif
 
406
 
 
407
                   newSVOP(OP_CONST, 0, newSVpv(name, 0)),
 
408
                   newSVOP(OP_CONST, 0, &PL_sv_no),             /* SvPV(&PL_sv_no) == "" --
 
409
                                                                                                 * GMB */
 
410
                   newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv))
 
411
                );
 
412
 
 
413
        PL_hints = oldhints;
 
414
        PL_curcop->cop_stash = old_cop_stash;
 
415
        PL_curstash = old_curstash;
 
416
        PL_curcop->cop_line = oldline;
 
417
}
 
418
#endif
 
419
#endif   /* newCONSTSUB */
 
420
 
 
421
#ifndef START_MY_CXT
 
422
 
 
423
/*
 
424
 * Boilerplate macros for initializing and accessing interpreter-local
 
425
 * data from C.  All statics in extensions should be reworked to use
 
426
 * this, if you want to make the extension thread-safe.  See ext/re/re.xs
 
427
 * for an example of the use of these macros.
 
428
 *
 
429
 * Code that uses these macros is responsible for the following:
 
430
 * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts"
 
431
 * 2. Declare a typedef named my_cxt_t that is a structure that contains
 
432
 *        all the data that needs to be interpreter-local.
 
433
 * 3. Use the START_MY_CXT macro after the declaration of my_cxt_t.
 
434
 * 4. Use the MY_CXT_INIT macro such that it is called exactly once
 
435
 *        (typically put in the BOOT: section).
 
436
 * 5. Use the members of the my_cxt_t structure everywhere as
 
437
 *        MY_CXT.member.
 
438
 * 6. Use the dMY_CXT macro (a declaration) in all the functions that
 
439
 *        access MY_CXT.
 
440
 */
 
441
 
 
442
#if defined(MULTIPLICITY) || defined(PERL_OBJECT) || \
 
443
        defined(PERL_CAPI)        || defined(PERL_IMPLICIT_CONTEXT)
 
444
 
 
445
/* This must appear in all extensions that define a my_cxt_t structure,
 
446
 * right after the definition (i.e. at file scope).  The non-threads
 
447
 * case below uses it to declare the data as static. */
 
448
#define START_MY_CXT
 
449
 
 
450
#if (PERL_VERSION < 4 || (PERL_VERSION == 4 && PERL_SUBVERSION < 68 ))
 
451
/* Fetches the SV that keeps the per-interpreter data. */
 
452
#define dMY_CXT_SV \
 
453
        SV *my_cxt_sv = perl_get_sv(MY_CXT_KEY, FALSE)
 
454
#else                                                   /* >= perl5.004_68 */
 
455
#define dMY_CXT_SV \
 
456
        SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY,             \
 
457
                                  sizeof(MY_CXT_KEY)-1, TRUE)
 
458
#endif   /* < perl5.004_68 */
 
459
 
 
460
/* This declaration should be used within all functions that use the
 
461
 * interpreter-local data. */
 
462
#define dMY_CXT \
 
463
        dMY_CXT_SV;                                                     \
 
464
        my_cxt_t *my_cxtp = INT2PTR(my_cxt_t*,SvUV(my_cxt_sv))
 
465
 
 
466
/* Creates and zeroes the per-interpreter data.
 
467
 * (We allocate my_cxtp in a Perl SV so that it will be released when
 
468
 * the interpreter goes away.) */
 
469
#define MY_CXT_INIT \
 
470
        dMY_CXT_SV;                                                     \
 
471
        /* newSV() allocates one more than needed */                    \
 
472
        my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\
 
473
        Zero(my_cxtp, 1, my_cxt_t);                                     \
 
474
        sv_setuv(my_cxt_sv, PTR2UV(my_cxtp))
 
475
 
 
476
/* This macro must be used to access members of the my_cxt_t structure.
 
477
 * e.g. MYCXT.some_data */
 
478
#define MY_CXT          (*my_cxtp)
 
479
 
 
480
/* Judicious use of these macros can reduce the number of times dMY_CXT
 
481
 * is used.  Use is similar to pTHX, aTHX etc. */
 
482
#define pMY_CXT         my_cxt_t *my_cxtp
 
483
#define pMY_CXT_        pMY_CXT,
 
484
#define _pMY_CXT        ,pMY_CXT
 
485
#define aMY_CXT         my_cxtp
 
486
#define aMY_CXT_        aMY_CXT,
 
487
#define _aMY_CXT        ,aMY_CXT
 
488
#else                                                   /* single interpreter */
 
489
 
 
490
#define START_MY_CXT    static my_cxt_t my_cxt;
 
491
#define dMY_CXT_SV      dNOOP
 
492
#define dMY_CXT         dNOOP
 
493
#define MY_CXT_INIT NOOP
 
494
#define MY_CXT          my_cxt
 
495
 
 
496
#define pMY_CXT         void
 
497
#define pMY_CXT_
 
498
#define _pMY_CXT
 
499
#define aMY_CXT
 
500
#define aMY_CXT_
 
501
#define _aMY_CXT
 
502
#endif
 
503
#endif   /* START_MY_CXT */
 
504
 
 
505
#ifndef IVdf
 
506
#if IVSIZE == LONGSIZE
 
507
#define  IVdf            "ld"
 
508
#define  UVuf            "lu"
 
509
#define  UVof            "lo"
 
510
#define  UVxf            "lx"
 
511
#define  UVXf            "lX"
 
512
#else
 
513
#if IVSIZE == INTSIZE
 
514
#define  IVdf    "d"
 
515
#define  UVuf    "u"
 
516
#define  UVof    "o"
 
517
#define  UVxf    "x"
 
518
#define  UVXf    "X"
 
519
#endif
 
520
#endif
 
521
#endif
 
522
 
 
523
#ifndef NVef
 
524
#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \
 
525
        defined(PERL_PRIfldbl)          /* Not very likely, but let's try anyway. */
 
526
#define NVef     PERL_PRIeldbl
 
527
#define NVff     PERL_PRIfldbl
 
528
#define NVgf     PERL_PRIgldbl
 
529
#else
 
530
#define NVef     "e"
 
531
#define NVff     "f"
 
532
#define NVgf     "g"
 
533
#endif
 
534
#endif
 
535
 
 
536
#ifndef AvFILLp                                 /* Older perls (<=5.003) lack AvFILLp */
 
537
#define AvFILLp AvFILL
 
538
#endif
 
539
 
 
540
#ifdef SvPVbyte
 
541
#if PERL_REVISION == 5 && PERL_VERSION < 7
 
542
 /* SvPVbyte does not work in perl-5.6.1, borrowed version for 5.7.3 */
 
543
#undef SvPVbyte
 
544
#define SvPVbyte(sv, lp) \
 
545
                  ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK) \
 
546
                   ? ((lp = SvCUR(sv)), SvPVX(sv)) : my_sv_2pvbyte(aTHX_ sv, &lp))
 
547
static char *
 
548
my_sv_2pvbyte(pTHX_ register SV *sv, STRLEN *lp)
 
549
{
 
550
        sv_utf8_downgrade(sv, 0);
 
551
        return SvPV(sv, *lp);
 
552
}
 
553
#endif
 
554
#else
 
555
#define SvPVbyte SvPV
 
556
#endif
 
557
 
 
558
#ifndef SvPV_nolen
 
559
#define SvPV_nolen(sv) \
 
560
                ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
 
561
                 ? SvPVX(sv) : sv_2pv_nolen(sv))
 
562
static char *
 
563
sv_2pv_nolen(pTHX_ register SV *sv)
 
564
{
 
565
        STRLEN          n_a;
 
566
 
 
567
        return sv_2pv(sv, &n_a);
 
568
}
 
569
#endif
 
570
 
 
571
#ifndef get_cv
 
572
#define get_cv(name,create) perl_get_cv(name,create)
 
573
#endif
 
574
 
 
575
#ifndef get_sv
 
576
#define get_sv(name,create) perl_get_sv(name,create)
 
577
#endif
 
578
 
 
579
#ifndef get_av
 
580
#define get_av(name,create) perl_get_av(name,create)
 
581
#endif
 
582
 
 
583
#ifndef get_hv
 
584
#define get_hv(name,create) perl_get_hv(name,create)
 
585
#endif
 
586
 
 
587
#ifndef call_argv
 
588
#define call_argv perl_call_argv
 
589
#endif
 
590
 
 
591
#ifndef call_method
 
592
#define call_method perl_call_method
 
593
#endif
 
594
 
 
595
#ifndef call_pv
 
596
#define call_pv perl_call_pv
 
597
#endif
 
598
 
 
599
#ifndef call_sv
 
600
#define call_sv perl_call_sv
 
601
#endif
 
602
 
 
603
#ifndef eval_pv
 
604
#define eval_pv perl_eval_pv
 
605
#endif
 
606
 
 
607
#ifndef eval_sv
 
608
#define eval_sv perl_eval_sv
 
609
#endif
 
610
 
 
611
#ifndef PERL_SCAN_GREATER_THAN_UV_MAX
 
612
#define PERL_SCAN_GREATER_THAN_UV_MAX 0x02
 
613
#endif
 
614
 
 
615
#ifndef PERL_SCAN_SILENT_ILLDIGIT
 
616
#define PERL_SCAN_SILENT_ILLDIGIT 0x04
 
617
#endif
 
618
 
 
619
#ifndef PERL_SCAN_ALLOW_UNDERSCORES
 
620
#define PERL_SCAN_ALLOW_UNDERSCORES 0x01
 
621
#endif
 
622
 
 
623
#ifndef PERL_SCAN_DISALLOW_PREFIX
 
624
#define PERL_SCAN_DISALLOW_PREFIX 0x02
 
625
#endif
 
626
 
 
627
#if (PERL_VERSION > 6) || ((PERL_VERSION == 6) && (PERL_SUBVERSION >= 1))
 
628
#define I32_CAST
 
629
#else
 
630
#define I32_CAST (I32*)
 
631
#endif
 
632
 
 
633
 
 
634
#ifndef IN_LOCALE
 
635
#define IN_LOCALE \
 
636
        (PL_curcop == &PL_compiling ? IN_LOCALE_COMPILETIME : IN_LOCALE_RUNTIME)
 
637
#endif
 
638
 
 
639
#ifndef IN_LOCALE_RUNTIME
 
640
#define IN_LOCALE_RUNTIME       (PL_curcop->op_private & HINT_LOCALE)
 
641
#endif
 
642
 
 
643
#ifndef IN_LOCALE_COMPILETIME
 
644
#define IN_LOCALE_COMPILETIME   (PL_hints & HINT_LOCALE)
 
645
#endif
 
646
 
 
647
 
 
648
#ifndef IS_NUMBER_IN_UV
 
649
#define IS_NUMBER_IN_UV                                  0x01
 
650
#define IS_NUMBER_GREATER_THAN_UV_MAX    0x02
 
651
#define IS_NUMBER_NOT_INT                                0x04
 
652
#define IS_NUMBER_NEG                                    0x08
 
653
#define IS_NUMBER_INFINITY                               0x10
 
654
#define IS_NUMBER_NAN                                    0x20
 
655
#endif
 
656
 
 
657
#ifndef PERL_MAGIC_sv
 
658
#define PERL_MAGIC_sv                     '\0'
 
659
#endif
 
660
 
 
661
#ifndef PERL_MAGIC_overload
 
662
#define PERL_MAGIC_overload               'A'
 
663
#endif
 
664
 
 
665
#ifndef PERL_MAGIC_overload_elem
 
666
#define PERL_MAGIC_overload_elem  'a'
 
667
#endif
 
668
 
 
669
#ifndef PERL_MAGIC_overload_table
 
670
#define PERL_MAGIC_overload_table 'c'
 
671
#endif
 
672
 
 
673
#ifndef PERL_MAGIC_bm
 
674
#define PERL_MAGIC_bm                     'B'
 
675
#endif
 
676
 
 
677
#ifndef PERL_MAGIC_regdata
 
678
#define PERL_MAGIC_regdata                'D'
 
679
#endif
 
680
 
 
681
#ifndef PERL_MAGIC_regdatum
 
682
#define PERL_MAGIC_regdatum               'd'
 
683
#endif
 
684
 
 
685
#ifndef PERL_MAGIC_env
 
686
#define PERL_MAGIC_env                    'E'
 
687
#endif
 
688
 
 
689
#ifndef PERL_MAGIC_envelem
 
690
#define PERL_MAGIC_envelem                'e'
 
691
#endif
 
692
 
 
693
#ifndef PERL_MAGIC_fm
 
694
#define PERL_MAGIC_fm                     'f'
 
695
#endif
 
696
 
 
697
#ifndef PERL_MAGIC_regex_global
 
698
#define PERL_MAGIC_regex_global   'g'
 
699
#endif
 
700
 
 
701
#ifndef PERL_MAGIC_isa
 
702
#define PERL_MAGIC_isa                    'I'
 
703
#endif
 
704
 
 
705
#ifndef PERL_MAGIC_isaelem
 
706
#define PERL_MAGIC_isaelem                'i'
 
707
#endif
 
708
 
 
709
#ifndef PERL_MAGIC_nkeys
 
710
#define PERL_MAGIC_nkeys                  'k'
 
711
#endif
 
712
 
 
713
#ifndef PERL_MAGIC_dbfile
 
714
#define PERL_MAGIC_dbfile                 'L'
 
715
#endif
 
716
 
 
717
#ifndef PERL_MAGIC_dbline
 
718
#define PERL_MAGIC_dbline                 'l'
 
719
#endif
 
720
 
 
721
#ifndef PERL_MAGIC_mutex
 
722
#define PERL_MAGIC_mutex                  'm'
 
723
#endif
 
724
 
 
725
#ifndef PERL_MAGIC_shared
 
726
#define PERL_MAGIC_shared                 'N'
 
727
#endif
 
728
 
 
729
#ifndef PERL_MAGIC_shared_scalar
 
730
#define PERL_MAGIC_shared_scalar  'n'
 
731
#endif
 
732
 
 
733
#ifndef PERL_MAGIC_collxfrm
 
734
#define PERL_MAGIC_collxfrm               'o'
 
735
#endif
 
736
 
 
737
#ifndef PERL_MAGIC_tied
 
738
#define PERL_MAGIC_tied                   'P'
 
739
#endif
 
740
 
 
741
#ifndef PERL_MAGIC_tiedelem
 
742
#define PERL_MAGIC_tiedelem               'p'
 
743
#endif
 
744
 
 
745
#ifndef PERL_MAGIC_tiedscalar
 
746
#define PERL_MAGIC_tiedscalar     'q'
 
747
#endif
 
748
 
 
749
#ifndef PERL_MAGIC_qr
 
750
#define PERL_MAGIC_qr                     'r'
 
751
#endif
 
752
 
 
753
#ifndef PERL_MAGIC_sig
 
754
#define PERL_MAGIC_sig                    'S'
 
755
#endif
 
756
 
 
757
#ifndef PERL_MAGIC_sigelem
 
758
#define PERL_MAGIC_sigelem                's'
 
759
#endif
 
760
 
 
761
#ifndef PERL_MAGIC_taint
 
762
#define PERL_MAGIC_taint                  't'
 
763
#endif
 
764
 
 
765
#ifndef PERL_MAGIC_uvar
 
766
#define PERL_MAGIC_uvar                   'U'
 
767
#endif
 
768
 
 
769
#ifndef PERL_MAGIC_uvar_elem
 
770
#define PERL_MAGIC_uvar_elem      'u'
 
771
#endif
 
772
 
 
773
#ifndef PERL_MAGIC_vstring
 
774
#define PERL_MAGIC_vstring                'V'
 
775
#endif
 
776
 
 
777
#ifndef PERL_MAGIC_vec
 
778
#define PERL_MAGIC_vec                    'v'
 
779
#endif
 
780
 
 
781
#ifndef PERL_MAGIC_utf8
 
782
#define PERL_MAGIC_utf8                   'w'
 
783
#endif
 
784
 
 
785
#ifndef PERL_MAGIC_substr
 
786
#define PERL_MAGIC_substr                 'x'
 
787
#endif
 
788
 
 
789
#ifndef PERL_MAGIC_defelem
 
790
#define PERL_MAGIC_defelem                'y'
 
791
#endif
 
792
 
 
793
#ifndef PERL_MAGIC_glob
 
794
#define PERL_MAGIC_glob                   '*'
 
795
#endif
 
796
 
 
797
#ifndef PERL_MAGIC_arylen
 
798
#define PERL_MAGIC_arylen                 '#'
 
799
#endif
 
800
 
 
801
#ifndef PERL_MAGIC_pos
 
802
#define PERL_MAGIC_pos                    '.'
 
803
#endif
 
804
 
 
805
#ifndef PERL_MAGIC_backref
 
806
#define PERL_MAGIC_backref                '<'
 
807
#endif
 
808
 
 
809
#ifndef PERL_MAGIC_ext
 
810
#define PERL_MAGIC_ext                    '~'
 
811
#endif
 
812
#endif   /* _P_P_PORTABILITY_H_ */
 
813
 
 
814
/* End of File ppport.h */