Commit | Line | Data |
a0d0e21e |
1 | /* mg.h |
79072805 |
2 | * |
9607fc9c |
3 | * Copyright (c) 1991-1997, Larry Wall |
79072805 |
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 | * |
79072805 |
8 | */ |
9 | |
0f4eea8f |
10 | #ifdef STRUCT_MGVTBL_DEFINITION |
11 | STRUCT_MGVTBL_DEFINITION; |
12 | #else |
79072805 |
13 | struct mgvtbl { |
76e3520e |
14 | int (CPERLscope(*svt_get)) _((SV *sv, MAGIC* mg)); |
15 | int (CPERLscope(*svt_set)) _((SV *sv, MAGIC* mg)); |
16 | U32 (CPERLscope(*svt_len)) _((SV *sv, MAGIC* mg)); |
17 | int (CPERLscope(*svt_clear)) _((SV *sv, MAGIC* mg)); |
18 | int (CPERLscope(*svt_free)) _((SV *sv, MAGIC* mg)); |
79072805 |
19 | }; |
0f4eea8f |
20 | #endif |
79072805 |
21 | |
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; |
565764a8 |
30 | I32 mg_len; |
79072805 |
31 | }; |
8990e307 |
32 | |
33 | #define MGf_TAINTEDDIR 1 |
85e6fe83 |
34 | #define MGf_REFCOUNTED 2 |
a0d0e21e |
35 | #define MGf_GSKIP 4 |
748a9306 |
36 | |
37 | #define MGf_MINMATCH 1 |
38 | |
1e422769 |
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) |
99069129 |
42 | |
565764a8 |
43 | #define MgPV(mg,lp) (((lp = (mg)->mg_len) == HEf_SVKEY) ? \ |
5aabfad6 |
44 | SvPV((SV*)((mg)->mg_ptr),lp) : \ |
45 | (mg)->mg_ptr) |