The inversion list is an opaque object, currently implemented as an SV.
Even if it ends up being an HV in the future, Nicholas is of the opinion
that it should be presented to the world as an SV*.
|NN const struct regnode *node|bool doinit \
|NULLOK SV **listsvp|NULLOK SV **altsvp
#ifdef PERL_IN_REGCOMP_C
-EMi |U8 |set_regclass_bit|NN struct RExC_state_t* pRExC_state|NN regnode* node|const U8 value|NN HV** invlist_ptr|NN AV** alternate_ptr
-EMs |U8 |set_regclass_bit_fold|NN struct RExC_state_t *pRExC_state|NN regnode* node|const U8 value|NN HV** invlist_ptr|NN AV** alternate_ptr
+EMi |U8 |set_regclass_bit|NN struct RExC_state_t* pRExC_state|NN regnode* node|const U8 value|NN SV** invlist_ptr|NN AV** alternate_ptr
+EMs |U8 |set_regclass_bit_fold|NN struct RExC_state_t *pRExC_state|NN regnode* node|const U8 value|NN SV** invlist_ptr|NN AV** alternate_ptr
EMs |void |add_alternate |NN AV** alternate_ptr|NN U8* string|STRLEN len
#endif
Ap |I32 |pregexec |NN REGEXP * const prog|NN char* stringarg \
Ap |SV* |swash_init |NN const char* pkg|NN const char* name|NN SV* listsv|I32 minbits|I32 none
Ap |UV |swash_fetch |NN SV *swash|NN const U8 *ptr|bool do_utf8
EXMpR |HV* |_swash_inversion_hash |NN SV* const swash
-EXMpR |HV* |_new_invlist |IV initial_size
-EXMpR |HV* |_swash_to_invlist |NN SV* const swash
-EXMp |void |_append_range_to_invlist |NN HV* const invlist|const UV start|const UV end
+EXMpR |SV* |_new_invlist |IV initial_size
+EXMpR |SV* |_swash_to_invlist |NN SV* const swash
+EXMp |void |_append_range_to_invlist |NN SV* const invlist|const UV start|const UV end
#ifdef PERL_IN_REGCOMP_C
-EiMR |HV* |add_cp_to_invlist |NULLOK HV* invlist|const UV cp
-EsMR |HV* |add_range_to_invlist |NULLOK HV* invlist|const UV start|const UV end
-EiMR |UV* |invlist_array |NN HV* const invlist
-EiM |void |invlist_destroy |NN HV* const invlist
-EsM |void |invlist_extend |NN HV* const invlist|const UV len
-EsMR |HV* |invlist_intersection |NN HV* const a|NN HV* const b
-EiMR |UV |invlist_len |NN HV* const invlist
-EiMR |UV |invlist_max |NN HV* const invlist
-EiM |void |invlist_set_len |NN HV* const invlist|const UV len
-EiM |void |invlist_set_max |NN HV* const invlist|const UV max
-EiM |void |invlist_trim |NN HV* const invlist
-EsMR |HV* |invlist_union |NN HV* const a|NN HV* const b
+EiMR |SV* |add_cp_to_invlist |NULLOK SV* invlist|const UV cp
+EsMR |SV* |add_range_to_invlist |NULLOK SV* invlist|const UV start|const UV end
+EiMR |UV* |invlist_array |NN SV* const invlist
+EiM |void |invlist_destroy |NN SV* const invlist
+EsM |void |invlist_extend |NN SV* const invlist|const UV len
+EsMR |SV* |invlist_intersection |NN SV* const a|NN SV* const b
+EiMR |UV |invlist_len |NN SV* const invlist
+EiMR |UV |invlist_max |NN SV* const invlist
+EiM |void |invlist_set_len |NN SV* const invlist|const UV len
+EiM |void |invlist_set_max |NN SV* const invlist|const UV max
+EiM |void |invlist_trim |NN SV* const invlist
+EsMR |SV* |invlist_union |NN SV* const a|NN SV* const b
#endif
Ap |void |taint_env
Ap |void |taint_proper |NULLOK const char* f|NN const char *const s
/* List of characters that participate in folds (except marks, etc in
* multi-char folds) */
-PERLVARI(Iutf8_foldable, HV *, NULL)
+PERLVARI(Iutf8_foldable, SV *, NULL)
PERLVAR(Icustom_ops, HV *) /* custom op registrations */
assert(stash)
PERL_CALLCONV const char * Perl_PerlIO_context_layers(pTHX_ const char *mode);
-PERL_CALLCONV void Perl__append_range_to_invlist(pTHX_ HV* const invlist, const UV start, const UV end)
+PERL_CALLCONV void Perl__append_range_to_invlist(pTHX_ SV* const invlist, const UV start, const UV end)
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT__APPEND_RANGE_TO_INVLIST \
assert(invlist)
-PERL_CALLCONV HV* Perl__new_invlist(pTHX_ IV initial_size)
+PERL_CALLCONV SV* Perl__new_invlist(pTHX_ IV initial_size)
__attribute__warn_unused_result__;
PERL_CALLCONV HV* Perl__swash_inversion_hash(pTHX_ SV* const swash)
#define PERL_ARGS_ASSERT__SWASH_INVERSION_HASH \
assert(swash)
-PERL_CALLCONV HV* Perl__swash_to_invlist(pTHX_ SV* const swash)
+PERL_CALLCONV SV* Perl__swash_to_invlist(pTHX_ SV* const swash)
__attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT__SWASH_TO_INVLIST \
#define PERL_ARGS_ASSERT_ADD_ALTERNATE \
assert(alternate_ptr); assert(string)
-PERL_STATIC_INLINE HV* S_add_cp_to_invlist(pTHX_ HV* invlist, const UV cp)
+PERL_STATIC_INLINE SV* S_add_cp_to_invlist(pTHX_ SV* invlist, const UV cp)
__attribute__warn_unused_result__;
STATIC U32 S_add_data(struct RExC_state_t *pRExC_state, U32 n, const char *s)
#define PERL_ARGS_ASSERT_ADD_DATA \
assert(pRExC_state); assert(s)
-STATIC HV* S_add_range_to_invlist(pTHX_ HV* invlist, const UV start, const UV end)
+STATIC SV* S_add_range_to_invlist(pTHX_ SV* invlist, const UV start, const UV end)
__attribute__warn_unused_result__;
STATIC void S_checkposixcc(pTHX_ struct RExC_state_t *pRExC_state)
#define PERL_ARGS_ASSERT_CL_OR \
assert(pRExC_state); assert(cl); assert(or_with)
-PERL_STATIC_INLINE UV* S_invlist_array(pTHX_ HV* const invlist)
+PERL_STATIC_INLINE UV* S_invlist_array(pTHX_ SV* const invlist)
__attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_INVLIST_ARRAY \
assert(invlist)
-PERL_STATIC_INLINE void S_invlist_destroy(pTHX_ HV* const invlist)
+PERL_STATIC_INLINE void S_invlist_destroy(pTHX_ SV* const invlist)
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_INVLIST_DESTROY \
assert(invlist)
-STATIC void S_invlist_extend(pTHX_ HV* const invlist, const UV len)
+STATIC void S_invlist_extend(pTHX_ SV* const invlist, const UV len)
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_INVLIST_EXTEND \
assert(invlist)
-STATIC HV* S_invlist_intersection(pTHX_ HV* const a, HV* const b)
+STATIC SV* S_invlist_intersection(pTHX_ SV* const a, SV* const b)
__attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2);
#define PERL_ARGS_ASSERT_INVLIST_INTERSECTION \
assert(a); assert(b)
-PERL_STATIC_INLINE UV S_invlist_len(pTHX_ HV* const invlist)
+PERL_STATIC_INLINE UV S_invlist_len(pTHX_ SV* const invlist)
__attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_INVLIST_LEN \
assert(invlist)
-PERL_STATIC_INLINE UV S_invlist_max(pTHX_ HV* const invlist)
+PERL_STATIC_INLINE UV S_invlist_max(pTHX_ SV* const invlist)
__attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_INVLIST_MAX \
assert(invlist)
-PERL_STATIC_INLINE void S_invlist_set_len(pTHX_ HV* const invlist, const UV len)
+PERL_STATIC_INLINE void S_invlist_set_len(pTHX_ SV* const invlist, const UV len)
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_INVLIST_SET_LEN \
assert(invlist)
-PERL_STATIC_INLINE void S_invlist_set_max(pTHX_ HV* const invlist, const UV max)
+PERL_STATIC_INLINE void S_invlist_set_max(pTHX_ SV* const invlist, const UV max)
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_INVLIST_SET_MAX \
assert(invlist)
-PERL_STATIC_INLINE void S_invlist_trim(pTHX_ HV* const invlist)
+PERL_STATIC_INLINE void S_invlist_trim(pTHX_ SV* const invlist)
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_INVLIST_TRIM \
assert(invlist)
-STATIC HV* S_invlist_union(pTHX_ HV* const a, HV* const b)
+STATIC SV* S_invlist_union(pTHX_ SV* const a, SV* const b)
__attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2);
#define PERL_ARGS_ASSERT_SCAN_COMMIT \
assert(pRExC_state); assert(data); assert(minlenp)
-PERL_STATIC_INLINE U8 S_set_regclass_bit(pTHX_ struct RExC_state_t* pRExC_state, regnode* node, const U8 value, HV** invlist_ptr, AV** alternate_ptr)
+PERL_STATIC_INLINE U8 S_set_regclass_bit(pTHX_ struct RExC_state_t* pRExC_state, regnode* node, const U8 value, SV** invlist_ptr, AV** alternate_ptr)
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2)
__attribute__nonnull__(pTHX_4)
#define PERL_ARGS_ASSERT_SET_REGCLASS_BIT \
assert(pRExC_state); assert(node); assert(invlist_ptr); assert(alternate_ptr)
-STATIC U8 S_set_regclass_bit_fold(pTHX_ struct RExC_state_t *pRExC_state, regnode* node, const U8 value, HV** invlist_ptr, AV** alternate_ptr)
+STATIC U8 S_set_regclass_bit_fold(pTHX_ struct RExC_state_t *pRExC_state, regnode* node, const U8 value, SV** invlist_ptr, AV** alternate_ptr)
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2)
__attribute__nonnull__(pTHX_4)
* this file. An inversion list is here implemented as a malloc'd C array with
* some added info. More will be coming when functionality is added later.
*
- * It is currently implemented as an HV to the outside world, but is actually
- * an SV pointing to an array of UVs that the SV thinks are bytes. This allows
- * us to have an array of UV whose memory management is automatically handled
- * by the existing facilities for SV's.
+ * It is currently implemented as an SV pointing to an array of UVs that the SV
+ * thinks are bytes. This allows us to have an array of UV whose memory
+ * management is automatically handled by the existing facilities for SV's.
*
* Some of the methods should always be private to the implementation, and some
* should eventually be made public */
#define INVLIST_INITIAL_LEN 10
PERL_STATIC_INLINE UV*
-S_invlist_array(pTHX_ HV* const invlist)
+S_invlist_array(pTHX_ SV* const invlist)
{
/* Returns the pointer to the inversion list's array. Every time the
* length changes, this needs to be called in case malloc or realloc moved
}
PERL_STATIC_INLINE UV
-S_invlist_len(pTHX_ HV* const invlist)
+S_invlist_len(pTHX_ SV* const invlist)
{
/* Returns the current number of elements in the inversion list's array */
}
PERL_STATIC_INLINE UV
-S_invlist_max(pTHX_ HV* const invlist)
+S_invlist_max(pTHX_ SV* const invlist)
{
/* Returns the maximum number of elements storable in the inversion list's
* array, without having to realloc() */
}
PERL_STATIC_INLINE void
-S_invlist_set_len(pTHX_ HV* const invlist, const UV len)
+S_invlist_set_len(pTHX_ SV* const invlist, const UV len)
{
/* Sets the current number of elements stored in the inversion list */
}
PERL_STATIC_INLINE void
-S_invlist_set_max(pTHX_ HV* const invlist, const UV max)
+S_invlist_set_max(pTHX_ SV* const invlist, const UV max)
{
/* Sets the maximum number of elements storable in the inversion list
}
#ifndef PERL_IN_XSUB_RE
-HV*
+SV*
Perl__new_invlist(pTHX_ IV initial_size)
{
}
/* Allocate the initial space */
- return (HV *) newSV(initial_size * sizeof(UV));
+ return newSV(initial_size * sizeof(UV));
}
#endif
PERL_STATIC_INLINE void
-S_invlist_destroy(pTHX_ HV* const invlist)
+S_invlist_destroy(pTHX_ SV* const invlist)
{
/* Inversion list destructor */
}
STATIC void
-S_invlist_extend(pTHX_ HV* const invlist, const UV new_max)
+S_invlist_extend(pTHX_ SV* const invlist, const UV new_max)
{
/* Grow the maximum size of an inversion list */
}
PERL_STATIC_INLINE void
-S_invlist_trim(pTHX_ HV* const invlist)
+S_invlist_trim(pTHX_ SV* const invlist)
{
PERL_ARGS_ASSERT_INVLIST_TRIM;
#ifndef PERL_IN_XSUB_RE
void
-Perl__append_range_to_invlist(pTHX_ HV* const invlist, const UV start, const UV end)
+Perl__append_range_to_invlist(pTHX_ SV* const invlist, const UV start, const UV end)
{
/* Subject to change or removal. Append the range from 'start' to 'end' at
* the end of the inversion list. The range must be above any existing
}
#endif
-STATIC HV*
-S_invlist_union(pTHX_ HV* const a, HV* const b)
+STATIC SV*
+S_invlist_union(pTHX_ SV* const a, SV* const b)
{
/* Return a new inversion list which is the union of two inversion lists.
* The basis for this comes from "Unicode Demystified" Chapter 13 by
UV len_a = invlist_len(a); /* length of a's array */
UV len_b = invlist_len(b);
- HV* u; /* the resulting union */
+ SV* u; /* the resulting union */
UV* array_u;
UV len_u;
return u;
}
-STATIC HV*
-S_invlist_intersection(pTHX_ HV* const a, HV* const b)
+STATIC SV*
+S_invlist_intersection(pTHX_ SV* const a, SV* const b)
{
/* Return the intersection of two inversion lists. The basis for this
* comes from "Unicode Demystified" Chapter 13 by Richard Gillam, published
UV len_a = invlist_len(a); /* length of a's array */
UV len_b = invlist_len(b);
- HV* r; /* the resulting intersection */
+ SV* r; /* the resulting intersection */
UV* array_r;
UV len_r;
return r;
}
-STATIC HV*
-S_add_range_to_invlist(pTHX_ HV* invlist, const UV start, const UV end)
+STATIC SV*
+S_add_range_to_invlist(pTHX_ SV* invlist, const UV start, const UV end)
{
/* Add the range from 'start' to 'end' inclusive to the inversion list's
* set. A pointer to the inversion list is returned. This may actually be
* passed in inversion list can be NULL, in which case a new one is created
* with just the one range in it */
- HV* range_invlist;
- HV* added_invlist;
+ SV* range_invlist;
+ SV* added_invlist;
UV len;
if (invlist == NULL) {
return added_invlist;
}
-PERL_STATIC_INLINE HV*
-S_add_cp_to_invlist(pTHX_ HV* invlist, const UV cp) {
+PERL_STATIC_INLINE SV*
+S_add_cp_to_invlist(pTHX_ SV* invlist, const UV cp) {
return add_range_to_invlist(invlist, cp, cp);
}
break
STATIC U8
-S_set_regclass_bit_fold(pTHX_ RExC_state_t *pRExC_state, regnode* node, const U8 value, HV** invlist_ptr, AV** alternate_ptr)
+S_set_regclass_bit_fold(pTHX_ RExC_state_t *pRExC_state, regnode* node, const U8 value, SV** invlist_ptr, AV** alternate_ptr)
{
/* Handle the setting of folds in the bitmap for non-locale ANYOF nodes.
PERL_STATIC_INLINE U8
-S_set_regclass_bit(pTHX_ RExC_state_t *pRExC_state, regnode* node, const U8 value, HV** invlist_ptr, AV** alternate_ptr)
+S_set_regclass_bit(pTHX_ RExC_state_t *pRExC_state, regnode* node, const U8 value, SV** invlist_ptr, AV** alternate_ptr)
{
/* This inline function sets a bit in the bitmap if not already set, and if
* appropriate, its fold, returning the number of bits that actually
UV n;
/* code points this node matches that can't be stored in the bitmap */
- HV* nonbitmap = NULL;
+ SV* nonbitmap = NULL;
/* The items that are to match that aren't stored in the bitmap, but are a
* result of things that are stored there. This is the fold closure of
* that matches. A 2nd list is used so that the 'nonbitmap' list is kept
* empty unless there is something whose fold we don't know about, and will
* have to go out to the disk to find. */
- HV* l1_fold_invlist = NULL;
+ SV* l1_fold_invlist = NULL;
/* List of multi-character folds that are matched by this node */
AV* unicode_alternate = NULL;
if (FOLD && nonbitmap) {
UV i;
- HV* fold_intersection;
+ SV* fold_intersection;
UV* fold_list;
/* This is a list of all the characters that participate in folds
/* Combine the two lists into one. */
if (l1_fold_invlist) {
if (nonbitmap) {
- HV* temp = invlist_union(nonbitmap, l1_fold_invlist);
+ SV* temp = invlist_union(nonbitmap, l1_fold_invlist);
invlist_destroy(nonbitmap);
nonbitmap = temp;
invlist_destroy(l1_fold_invlist);
return ret;
}
-HV*
+SV*
Perl__swash_to_invlist(pTHX_ SV* const swash)
{
const STRLEN bits = SvUV(*bitssvp);
const STRLEN octets = bits >> 3; /* if bits == 1, then octets == 0 */
- HV* invlist;
+ SV* invlist;
PERL_ARGS_ASSERT__SWASH_TO_INVLIST;