Hi all, I successfully compiled and oct file to pack infos to a Parallel Virtual machine about an octave charNDArray .. this is the code
#include <octave/oct.h> #include <pvm3.h>
DEFUN_DLD(pvm_pkcharMAT,args,, "This function emulates the C function pvm_pkbyte of pvm3 library, but packs any char matrixes with any dimensions \n") {
const charNDArray tarray = args(0).char_array_value(); int nitem = tarray.capacity(); char *p = const_cast<char*>( tarray.data() ); int stride = args(1).int_value(); if (error_state) { error
("expecting second argument to be an integer"); return retval; }
int info1 = pvm_pkint (&nitem, 1, stride); int info2 = pvm_pkbyte (p, nitem, stride);
int stride = args(1).int_value(); if (error_state) { error ("expecting second argument to be an int"); return retval; } if (args(0).is_char_nd_array() != 0) { error ("expecting first argument to be a char"); return retval; } int n = args(0).ndims(); dim_vector dv = args(0).dims();
// Could I use an octave_local_buffer macro if so .. how? charNDArray oar (dv); if( (n != oar.capacity())
) { error ("errors with dims"); return retval; }