Permalink
Browse files

Merge branch 'qrpa'

  • Loading branch information...
2 parents 10994ce + fad75ad commit b4d08d114ec56ac7e3338b84b132a4c3b7465214 @pmichaud pmichaud committed Jun 7, 2012
Showing with 1,887 additions and 1 deletion.
  1. +9 −0 src/PAST/NQP.pir
  2. +25 −0 src/ops/nqp.ops
  3. +545 −0 src/pmc/qrpa.pmc
  4. +17 −1 t/nqp/59-nqpop.t
  5. +1,290 −0 t/pmc/qrpa.t
  6. +1 −0 tools/build/Makefile.in
View
@@ -612,6 +612,7 @@ entry to produce the node to be returned.
maphash['existskey'] = 'exists__IQs'
maphash['existspos'] = 'exists__IQi'
maphash['elems'] = 'elements__IP'
+ maphash['islist'] = 'nqp_islist__IP'
maphash['iterator'] = 'iter__PP'
maphash['push'] = 'push__0PP'
maphash['push_s'] = 'push__0Ps'
@@ -637,6 +638,14 @@ entry to produce the node to be returned.
$P0['pasttype'] = 'hash'
maphash['hash'] = $P0
+ # nqp::qlist is a temporary operation for creating QRPA lists
+ # instead of RPA lists. Eventually we expect nqp::list to do the same,
+ # at which point nqp::qlist can go away.
+ $P0 = new ['Hash']
+ $P0['pasttype'] = 'list'
+ $P0['returns'] = 'QRPA'
+ maphash['qlist'] = $P0
+
# repr-level aggregate operations
maphash['r_atpos'] = 'repr_at_pos_obj__PPi'
maphash['r_atpos_i'] = 'repr_at_pos_int__IPi'
View
@@ -29,6 +29,7 @@ static INTVAL initialized = 0;
static INTVAL stable_id = 0;
static INTVAL smo_id = 0;
static INTVAL disp_id = 0;
+static INTVAL qrpa_id = 0;
/* Built-in meta-objects. */
static PMC *KnowHOW = NULL;
@@ -82,6 +83,16 @@ static void SC_write_barrier_st(PARROT_INTERP, STable *st) {
}
}
+
+/* Test for something being a list (RPA or QRPA). This isn't
+ * declared 'static' because we want to be able to call it from
+ * other C functions (in both nqp and rakudo) as well. */
+INTVAL
+nqp_islist(PMC *pmc) {
+ INTVAL type = pmc->vtable->base_type;
+ return (INTVAL)(type == qrpa_id || type == enum_class_ResizablePMCArray);
+}
+
END_OPS_PREAMBLE
/*
@@ -101,6 +112,7 @@ inline op nqp_dynop_setup() :base_core {
stable_id = Parrot_pmc_get_type_str(interp, Parrot_str_new(interp, "STable", 0));
smo_id = Parrot_pmc_get_type_str(interp, Parrot_str_new(interp, "SixModelObject", 0));
disp_id = Parrot_pmc_get_type_str(interp, Parrot_str_new(interp, "DispatcherSub", 0));
+ qrpa_id = Parrot_pmc_get_type_str(interp, Parrot_str_new(interp, "QRPA", 0));
/* Initialize the object model. */
SixModelObject_initialize(interp, &KnowHOW, &KnowHOWAttribute);
@@ -1854,6 +1866,19 @@ inline op repr_hint_for(out INT, in PMC, in PMC, in STR) :base_core {
/*
+=item nqp_islist
+
+Checks if the type of thing in $2 is a nqp list (either QRPA or RPA).
+
+=cut
+
+*/
+inline op nqp_islist(out INT, in PMC) :base_core {
+ $1 = nqp_islist($2)
+}
+
+/*
+
=item is_container
Checks if the type of thing in $2 is a container or not. Puts a non-zero
Oops, something went wrong.

0 comments on commit b4d08d1

Please sign in to comment.