Permalink
Browse files

add get_pointer vtables to the matrix types, along with big warnings …

…against using them.
  • Loading branch information...
1 parent ec828bc commit 46c9b37a84158d2c461da4b07869cbf86f610fb7 @Whiteknight committed Jun 11, 2012
Showing with 79 additions and 6 deletions.
  1. +2 −0 setup.nqp
  2. +17 −0 src/pmc/charmatrix2d.pmc
  3. +20 −2 src/pmc/complexmatrix2d.pmc
  4. +20 −2 src/pmc/nummatrix2d.pmc
  5. +20 −2 src/pmc/pmcmatrix2d.pmc
View
2 setup.nqp
@@ -124,6 +124,8 @@ sub find_blas(%PLA) {
sub find_blas_linux(%PLA) {
my $found_blas := 0;
my %searches;
+ #%searches{'openblas-base/libopenblas
+ %searches{'libatlas.so'} := ['-latlas', '-D_PLA_HAVE_ATLAS', 1];
%searches{'libblas-3.so'} := ['-lblas-3', '-D_PLA_HAVE_BLAS', 0];
%searches{'libblas.so'} := ['-lblas', '-D_PLA_HAVE_ATLAS', 1];
%searches{'atlas/libcblas.so'} := ['-L/usr/lib/atlas -lcblas', '-D_PLA_HAVE_ATLAS', 1];
View
17 src/pmc/charmatrix2d.pmc
@@ -283,6 +283,23 @@ Sets the character value at coordinates rows,cols
return 0;
}
+/*
+
+=item * get_pointer
+
+Get a pointer to the underlying storage array in memory.
+
+WARNING: This array may be resized or relocated at any time. It is not a good
+idea to store a reference to this pointer, or to use it in any but the most
+controlled and careful situations.
+
+=cut
+
+*/
+
+ VTABLE void *get_pointer() {
+ return PARROT_CHARMATRIX2D(SELF)->storage;
+ }
/*
View
22 src/pmc/complexmatrix2d.pmc
@@ -1306,8 +1306,6 @@ Multiply every element in SELF by the integer
Multiply every element in SELF by the floating point number
-=back
-
=cut
*/
@@ -1334,9 +1332,29 @@ Multiply every element in SELF by the floating point number
multiply_scalar_float(INTERP, SELF, v);
}
+/*
+
+=item * get_pointer
+
+Get a pointer to the underlying storage array in memory.
+
+WARNING: This array may be resized or relocated at any time. It is not a good
+idea to store a reference to this pointer, or to use it in any but the most
+controlled and careful situations.
+
+=cut
+
+*/
+
+ VTABLE void *get_pointer() {
+ return PARROT_COMPLEXMATRIX2D(SELF)->storage;
+ }
+
/*
+=back
+
=head1 METHODS
=over 4
View
22 src/pmc/nummatrix2d.pmc
@@ -969,8 +969,6 @@ Add the integer value to every element in the matrix.
=item * i_multiply_float
-=back
-
=cut
*/
@@ -993,9 +991,29 @@ Add the integer value to every element in the matrix.
multiply_scalar_float(INTERP, SELF, v);
}
+/*
+
+=item * get_pointer
+
+Get a pointer to the underlying storage array in memory.
+
+WARNING: This array may be resized or relocated at any time. It is not a good
+idea to store a reference to this pointer, or to use it in any but the most
+controlled and careful situations.
+
+=cut
+
+*/
+
+ VTABLE void *get_pointer() {
+ return PARROT_NUMMATRIX2D(SELF)->storage;
+ }
+
/*
+=back
+
=head2 METHODS
=over 4
View
22 src/pmc/pmcmatrix2d.pmc
@@ -589,8 +589,6 @@ a file.
Thaw a serialized PMC
-=back
-
=cut
*/
@@ -637,6 +635,26 @@ Thaw a serialized PMC
/*
+=item * get_pointer
+
+Get a pointer to the underlying storage array in memory.
+
+WARNING: This array may be resized or relocated at any time. It is not a good
+idea to store a reference to this pointer, or to use it in any but the most
+controlled and careful situations.
+
+=cut
+
+*/
+
+ VTABLE void *get_pointer() {
+ return PARROT_PMCMATRIX2D(SELF)->storage;
+ }
+
+/*
+
+=back
+
=head1 METHODS
=over 4

0 comments on commit 46c9b37

Please sign in to comment.