Skip to content
This repository
Browse code

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

…against using them.
  • Loading branch information...
commit 46c9b37a84158d2c461da4b07869cbf86f610fb7 1 parent ec828bc
Andrew Whitworth authored June 11, 2012
2  setup.nqp
@@ -124,6 +124,8 @@ sub find_blas(%PLA) {
124 124
 sub find_blas_linux(%PLA) {
125 125
     my $found_blas := 0;
126 126
     my %searches;
  127
+    #%searches{'openblas-base/libopenblas
  128
+    %searches{'libatlas.so'} := ['-latlas', '-D_PLA_HAVE_ATLAS', 1];
127 129
     %searches{'libblas-3.so'} := ['-lblas-3', '-D_PLA_HAVE_BLAS', 0];
128 130
     %searches{'libblas.so'} := ['-lblas', '-D_PLA_HAVE_ATLAS', 1];
129 131
     %searches{'atlas/libcblas.so'} := ['-L/usr/lib/atlas -lcblas', '-D_PLA_HAVE_ATLAS', 1];
17  src/pmc/charmatrix2d.pmc
@@ -283,6 +283,23 @@ Sets the character value at coordinates rows,cols
283 283
         return 0;
284 284
     }
285 285
 
  286
+/*
  287
+
  288
+=item * get_pointer
  289
+
  290
+Get a pointer to the underlying storage array in memory.
  291
+
  292
+WARNING: This array may be resized or relocated at any time. It is not a good
  293
+idea to store a reference to this pointer, or to use it in any but the most
  294
+controlled and careful situations.
  295
+
  296
+=cut
  297
+
  298
+*/
  299
+
  300
+    VTABLE void *get_pointer() {
  301
+        return PARROT_CHARMATRIX2D(SELF)->storage;
  302
+    }
286 303
 
287 304
 /*
288 305
 
22  src/pmc/complexmatrix2d.pmc
@@ -1306,8 +1306,6 @@ Multiply every element in SELF by the integer
1306 1306
 
1307 1307
 Multiply every element in SELF by the floating point number
1308 1308
 
1309  
-=back
1310  
-
1311 1309
 =cut
1312 1310
 
1313 1311
 */
@@ -1334,9 +1332,29 @@ Multiply every element in SELF by the floating point number
1334 1332
         multiply_scalar_float(INTERP, SELF, v);
1335 1333
     }
1336 1334
 
  1335
+/*
  1336
+
  1337
+=item * get_pointer
  1338
+
  1339
+Get a pointer to the underlying storage array in memory.
  1340
+
  1341
+WARNING: This array may be resized or relocated at any time. It is not a good
  1342
+idea to store a reference to this pointer, or to use it in any but the most
  1343
+controlled and careful situations.
  1344
+
  1345
+=cut
  1346
+
  1347
+*/
  1348
+
  1349
+    VTABLE void *get_pointer() {
  1350
+        return PARROT_COMPLEXMATRIX2D(SELF)->storage;
  1351
+    }
  1352
+
1337 1353
 
1338 1354
 /*
1339 1355
 
  1356
+=back
  1357
+
1340 1358
 =head1 METHODS
1341 1359
 
1342 1360
 =over 4
22  src/pmc/nummatrix2d.pmc
@@ -969,8 +969,6 @@ Add the integer value to every element in the matrix.
969 969
 
970 970
 =item * i_multiply_float
971 971
 
972  
-=back
973  
-
974 972
 =cut
975 973
 
976 974
 */
@@ -993,9 +991,29 @@ Add the integer value to every element in the matrix.
993 991
         multiply_scalar_float(INTERP, SELF, v);
994 992
     }
995 993
 
  994
+/*
  995
+
  996
+=item * get_pointer
  997
+
  998
+Get a pointer to the underlying storage array in memory.
  999
+
  1000
+WARNING: This array may be resized or relocated at any time. It is not a good
  1001
+idea to store a reference to this pointer, or to use it in any but the most
  1002
+controlled and careful situations.
  1003
+
  1004
+=cut
  1005
+
  1006
+*/
  1007
+
  1008
+    VTABLE void *get_pointer() {
  1009
+        return PARROT_NUMMATRIX2D(SELF)->storage;
  1010
+    }
  1011
+
996 1012
 
997 1013
 /*
998 1014
 
  1015
+=back
  1016
+
999 1017
 =head2 METHODS
1000 1018
 
1001 1019
 =over 4
22  src/pmc/pmcmatrix2d.pmc
@@ -589,8 +589,6 @@ a file.
589 589
 
590 590
 Thaw a serialized PMC
591 591
 
592  
-=back
593  
-
594 592
 =cut
595 593
 
596 594
 */
@@ -637,6 +635,26 @@ Thaw a serialized PMC
637 635
 
638 636
 /*
639 637
 
  638
+=item * get_pointer
  639
+
  640
+Get a pointer to the underlying storage array in memory.
  641
+
  642
+WARNING: This array may be resized or relocated at any time. It is not a good
  643
+idea to store a reference to this pointer, or to use it in any but the most
  644
+controlled and careful situations.
  645
+
  646
+=cut
  647
+
  648
+*/
  649
+
  650
+    VTABLE void *get_pointer() {
  651
+        return PARROT_PMCMATRIX2D(SELF)->storage;
  652
+    }
  653
+
  654
+/*
  655
+
  656
+=back
  657
+
640 658
 =head1 METHODS
641 659
 
642 660
 =over 4

0 notes on commit 46c9b37

Please sign in to comment.
Something went wrong with that request. Please try again.