#if PYTHON_API_VERSION >= 1009
static char* wxStringErrorMsg = "String or Unicode type required";
#else
- static char* wxStringErrorMsg = "string type is required for parameter";
+ static char* wxStringErrorMsg = "String type required";
#endif
// C++
// definitions of wxStringPtrList and wxPyInputStream
}
// read until EOF
- wxPy_BEGIN_ALLOW_THREADS;
while (! wxi->Eof()) {
wxi->Read(buf, BUFSIZE);
//*s += wxString(buf, wxi->LastRead());
s->Append(buf, wxi->LastRead());
}
delete buf;
- wxPy_END_ALLOW_THREADS;
// error check
if (wxi->LastError() == wxSTREAM_READ_ERROR) {
}
// read size bytes
- wxPy_BEGIN_ALLOW_THREADS;
wxi->Read(s->GetWriteBuf(size+1), size);
s->UngetWriteBuf(wxi->LastRead());
- wxPy_END_ALLOW_THREADS;
// error check
if (wxi->LastError() == wxSTREAM_READ_ERROR) {
}
// read until \n or byte limit reached
- wxPy_BEGIN_ALLOW_THREADS;
for (i=ch=0; (ch != '\n') && (!wxi->Eof()) && ((size < 0) || (i < size)); i++) {
*s += ch = wxi->GetC();
}
- wxPy_END_ALLOW_THREADS;
// errorcheck
if (wxi->LastError() == wxSTREAM_READ_ERROR) {
}
// read sizehint bytes or until EOF
- wxPy_BEGIN_ALLOW_THREADS;
int i;
for (i=0; (!wxi->Eof()) && ((sizehint < 0) || (i < sizehint));) {
wxString* s = readline();
l->Append(s);
i = i + s->Length();
}
- wxPy_END_ALLOW_THREADS;
// error check
if (wxi->LastError() == wxSTREAM_READ_ERROR) {
if (bufsize == 0)
return 0;
- bool doSave = wxPyRestoreThread();
+ wxPyBeginBlockThreads();
PyObject* arglist = Py_BuildValue("(i)", bufsize);
PyObject* result = PyEval_CallObject(read, arglist);
Py_DECREF(arglist);
}
else
m_lasterror = wxSTREAM_READ_ERROR;
- wxPySaveThread(doSave);
+ wxPyEndBlockThreads();
m_lastcount = o;
return o;
}
}
virtual off_t OnSysSeek(off_t off, wxSeekMode mode){
- bool doSave = wxPyRestoreThread();
+ wxPyBeginBlockThreads();
PyObject*arglist = Py_BuildValue("(ii)", off, mode);
PyObject*result = PyEval_CallObject(seek, arglist);
Py_DECREF(arglist);
Py_XDECREF(result);
- wxPySaveThread(doSave);
+ wxPyEndBlockThreads();
return OnSysTell();
}
virtual off_t OnSysTell() const{
- bool doSave = wxPyRestoreThread();
+ wxPyBeginBlockThreads();
PyObject* arglist = Py_BuildValue("()");
PyObject* result = PyEval_CallObject(tell, arglist);
Py_DECREF(arglist);
o = PyInt_AsLong(result);
Py_DECREF(result);
};
- wxPySaveThread(doSave);
+ wxPyEndBlockThreads();
return o;
}
public:
~wxPyCBInputStream() {
- bool doSave = wxPyRestoreThread();
+ wxPyBeginBlockThreads();
Py_XDECREF(py);
Py_XDECREF(read);
Py_XDECREF(seek);
Py_XDECREF(tell);
- wxPySaveThread(doSave);
+ wxPyEndBlockThreads();
}
virtual size_t GetSize() {
_arg0 = _obj0;
}
{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
_result = (wxPyInputStream *)new_wxPyInputStream(_arg0);
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
} if (_result) {
SWIG_MakePtr(_ptemp, (char *) _result,"_wxPyInputStream_p");
_resultobj = Py_BuildValue("s",_ptemp);
}
}
{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
wxInputStream_close(_arg0);
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
}
{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
wxInputStream_flush(_arg0);
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
}
{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
_result = (bool )wxInputStream_eof(_arg0);
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
}
}
{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
_result = (wxString *)wxInputStream_read(_arg0,_arg1);
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
}{
- if (_result) {
- _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
- delete _result;
- }
- else
- _resultobj=0;
+ _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
}
return _resultobj;
}
}
}
{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
_result = (wxString *)wxInputStream_readline(_arg0,_arg1);
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
}{
- if (_result) {
- _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
- delete _result;
- }
- else
- _resultobj=0;
+ _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
}
return _resultobj;
}
}
}
{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
_result = (wxStringPtrList *)wxInputStream_readlines(_arg0,_arg1);
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
}{
if (_result) {
_resultobj = PyList_New(_result->GetCount());
}
}
{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
wxInputStream_seek(_arg0,_arg1,_arg2);
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
}
{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
_result = (int )wxInputStream_tell(_arg0);
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
#endif
}
{
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
wxOutputStream_write(_arg0,*_arg1);
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None);
_resultobj = Py_None;
{