deps/PicklingTools170Release/Xm/ptools170/pythoncext/pyocser.cc
void* OCPyGetNumPyArrayInfo (PyObject *po,
			     char& oc_typecode, size_t& len)
{
  len = PyObject_Length(po); // get length in a neutral way
  NUMERIC_PyArrayObject *hope_this_works = (NUMERIC_PyArrayObject*)po;
  char *data = hope_this_works->data;

  // Get the typecode in a string-based way
  PyObject *res = PyObject_GetAttrString(po, (char*)"dtype"); /* new ref */
  if (res==NULL) {
    throw runtime_error("Not a numpy object? Expected dtype");
  }
  PyObject *type_str = PyObject_Str(res); /* new ref */
  char *dtype_data = PyString_AS_STRING(type_str);

  // cerr << "dtypde_data:" << dtype_data << ":" << endl;

  // Convert typecode to OC and let below handle creating array
  oc_typecode = '?';
  try {
    oc_typecode = NumPyStringToOC(dtype_data);
    // cerr << "AFTER TYPECODE" << oc_typecode << int(oc_typecode) << endl;
  } catch (...) { }
  Py_DECREF(type_str);

  return data;
}
// helper routine for serialization of Numeric arrays:  Returns the
// OC typecode, len, and void* data of the array
helper routine for serialization of Numeric arrays:  Returns the
OC typecode, len, and void* data of the array
helper routine for serialization of Numeric arrays : Returns the OC typecode len and void * data of the array
void* OCPyGetNumPyArrayInfo (PyObject *po,
			     char& oc_typecode, size_t& len)
{
  len = PyObject_Length(po); 
  NUMERIC_PyArrayObject *hope_this_works = (NUMERIC_PyArrayObject*)po;
  char *data = hope_this_works->data;
  PyObject *res = PyObject_GetAttrString(po, (char*)"dtype"); 
  if (res==NULL) {
    throw runtime_error("Not a numpy object? Expected dtype");
  }
  PyObject *type_str = PyObject_Str(res); 
  char *dtype_data = PyString_AS_STRING(type_str);
  oc_typecode = '?';
  try {
    oc_typecode = NumPyStringToOC(dtype_data);
  } catch (...) { }
  Py_DECREF(type_str);
  return data;
}
void * OCPyGetNumPyArrayInfo ( PyObject * po , char & oc_typecode , size_t & len ) { len = PyObject_Length ( po ) ; NUMERIC_PyArrayObject * hope_this_works = ( NUMERIC_PyArrayObject * ) po ; char * data = hope_this_works -> data ; PyObject * res = PyObject_GetAttrString ( po , ( char * ) " " ) ; if ( res == NULL ) { throw runtime_error ( " " ) ; } PyObject * type_str = PyObject_Str ( res ) ; char * dtype_data = PyString_AS_STRING ( type_str ) ; oc_typecode = ' ' ; try { oc_typecode = NumPyStringToOC ( dtype_data ) ; } catch ( ... ) { } Py_DECREF ( type_str ) ; return data ; }
helper routine for serialization of Numeric arrays:  Returns the
OC typecode, len, and void* data of the array
helper routine for serialization of Numeric arrays : Returns the OC typecode len and void * data of the array
// get length in a neutral way // Get the typecode in a string-based way /* new ref */ /* new ref */ // cerr << "dtypde_data:" << dtype_data << ":" << endl; // Convert typecode to OC and let below handle creating array // cerr << "AFTER TYPECODE" << oc_typecode << int(oc_typecode) << endl;