deps/PicklingTools170Release/Xm/ptools170/pythoncext/pyocser.cc
void* OCPyGetNumericArrayInfo (PyObject *po,
			       char& oc_typecode, size_t& len)
{
  len = PyObject_Length(po);  // get length in neutral way
  NUMERIC_PyArrayObject *hope_this_works = (NUMERIC_PyArrayObject*)po;
  char* data = hope_this_works->data;
  
  // Get the typecode in a string-based wway
  PyObject *res = PyObject_CallMethod(po, (char*)"typecode", (char*)"()"); /* new ref */
  if (res==NULL) {
    throw runtime_error("Not a Numeric object? Expected typecode to return str");
  }
  if (!PyString_Check(res)) {
    Py_DECREF(res);
    throw runtime_error("Not a Numeric object? Expected typecode to return str");
  }
  char *typecode_data = PyString_AS_STRING(res);
  size_t typecode_len = PyString_GET_SIZE(res);
  if (typecode_len!=1) {
    Py_DECREF(res);
    throw runtime_error("typecode isn't single letter?");
  }
  oc_typecode = NumericTagToOC(typecode_data[0]);
  
  // Clean up
  Py_DECREF(res);
  
  // Return the data
  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* OCPyGetNumericArrayInfo (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_CallMethod(po, (char*)"typecode", (char*)"()"); 
  if (res==NULL) {
    throw runtime_error("Not a Numeric object? Expected typecode to return str");
  }
  if (!PyString_Check(res)) {
    Py_DECREF(res);
    throw runtime_error("Not a Numeric object? Expected typecode to return str");
  }
  char *typecode_data = PyString_AS_STRING(res);
  size_t typecode_len = PyString_GET_SIZE(res);
  if (typecode_len!=1) {
    Py_DECREF(res);
    throw runtime_error("typecode isn't single letter?");
  }
  oc_typecode = NumericTagToOC(typecode_data[0]);
  Py_DECREF(res);
  return data;
}
void * OCPyGetNumericArrayInfo ( 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_CallMethod ( po , ( char * ) " " , ( char * ) " " ) ; if ( res == NULL ) { throw runtime_error ( " " ) ; } if ( ! PyString_Check ( res ) ) { Py_DECREF ( res ) ; throw runtime_error ( " " ) ; } char * typecode_data = PyString_AS_STRING ( res ) ; size_t typecode_len = PyString_GET_SIZE ( res ) ; if ( typecode_len != 1 ) { Py_DECREF ( res ) ; throw runtime_error ( " " ) ; } oc_typecode = NumericTagToOC ( typecode_data [ 0 ] ) ; Py_DECREF ( res ) ; 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 neutral way // Get the typecode in a string-based wway /* new ref */ // Clean up // Return the data