Permalink
Browse files

s/Indexing/Positional/ in REPR funcs.

Makes it more consistent with Perl 6 terminology and the naming on the
JVM.
  • Loading branch information...
jnthn committed Feb 9, 2013
1 parent 723aae4 commit 030ba9b0904291e9abe977569886f1eafb0a0850
Showing with 39 additions and 39 deletions.
  1. +15 −15 src/6model/repr_registry.c
  2. +11 −11 src/6model/reprs/CArray.c
  3. +4 −4 src/6model/sixmodelobject.h
  4. +9 −9 src/ops/nqp.ops
View
@@ -135,19 +135,19 @@ static void add_default_box_funcs(PARROT_INTERP, REPROps *repr) {
repr->box_funcs->get_boxed_ref = default_get_boxed_ref;
}
-/* Set default indexing functions on a REPR that lacks them. */
-static void add_default_idx_funcs(PARROT_INTERP, REPROps *repr) {
- repr->idx_funcs = mem_allocate_typed(REPROps_Indexing);
- repr->idx_funcs->at_pos_native = default_at_pos_native;
- repr->idx_funcs->at_pos_boxed = default_at_pos_boxed;
- repr->idx_funcs->bind_pos_native = default_bind_pos_native;
- repr->idx_funcs->bind_pos_boxed = default_bind_pos_boxed;
- repr->idx_funcs->elems = default_elems;
- repr->idx_funcs->preallocate = default_preallocate;
- repr->idx_funcs->trim_to = default_trim_to;
- repr->idx_funcs->make_hole = default_make_hole;
- repr->idx_funcs->delete_elems = default_delete_elems;
- repr->idx_funcs->get_elem_stable = default_get_elem_stable;
+/* Set default positional functions on a REPR that lacks them. */
+static void add_default_pos_funcs(PARROT_INTERP, REPROps *repr) {
+ repr->pos_funcs = mem_allocate_typed(REPROps_Positional);
+ repr->pos_funcs->at_pos_native = default_at_pos_native;
+ repr->pos_funcs->at_pos_boxed = default_at_pos_boxed;
+ repr->pos_funcs->bind_pos_native = default_bind_pos_native;
+ repr->pos_funcs->bind_pos_boxed = default_bind_pos_boxed;
+ repr->pos_funcs->elems = default_elems;
+ repr->pos_funcs->preallocate = default_preallocate;
+ repr->pos_funcs->trim_to = default_trim_to;
+ repr->pos_funcs->make_hole = default_make_hole;
+ repr->pos_funcs->delete_elems = default_delete_elems;
+ repr->pos_funcs->get_elem_stable = default_get_elem_stable;
}
/* Registers a representation. It this is ever made public, it should first be
@@ -167,8 +167,8 @@ static void register_repr(PARROT_INTERP, STRING *name, REPROps *repr) {
add_default_attr_funcs(interp, repr);
if (!repr->box_funcs)
add_default_box_funcs(interp, repr);
- if (!repr->idx_funcs)
- add_default_idx_funcs(interp, repr);
+ if (!repr->pos_funcs)
+ add_default_pos_funcs(interp, repr);
}
/* Dynamically registers a representation (that is, one defined outside of
View
@@ -510,17 +510,17 @@ REPROps * CArray_initialize(PARROT_INTERP,
this_repr->gc_free = gc_free;
this_repr->gc_mark = gc_mark;
this_repr->get_storage_spec = get_storage_spec;
- this_repr->idx_funcs = mem_allocate_zeroed_typed(REPROps_Indexing);
- this_repr->idx_funcs->at_pos_native = at_pos_native;
- this_repr->idx_funcs->at_pos_boxed = at_pos_boxed;
- this_repr->idx_funcs->bind_pos_native = bind_pos_native;
- this_repr->idx_funcs->bind_pos_boxed = bind_pos_boxed;
- this_repr->idx_funcs->elems = elems;
- this_repr->idx_funcs->preallocate = preallocate;
- this_repr->idx_funcs->trim_to = trim_to;
- this_repr->idx_funcs->make_hole = make_hole;
- this_repr->idx_funcs->delete_elems = delete_elems;
- this_repr->idx_funcs->get_elem_stable = get_elem_stable;
+ this_repr->pos_funcs = mem_allocate_zeroed_typed(REPROps_Positional);
+ this_repr->pos_funcs->at_pos_native = at_pos_native;
+ this_repr->pos_funcs->at_pos_boxed = at_pos_boxed;
+ this_repr->pos_funcs->bind_pos_native = bind_pos_native;
+ this_repr->pos_funcs->bind_pos_boxed = bind_pos_boxed;
+ this_repr->pos_funcs->elems = elems;
+ this_repr->pos_funcs->preallocate = preallocate;
+ this_repr->pos_funcs->trim_to = trim_to;
+ this_repr->pos_funcs->make_hole = make_hole;
+ this_repr->pos_funcs->delete_elems = delete_elems;
+ this_repr->pos_funcs->get_elem_stable = get_elem_stable;
this_repr->serialize_repr_data = serialize_repr_data;
this_repr->deserialize_repr_data = deserialize_repr_data;
@@ -239,7 +239,7 @@ typedef struct SixModel_REPROps_Boxing {
* them. */
void * (*get_boxed_ref) (PARROT_INTERP, STable *st, void *data, INTVAL repr_id);
} REPROps_Boxing;
-typedef struct SixModel_REPROps_Indexing {
+typedef struct SixModel_REPROps_Positional {
/* Get a flattened native value, of the type specified in value->type. It
* is the caller's responsibility to make sure the stored data is of the
* appropriate type. May throw to indicate out of bounds, or vivify. */
@@ -276,7 +276,7 @@ typedef struct SixModel_REPROps_Indexing {
/* Gets the STable representing the declared element type. */
STable * (*get_elem_stable) (PARROT_INTERP, STable *st);
-} REPROps_Indexing;
+} REPROps_Positional;
struct SixModel_REPROps {
/* Creates a new type object of this representation, and
* associates it with the given HOW. Also sets up a new
@@ -311,8 +311,8 @@ struct SixModel_REPROps {
/* Boxing REPR function table. */
struct SixModel_REPROps_Boxing *box_funcs;
- /* Indexing REPR function table. */
- struct SixModel_REPROps_Indexing *idx_funcs;
+ /* Positional REPR function table. */
+ struct SixModel_REPROps_Positional *pos_funcs;
/* Gets the storage specification for this representation. */
storage_spec (*get_storage_spec) (PARROT_INTERP, STable *st);
View
@@ -1131,7 +1131,7 @@ inline op repr_at_pos_obj(out PMC, invar PMC, in INT) :base_core {
PMC *obj = decontainerize(interp, $2);
if (obj->vtable->base_type == smo_id) {
if (IS_CONCRETE(obj))
- $1 = REPR(obj)->idx_funcs->at_pos_boxed(interp, STABLE(obj), OBJECT_BODY(obj), $3);
+ $1 = REPR(obj)->pos_funcs->at_pos_boxed(interp, STABLE(obj), OBJECT_BODY(obj), $3);
else
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
"Cannot do at_pos on a type object");
@@ -1156,11 +1156,11 @@ Gets an element from the specified position, as an integer.
inline op repr_at_pos_int(out INT, invar PMC, in INT) :base_core {
PMC *obj = decontainerize(interp, $2);
if (obj->vtable->base_type == smo_id) {
- STable *elem_st = REPR(obj)->idx_funcs->get_elem_stable(interp, STABLE(obj));
+ STable *elem_st = REPR(obj)->pos_funcs->get_elem_stable(interp, STABLE(obj));
if (IS_CONCRETE(obj)) {
NativeValue value;
value.type = NATIVE_VALUE_INT;
- REPR(obj)->idx_funcs->at_pos_native(interp, STABLE(obj), OBJECT_BODY(obj), $3, &value);
+ REPR(obj)->pos_funcs->at_pos_native(interp, STABLE(obj), OBJECT_BODY(obj), $3, &value);
$1 = value.value.intval;
}
else
@@ -1185,11 +1185,11 @@ Gets an element from the specified position, as an floating point number.
inline op repr_at_pos_num(out NUM, invar PMC, in INT) :base_core {
PMC *obj = decontainerize(interp, $2);
if (obj->vtable->base_type == smo_id) {
- STable *elem_st = REPR(obj)->idx_funcs->get_elem_stable(interp, STABLE(obj));
+ STable *elem_st = REPR(obj)->pos_funcs->get_elem_stable(interp, STABLE(obj));
if (IS_CONCRETE(obj)) {
NativeValue value;
value.type = NATIVE_VALUE_FLOAT;
- REPR(obj)->idx_funcs->at_pos_native(interp, STABLE(obj), OBJECT_BODY(obj), $3, &value);
+ REPR(obj)->pos_funcs->at_pos_native(interp, STABLE(obj), OBJECT_BODY(obj), $3, &value);
$1 = value.value.floatval;
}
else
@@ -1215,7 +1215,7 @@ inline op repr_bind_pos_obj(invar PMC, in INT, invar PMC) :base_core {
PMC *obj = decontainerize(interp, $1);
if (obj->vtable->base_type == smo_id) {
if (IS_CONCRETE(obj))
- REPR(obj)->idx_funcs->bind_pos_boxed(interp, STABLE(obj), OBJECT_BODY(obj), $2, $3);
+ REPR(obj)->pos_funcs->bind_pos_boxed(interp, STABLE(obj), OBJECT_BODY(obj), $2, $3);
else
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
"Cannot do bind_pos on a type object");
@@ -1244,7 +1244,7 @@ inline op repr_bind_pos_int(invar PMC, in INT, in INT) :base_core {
NativeValue value;
value.type = NATIVE_VALUE_INT;
value.value.intval = $3;
- REPR(obj)->idx_funcs->bind_pos_native(interp, STABLE(obj), OBJECT_BODY(obj), $2, &value);
+ REPR(obj)->pos_funcs->bind_pos_native(interp, STABLE(obj), OBJECT_BODY(obj), $2, &value);
}
else
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
@@ -1273,7 +1273,7 @@ inline op repr_bind_pos_num(invar PMC, in INT, in NUM) :base_core {
NativeValue value;
value.type = NATIVE_VALUE_FLOAT;
value.value.floatval = $3;
- REPR(obj)->idx_funcs->bind_pos_native(interp, STABLE(obj), OBJECT_BODY(obj), $2, &value);
+ REPR(obj)->pos_funcs->bind_pos_native(interp, STABLE(obj), OBJECT_BODY(obj), $2, &value);
}
else
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
@@ -1299,7 +1299,7 @@ inline op repr_elems(out INT, invar PMC) :base_core {
PMC *obj = decontainerize(interp, $2);
if (obj->vtable->base_type == smo_id) {
if (IS_CONCRETE(obj))
- $1 = REPR(obj)->idx_funcs->elems(interp, STABLE(obj), OBJECT_BODY(obj));
+ $1 = REPR(obj)->pos_funcs->elems(interp, STABLE(obj), OBJECT_BODY(obj));
else
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
"Cannot do repr_elems on a type object");

0 comments on commit 030ba9b

Please sign in to comment.