Initial bulk commit for "Git on MSys"
[msysgit/historical-msysgit.git] / lib / perl5 / 5.6.1 / msys / CORE / mg.h
blob004880344089d20c1ce1a4ebea08a594b52b3a21
1 /* mg.h
3 * Copyright (c) 1991-2001, Larry Wall
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.
8 */
10 #ifdef STRUCT_MGVTBL_DEFINITION
11 STRUCT_MGVTBL_DEFINITION;
12 #else
13 struct mgvtbl {
14 int (CPERLscope(*svt_get)) (pTHX_ SV *sv, MAGIC* mg);
15 int (CPERLscope(*svt_set)) (pTHX_ SV *sv, MAGIC* mg);
16 U32 (CPERLscope(*svt_len)) (pTHX_ SV *sv, MAGIC* mg);
17 int (CPERLscope(*svt_clear))(pTHX_ SV *sv, MAGIC* mg);
18 int (CPERLscope(*svt_free)) (pTHX_ SV *sv, MAGIC* mg);
20 #endif
22 struct magic {
23 MAGIC* mg_moremagic;
24 MGVTBL* mg_virtual; /* pointer to magic functions */
25 U16 mg_private;
26 char mg_type;
27 U8 mg_flags;
28 SV* mg_obj;
29 char* mg_ptr;
30 I32 mg_len;
33 #define MGf_TAINTEDDIR 1
34 #define MGf_REFCOUNTED 2
35 #define MGf_GSKIP 4
37 #define MGf_MINMATCH 1
39 #define MgTAINTEDDIR(mg) (mg->mg_flags & MGf_TAINTEDDIR)
40 #define MgTAINTEDDIR_on(mg) (mg->mg_flags |= MGf_TAINTEDDIR)
41 #define MgTAINTEDDIR_off(mg) (mg->mg_flags &= ~MGf_TAINTEDDIR)
43 #define MgPV(mg,lp) ((((int)(lp = (mg)->mg_len)) == HEf_SVKEY) ? \
44 SvPV((SV*)((mg)->mg_ptr),lp) : \
45 (mg)->mg_ptr)
47 #define SvTIED_mg(sv,how) \
48 (SvRMAGICAL(sv) ? mg_find((sv),(how)) : Null(MAGIC*))
49 #define SvTIED_obj(sv,mg) \
50 ((mg)->mg_obj ? (mg)->mg_obj : sv_2mortal(newRV(sv)))