X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=sv.h;h=b9567685b0c1b72700d95614328a5516530a89c0;hb=a08f42e9ba7f15d15d2c01f54d34c1e0cef4510c;hp=0c9442a06684f76c4ff2bbc73d8af57c6db97888;hpb=b70b15d2d499beb343401898be8197f5b568dea9;p=p5sagit%2Fp5-mst-13.2.git diff --git a/sv.h b/sv.h index 0c9442a..b956768 100644 --- a/sv.h +++ b/sv.h @@ -1,6 +1,6 @@ /* sv.h * - * Copyright (c) 1991-2001, Larry Wall + * Copyright (c) 1991-2002, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -12,6 +12,8 @@ #endif /* +=head1 SV Flags + =for apidoc AmU||svtype An enum of flags for Perl types. These are found in the file B in the C enum. Test these flags with the C macro. @@ -98,6 +100,8 @@ struct io { }; /* +=head1 SV Manipulation Functions + =for apidoc Am|U32|SvREFCNT|SV* sv Returns the value of the object's reference count. @@ -157,7 +161,7 @@ perform the upgrade if necessary. See C. nsv; \ }) #else -# if defined(CRIPPLED_CC) || defined(USE_5005THREADS) +# ifdef USE_5005THREADS # if defined(VMS) && defined(__ALPHA) # define SvREFCNT_inc(sv) \ (PL_Sv=(SV*)(sv), (PL_Sv && __ATOMIC_INCREMENT_LONG(&(SvREFCNT(PL_Sv)))), (SV *)PL_Sv) @@ -351,7 +355,7 @@ struct xpvfm { #endif /* USE_5005THREADS */ cv_flags_t xcv_flags; - I32 xfm_lines; + IV xfm_lines; }; struct xpvio { @@ -378,10 +382,10 @@ struct xpvio { DIR * xiou_dirp; /* for opendir, readdir, etc */ void * xiou_any; /* for alignment */ } xio_dirpu; - long xio_lines; /* $. */ - long xio_page; /* $% */ - long xio_page_len; /* $= */ - long xio_lines_left; /* $- */ + IV xio_lines; /* $. */ + IV xio_page; /* $% */ + IV xio_page_len; /* $= */ + IV xio_lines_left; /* $- */ char * xio_top_name; /* $^ */ GV * xio_top_gv; /* $^ */ char * xio_fmt_name; /* $~ */ @@ -454,7 +458,7 @@ Returns a boolean indicating whether the SV contains an unsigned integer. Returns a boolean indicating whether the SV contains an unsigned integer. =for apidoc Am|void|SvIOK_notUV|SV* sv -Returns a boolean indicating whether the SV contains an signed integer. +Returns a boolean indicating whether the SV contains a signed integer. =for apidoc Am|bool|SvNOK|SV* sv Returns a boolean indicating whether the SV contains a double. @@ -830,24 +834,28 @@ Taints an SV if tainting is enabled /* =for apidoc Am|char*|SvPV_force|SV* sv|STRLEN len -Like but will force the SV into becoming a string (SvPOK). You want -force if you are going to update the SvPVX directly. +Like C but will force the SV into containing just a string +(C). You want force if you are going to update the C +directly. =for apidoc Am|char*|SvPV_force_nomg|SV* sv|STRLEN len -Like but will force the SV into becoming a string (SvPOK). You want -force if you are going to update the SvPVX directly. Doesn't process magic. +Like C but will force the SV into containing just a string +(C). You want force if you are going to update the C +directly. Doesn't process magic. =for apidoc Am|char*|SvPV|SV* sv|STRLEN len -Returns a pointer to the string in the SV, or a stringified form of the SV -if the SV does not contain a string. Handles 'get' magic. See also +Returns a pointer to the string in the SV, or a stringified form of +the SV if the SV does not contain a string. The SV may cache the +stringified version becoming C. Handles 'get' magic. See also C for a version which guarantees to evaluate sv only once. =for apidoc Am|char*|SvPVx|SV* sv|STRLEN len A version of C which guarantees to evaluate sv only once. =for apidoc Am|char*|SvPV_nolen|SV* sv -Returns a pointer to the string in the SV, or a stringified form of the SV -if the SV does not contain a string. Handles 'get' magic. +Returns a pointer to the string in the SV, or a stringified form of +the SV if the SV does not contain a string. The SV may cache the +stringified form becoming C. Handles 'get' magic. =for apidoc Am|IV|SvIV|SV* sv Coerces the given SV to an integer and returns it. See C for a @@ -855,7 +863,7 @@ version which guarantees to evaluate sv only once. =for apidoc Am|IV|SvIVx|SV* sv Coerces the given SV to an integer and returns it. Guarantees to evaluate -sv only once. Use the more efficent C otherwise. +sv only once. Use the more efficient C otherwise. =for apidoc Am|NV|SvNV|SV* sv Coerce the given SV to a double and return it. See C for a version @@ -863,7 +871,7 @@ which guarantees to evaluate sv only once. =for apidoc Am|NV|SvNVx|SV* sv Coerces the given SV to a double and returns it. Guarantees to evaluate -sv only once. Use the more efficent C otherwise. +sv only once. Use the more efficient C otherwise. =for apidoc Am|UV|SvUV|SV* sv Coerces the given SV to an unsigned integer and returns it. See C @@ -871,7 +879,7 @@ for a version which guarantees to evaluate sv only once. =for apidoc Am|UV|SvUVx|SV* sv Coerces the given SV to an unsigned integer and returns it. Guarantees to -evaluate sv only once. Use the more efficent C otherwise. +evaluate sv only once. Use the more efficient C otherwise. =for apidoc Am|bool|SvTRUE|SV* sv Returns a boolean indicating whether Perl would evaluate the SV as true or @@ -897,22 +905,22 @@ Like C, but converts sv to byte representation first if necessary. =for apidoc Am|char*|SvPVutf8x_force|SV* sv|STRLEN len Like C, but converts sv to utf8 first if necessary. -Guarantees to evalute sv only once; use the more efficient C +Guarantees to evaluate sv only once; use the more efficient C otherwise. =for apidoc Am|char*|SvPVutf8x|SV* sv|STRLEN len Like C, but converts sv to utf8 first if necessary. -Guarantees to evalute sv only once; use the more efficient C +Guarantees to evaluate sv only once; use the more efficient C otherwise. =for apidoc Am|char*|SvPVbytex_force|SV* sv|STRLEN len Like C, but converts sv to byte representation first if necessary. -Guarantees to evalute sv only once; use the more efficient C +Guarantees to evaluate sv only once; use the more efficient C otherwise. =for apidoc Am|char*|SvPVbytex|SV* sv|STRLEN len Like C, but converts sv to byte representation first if necessary. -Guarantees to evalute sv only once; use the more efficient C +Guarantees to evaluate sv only once; use the more efficient C otherwise. @@ -959,7 +967,7 @@ otherwise. #define sv_utf8_upgrade_nomg(sv) sv_utf8_upgrade_flags(sv, 0) #define sv_catpvn_nomg(dsv, sstr, slen) sv_catpvn_flags(dsv, sstr, slen, 0) -#ifndef CRIPPLED_CC +/* #ifndef CRIPPLED_CC */ /* redefine some things to more efficient inlined versions */ /* Let us hope that bitmaps for UV and IV are the same */ @@ -1123,7 +1131,7 @@ otherwise. # define SvTRUEx(sv) ((PL_Sv = (sv)), SvTRUE(PL_Sv)) #endif /* !USE_5005THREADS */ #endif /* !__GNU__ */ -#endif /* !CRIPPLED_CC */ +/* #endif !CRIPPLED_CC */ /* =for apidoc Am|SV*|newRV_inc|SV* sv @@ -1139,6 +1147,8 @@ incremented. /* the following macros update any magic values this sv is associated with */ /* +=head1 Magical Functions + =for apidoc Am|void|SvGETMAGIC|SV* sv Invokes C on an SV if it has 'get' magic. This macro evaluates its argument more than once. @@ -1161,6 +1171,20 @@ Like C, but does any set magic required afterwards. =for apidoc Am|void|SvSetMagicSV_nosteal|SV* dsv|SV* ssv Like C, but does any set magic required afterwards. +=for apidoc Am|void|SvSHARE|SV* sv +Arranges for sv to be shared between threads if a suitable module +has been loaded. + +=for apidoc Am|void|SvLOCK|SV* sv +Arranges for a mutual exclusion lock to be obtained on sv if a suitable module +has been loaded. + +=for apidoc Am|void|SvUNLOCK|SV* sv +Releases a mutual exclusion lock on sv if a suitable module +has been loaded. + +=head1 SV Manipulation Functions + =for apidoc Am|char *|SvGROW|SV* sv|STRLEN len Expands the character buffer in the SV so that it has room for the indicated number of bytes (remember to reserve space for an extra trailing @@ -1170,6 +1194,10 @@ Returns a pointer to the character buffer. =cut */ +#define SvSHARE(sv) CALL_FPTR(PL_sharehook)(aTHX_ sv) +#define SvLOCK(sv) CALL_FPTR(PL_lockhook)(aTHX_ sv) +#define SvUNLOCK(sv) CALL_FPTR(PL_unlockhook)(aTHX_ sv) + #define SvGETMAGIC(x) STMT_START { if (SvGMAGICAL(x)) mg_get(x); } STMT_END #define SvSETMAGIC(x) STMT_START { if (SvSMAGICAL(x)) mg_set(x); } STMT_END @@ -1201,7 +1229,7 @@ Returns a pointer to the character buffer. #define SvSetMagicSV_nosteal(dst,src) \ SvSetSV_nosteal_and(dst,src,SvSETMAGIC(dst)) -#ifdef DEBUGGING +#if !defined(SKIP_DEBUGGING) #define SvPEEK(sv) sv_peek(sv) #else #define SvPEEK(sv) ""