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.

124 lines
4.3 KiB

  1. /* cv.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. /* This structure much match XPVCV in B/C.pm and the beginning of XPVFM
  10. * in sv.h */
  11. struct xpvcv {
  12. char * xpv_pv; /* pointer to malloced string */
  13. STRLEN xpv_cur; /* length of xp_pv as a C string */
  14. STRLEN xpv_len; /* allocated size */
  15. IV xof_off; /* integer value */
  16. NV xnv_nv; /* numeric value, if any */
  17. MAGIC* xmg_magic; /* magic for scalar array */
  18. HV* xmg_stash; /* class package */
  19. HV * xcv_stash;
  20. OP * xcv_start;
  21. OP * xcv_root;
  22. void (*xcv_xsub) (pTHXo_ CV*);
  23. ANY xcv_xsubany;
  24. GV * xcv_gv;
  25. char * xcv_file;
  26. long xcv_depth; /* >= 2 indicates recursive call */
  27. AV * xcv_padlist;
  28. CV * xcv_outside;
  29. #ifdef USE_THREADS
  30. perl_mutex *xcv_mutexp;
  31. struct perl_thread *xcv_owner; /* current owner thread */
  32. #endif /* USE_THREADS */
  33. cv_flags_t xcv_flags;
  34. };
  35. /*
  36. =for apidoc AmU||Nullcv
  37. Null CV pointer.
  38. =for apidoc Am|HV*|CvSTASH|CV* cv
  39. Returns the stash of the CV.
  40. =cut
  41. */
  42. #define Nullcv Null(CV*)
  43. #define CvSTASH(sv) ((XPVCV*)SvANY(sv))->xcv_stash
  44. #define CvSTART(sv) ((XPVCV*)SvANY(sv))->xcv_start
  45. #define CvROOT(sv) ((XPVCV*)SvANY(sv))->xcv_root
  46. #define CvXSUB(sv) ((XPVCV*)SvANY(sv))->xcv_xsub
  47. #define CvXSUBANY(sv) ((XPVCV*)SvANY(sv))->xcv_xsubany
  48. #define CvGV(sv) ((XPVCV*)SvANY(sv))->xcv_gv
  49. #define CvFILE(sv) ((XPVCV*)SvANY(sv))->xcv_file
  50. #define CvFILEGV(sv) (gv_fetchfile(CvFILE(sv))
  51. #define CvDEPTH(sv) ((XPVCV*)SvANY(sv))->xcv_depth
  52. #define CvPADLIST(sv) ((XPVCV*)SvANY(sv))->xcv_padlist
  53. #define CvOUTSIDE(sv) ((XPVCV*)SvANY(sv))->xcv_outside
  54. #ifdef USE_THREADS
  55. #define CvMUTEXP(sv) ((XPVCV*)SvANY(sv))->xcv_mutexp
  56. #define CvOWNER(sv) ((XPVCV*)SvANY(sv))->xcv_owner
  57. #endif /* USE_THREADS */
  58. #define CvFLAGS(sv) ((XPVCV*)SvANY(sv))->xcv_flags
  59. #define CVf_CLONE 0x0001 /* anon CV uses external lexicals */
  60. #define CVf_CLONED 0x0002 /* a clone of one of those */
  61. #define CVf_ANON 0x0004 /* CvGV() can't be trusted */
  62. #define CVf_OLDSTYLE 0x0008
  63. #define CVf_UNIQUE 0x0010 /* can't be cloned */
  64. #define CVf_NODEBUG 0x0020 /* no DB::sub indirection for this CV
  65. (esp. useful for special XSUBs) */
  66. #define CVf_METHOD 0x0040 /* CV is explicitly marked as a method */
  67. #define CVf_LOCKED 0x0080 /* CV locks itself or first arg on entry */
  68. #define CVf_LVALUE 0x0100 /* CV return value can be used as lvalue */
  69. #define CvCLONE(cv) (CvFLAGS(cv) & CVf_CLONE)
  70. #define CvCLONE_on(cv) (CvFLAGS(cv) |= CVf_CLONE)
  71. #define CvCLONE_off(cv) (CvFLAGS(cv) &= ~CVf_CLONE)
  72. #define CvCLONED(cv) (CvFLAGS(cv) & CVf_CLONED)
  73. #define CvCLONED_on(cv) (CvFLAGS(cv) |= CVf_CLONED)
  74. #define CvCLONED_off(cv) (CvFLAGS(cv) &= ~CVf_CLONED)
  75. #define CvANON(cv) (CvFLAGS(cv) & CVf_ANON)
  76. #define CvANON_on(cv) (CvFLAGS(cv) |= CVf_ANON)
  77. #define CvANON_off(cv) (CvFLAGS(cv) &= ~CVf_ANON)
  78. #ifdef PERL_XSUB_OLDSTYLE
  79. #define CvOLDSTYLE(cv) (CvFLAGS(cv) & CVf_OLDSTYLE)
  80. #define CvOLDSTYLE_on(cv) (CvFLAGS(cv) |= CVf_OLDSTYLE)
  81. #define CvOLDSTYLE_off(cv) (CvFLAGS(cv) &= ~CVf_OLDSTYLE)
  82. #endif
  83. #define CvUNIQUE(cv) (CvFLAGS(cv) & CVf_UNIQUE)
  84. #define CvUNIQUE_on(cv) (CvFLAGS(cv) |= CVf_UNIQUE)
  85. #define CvUNIQUE_off(cv) (CvFLAGS(cv) &= ~CVf_UNIQUE)
  86. #define CvNODEBUG(cv) (CvFLAGS(cv) & CVf_NODEBUG)
  87. #define CvNODEBUG_on(cv) (CvFLAGS(cv) |= CVf_NODEBUG)
  88. #define CvNODEBUG_off(cv) (CvFLAGS(cv) &= ~CVf_NODEBUG)
  89. #define CvMETHOD(cv) (CvFLAGS(cv) & CVf_METHOD)
  90. #define CvMETHOD_on(cv) (CvFLAGS(cv) |= CVf_METHOD)
  91. #define CvMETHOD_off(cv) (CvFLAGS(cv) &= ~CVf_METHOD)
  92. #define CvLOCKED(cv) (CvFLAGS(cv) & CVf_LOCKED)
  93. #define CvLOCKED_on(cv) (CvFLAGS(cv) |= CVf_LOCKED)
  94. #define CvLOCKED_off(cv) (CvFLAGS(cv) &= ~CVf_LOCKED)
  95. #define CvLVALUE(cv) (CvFLAGS(cv) & CVf_LVALUE)
  96. #define CvLVALUE_on(cv) (CvFLAGS(cv) |= CVf_LVALUE)
  97. #define CvLVALUE_off(cv) (CvFLAGS(cv) &= ~CVf_LVALUE)
  98. #define CvEVAL(cv) (CvUNIQUE(cv) && !SvFAKE(cv))
  99. #define CvEVAL_on(cv) (CvUNIQUE_on(cv),SvFAKE_off(cv))
  100. #define CvEVAL_off(cv) CvUNIQUE_off(cv)
  101. /* BEGIN|INIT|END */
  102. #define CvSPECIAL(cv) (CvUNIQUE(cv) && SvFAKE(cv))
  103. #define CvSPECIAL_on(cv) (CvUNIQUE_on(cv),SvFAKE_on(cv))
  104. #define CvSPECIAL_off(cv) (CvUNIQUE_off(cv),SvFAKE_off(cv))