Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.4 KiB

  1. /* mg.h
  2. *
  3. * Copyright (c) 1991-2001, Larry Wall
  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. */
  9. #ifdef STRUCT_MGVTBL_DEFINITION
  10. STRUCT_MGVTBL_DEFINITION;
  11. #else
  12. struct mgvtbl {
  13. int (CPERLscope(*svt_get)) (pTHX_ SV *sv, MAGIC* mg);
  14. int (CPERLscope(*svt_set)) (pTHX_ SV *sv, MAGIC* mg);
  15. U32 (CPERLscope(*svt_len)) (pTHX_ SV *sv, MAGIC* mg);
  16. int (CPERLscope(*svt_clear))(pTHX_ SV *sv, MAGIC* mg);
  17. int (CPERLscope(*svt_free)) (pTHX_ SV *sv, MAGIC* mg);
  18. };
  19. #endif
  20. struct magic {
  21. MAGIC* mg_moremagic;
  22. MGVTBL* mg_virtual; /* pointer to magic functions */
  23. U16 mg_private;
  24. char mg_type;
  25. U8 mg_flags;
  26. SV* mg_obj;
  27. char* mg_ptr;
  28. I32 mg_len;
  29. };
  30. #define MGf_TAINTEDDIR 1
  31. #define MGf_REFCOUNTED 2
  32. #define MGf_GSKIP 4
  33. #define MGf_MINMATCH 1
  34. #define MgTAINTEDDIR(mg) (mg->mg_flags & MGf_TAINTEDDIR)
  35. #define MgTAINTEDDIR_on(mg) (mg->mg_flags |= MGf_TAINTEDDIR)
  36. #define MgTAINTEDDIR_off(mg) (mg->mg_flags &= ~MGf_TAINTEDDIR)
  37. #define MgPV(mg,lp) ((((int)(lp = (mg)->mg_len)) == HEf_SVKEY) ? \
  38. SvPV((SV*)((mg)->mg_ptr),lp) : \
  39. (mg)->mg_ptr)
  40. #define SvTIED_mg(sv,how) \
  41. (SvRMAGICAL(sv) ? mg_find((sv),(how)) : Null(MAGIC*))
  42. #define SvTIED_obj(sv,mg) \
  43. ((mg)->mg_obj ? (mg)->mg_obj : sv_2mortal(newRV(sv)))