CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Thu, 31 Jul 2025 00:42:29 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20210116115425
location: https://web.archive.org/web/20210116115425/https://perl5.git.perl.org/perl5.git/blob/HEAD:/mg.h
server-timing: captures_list;dur=1.052415, exclusion.robots;dur=0.026448, exclusion.robots.policy;dur=0.011491, esindex;dur=0.013543, cdx.remote;dur=14.293564, LoadShardBlock;dur=223.857373, PetaboxLoader3.datanode;dur=77.564813, PetaboxLoader3.resolve;dur=78.392087
x-app-server: wwwb-app217
x-ts: 302
x-tr: 275
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: SERVER=wwwb-app217; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Thu, 31 Jul 2025 00:42:30 GMT
content-type: application/xhtml+xml; charset=utf-8
x-archive-orig-date: Sat, 16 Jan 2021 11:54:25 GMT
x-archive-orig-server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips
x-archive-orig-keep-alive: timeout=5, max=100
x-archive-orig-connection: Keep-Alive
x-archive-orig-x-crawler-transfer-encoding: chunked
x-archive-orig-content-length: 20443
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Sat, 16 Jan 2021 11:54:25 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Sat, 16 Jan 2021 11:54:25 GMT", ; rel="memento"; datetime="Sat, 16 Jan 2021 11:54:25 GMT", ; rel="last memento"; datetime="Sat, 16 Jan 2021 11:54:25 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: CC-MAIN-2021-04-1610703506640.22-0006/CC-MAIN-20210116104719-20210116134719-00128.warc.gz
server-timing: captures_list;dur=0.553794, exclusion.robots;dur=0.018166, exclusion.robots.policy;dur=0.008415, esindex;dur=0.015518, cdx.remote;dur=24.591470, LoadShardBlock;dur=369.377498, PetaboxLoader3.datanode;dur=130.052594, PetaboxLoader3.resolve;dur=294.557780, load_resource;dur=86.493794
x-app-server: wwwb-app217
x-ts: 200
x-tr: 570
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
perl5.git.perl.org Git - perl5.git/blob - mg.h
This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
1 /* mg.h
2 *
3 * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999,
4 * 2000, 2002, 2005, 2006, 2007, 2008 by Larry Wall and others
5 *
6 * You may distribute under the terms of either the GNU General Public
7 * License or the Artistic License, as specified in the README file.
8 *
9 */
11 struct mgvtbl {
12 int (*svt_get) (pTHX_ SV *sv, MAGIC* mg);
13 int (*svt_set) (pTHX_ SV *sv, MAGIC* mg);
14 U32 (*svt_len) (pTHX_ SV *sv, MAGIC* mg);
15 int (*svt_clear) (pTHX_ SV *sv, MAGIC* mg);
16 int (*svt_free) (pTHX_ SV *sv, MAGIC* mg);
17 int (*svt_copy) (pTHX_ SV *sv, MAGIC* mg,
18 SV *nsv, const char *name, I32 namlen);
19 int (*svt_dup) (pTHX_ MAGIC *mg, CLONE_PARAMS *param);
20 int (*svt_local)(pTHX_ SV *nsv, MAGIC *mg);
21 };
23 struct magic {
24 MAGIC* mg_moremagic;
25 MGVTBL* mg_virtual; /* pointer to magic functions */
26 U16 mg_private;
27 char mg_type;
28 U8 mg_flags;
29 SSize_t mg_len;
30 SV* mg_obj;
31 char* mg_ptr;
32 };
34 #define MGf_TAINTEDDIR 1 /* PERL_MAGIC_envelem only */
35 #define MGf_MINMATCH 1 /* PERL_MAGIC_regex_global only */
36 #define MGf_REQUIRE_GV 1 /* PERL_MAGIC_checkcall only */
37 #define MGf_REFCOUNTED 2
38 #define MGf_GSKIP 4 /* skip further GETs until after next SET */
39 #define MGf_COPY 8 /* has an svt_copy MGVTBL entry */
40 #define MGf_DUP 0x10 /* has an svt_dup MGVTBL entry */
41 #define MGf_LOCAL 0x20 /* has an svt_local MGVTBL entry */
42 #define MGf_BYTES 0x40 /* PERL_MAGIC_regex_global only */
43 #define MGf_PERSIST 0x80 /* PERL_MAGIC_lvref only */
45 #define MgTAINTEDDIR(mg) (mg->mg_flags & MGf_TAINTEDDIR)
46 #define MgTAINTEDDIR_on(mg) (mg->mg_flags |= MGf_TAINTEDDIR)
47 #define MgTAINTEDDIR_off(mg) (mg->mg_flags &= ~MGf_TAINTEDDIR)
49 #define MgPV(mg,lp) ((((int)(lp = (mg)->mg_len)) == HEf_SVKEY) ? \
50 SvPV(MUTABLE_SV((mg)->mg_ptr),lp) : \
51 (mg)->mg_ptr)
52 #define MgPV_const(mg,lp) ((((int)(lp = (mg)->mg_len)) == HEf_SVKEY) ? \
53 SvPV_const(MUTABLE_SV((mg)->mg_ptr),lp) : \
54 (const char*)(mg)->mg_ptr)
55 #define MgPV_nolen_const(mg) (((((int)(mg)->mg_len)) == HEf_SVKEY) ? \
56 SvPV_nolen_const(MUTABLE_SV((mg)->mg_ptr)) : \
57 (const char*)(mg)->mg_ptr)
59 #define SvTIED_mg(sv,how) (SvRMAGICAL(sv) ? mg_find((sv),(how)) : NULL)
60 #define SvTIED_obj(sv,mg) \
61 ((mg)->mg_obj ? (mg)->mg_obj : sv_2mortal(newRV(sv)))
63 #if defined(PERL_CORE) || defined(PERL_EXT)
64 # define MgBYTEPOS(mg,sv,pv,len) S_MgBYTEPOS(aTHX_ mg,sv,pv,len)
65 /* assumes get-magic and stringification have already occurred */
66 # define MgBYTEPOS_set(mg,sv,pv,off) ( \
67 assert_((mg)->mg_type == PERL_MAGIC_regex_global) \
68 SvPOK(sv) && (!SvGMAGICAL(sv) || sv_only_taint_gmagic(sv)) \
69 ? (mg)->mg_len = (off), (mg)->mg_flags |= MGf_BYTES \
70 : ((mg)->mg_len = DO_UTF8(sv) \
71 ? (SSize_t)utf8_length((U8 *)(pv), (U8 *)(pv)+(off)) \
72 : (SSize_t)(off), \
73 (mg)->mg_flags &= ~MGf_BYTES))
74 #endif
76 #define whichsig(pv) whichsig_pv(pv)
78 /*
79 * ex: set ts=8 sts=4 sw=4 et:
80 */