home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
linuxmafia.com 2016
/
linuxmafia.com.tar
/
linuxmafia.com
/
pub
/
palmos
/
pippy-0.6beta-src.tar.gz
/
pippy-0.6beta-src.tar
/
pippy-0.6beta-src
/
src
/
Modules
/
_palmutils.c
< prev
next >
Wrap
C/C++ Source or Header
|
2000-12-21
|
1KB
|
50 lines
#include "Python.h"
#include <PalmOS.h>
#include "_palmutils.h"
/* must fix the following include - put somewhere else */
#include "commonRsc.h"
/* palmutil_buildErrObject:
Build a Python string object containing the palmnet error and
return the result. Callers are handed ownership of the resulting
object and should decrement the reference when finished with it.
*/
PyObject *
palmutil_buildErrObject(UInt16 ifErrs)
{
UInt16 maxLen=30;
char netErrString[maxLen];
char errnoString[maxLen];
/* Grab the error id from the errno. Extract last byte of 0x1200
error offset. */
Err i = ifErrs & 0x00FF;
/* SysStringByIndex (netErrStringCodes_tSTL, i, netErrString, maxLen); */
SysErrString(ifErrs, netErrString, maxLen);
SysStringByIndex (errnoStringCodes_tSTL, i, errnoString, maxLen);
return Py_BuildValue("(iss)", (int)ifErrs, errnoString, netErrString);
}
PyObject *
palmutil_setErr(PyObject *exc, Err err)
{
char msg[80];
SysErrString(err, msg, 80);
PyErr_SetString(exc, msg);
return NULL;
}
PyObject *
palmutil_setErr_FromDMError(PyObject *exc)
{
return palmutil_setErr(exc, DmGetLastErr());
}