Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Numarray und NA_NewAll

Reply
Thread Tools

Numarray und NA_NewAll

 
 
Marco Bubke
Guest
Posts: n/a
 
      01-21-2004
Hi

If I understand the code right then there will be mset called if buffer is
NULL. Why?

I want only a empty array, why not a malloc? The data section after that
will be overwritten by me. Maybe I'm wrong.



static PyArrayObject *
NA_NewAll(int ndim, maybelong *shape, NumarrayType type,
void *buffer, maybelong byteoffset, maybelong bytestride,
int byteorder, int aligned, int writeable)
{
PyArrayObject *result = NA_NewAllFromBuffer(
ndim, shape, type, Py_None, byteoffset, bytestride,
byteorder, aligned, writeable);

if (result) {
if (!NA_NumArrayCheck((PyObject *) result)) {
PyErr_Format( PyExc_TypeError,
"NA_NewAll: non-NumArray result");
result = NULL;
} else {
if (buffer) {
memcpy(result->data, buffer,
PyArray_NBYTES(result));
} else {
memset(result->data, 0,
PyArray_NBYTES(result)); <-- ??????????????????
}
}
}
return result;
}

def get_polygon_stipple():
"""Return the polygon stipple pattern"""
cdef maybelong lenght
cdef void** data
lenght = 128
new_array = NA_NewArray(NULL, tUInt32, 1, lenght)
glGetPolygonStipple(<GLubyte*>NA_OFFSETDATA(new_ar ray))
assert glGetError() != INVALID_OPERATION,\
"can't be called between gl.begin() and gl.end()"
return new_array

Here my code. I'm not sure if this is possible? I have also found
NA_getBufferPtrAndSize? Should I use this?

regards

Marco
 
Reply With Quote
 
 
 
 
Marco Bubke
Guest
Posts: n/a
 
      01-21-2004
Sorry, little stupid bug is in the it. It must be tUInt8.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sub-classing NumArray - two questions Colin J. Williams Python 0 10-01-2003 04:04 PM
numarray.linear_algebra.eigenvectors bug ? Eugene Druker Python 1 09-20-2003 08:57 PM
Re: py2exe and numarray Thomas Heller Python 0 08-08-2003 07:41 PM
Numarray for Python 2.3 Tim Rowe Python 2 07-16-2003 10:42 PM
problem w/ numarray & py2exe... RJS Python 0 07-01-2003 06:44 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57