pyToC.h

Go to the documentation of this file.
00001 
00005 #include "pm.h"
00006 
00019 #define EXCEPTION_UNLESS(expr, prReturn, ...) \
00020     do { \
00021         if (!(expr)) { \
00022             printf("Error: " __VA_ARGS__); \
00023             PM_RAISE(retval, prReturn); \
00024             return retval; \
00025         } \
00026     } while (C_FALSE)
00027 
00037 #define PM_CHECK_FUNCTION(func) \
00038     do { \
00039         retval = func; \
00040         PM_RETURN_IF_ERROR(retval); \
00041     } while (C_FALSE)
00042 
00048 #define PM_ARG_CHECK_FUNCTION(func, u8_ndx) \
00049     do { \
00050         retval = func; \
00051         if (retval != PM_RET_OK) \
00052           printf(" in argument %u.", (uint16_t) u8_ndx); \
00053         PM_RETURN_IF_ERROR(retval); \
00054     } while (C_FALSE)
00055 
00065 #define GET_UINT16_ARG(u8_ndx, pu16_val) \
00066     PM_ARG_CHECK_FUNCTION( getUint16(NATIVE_GET_LOCAL(u8_ndx), pu16_val), u8_ndx )
00067 
00068 
00078 #define GET_INT16_ARG(u8_ndx, pi16_val) \
00079     PM_ARG_CHECK_FUNCTION( getInt16(NATIVE_GET_LOCAL(u8_ndx), pi16_val), u8_ndx )
00080 
00090 #define GET_INT32_ARG(u8_ndx, pi32_val) \
00091     PM_ARG_CHECK_FUNCTION( getInt32(NATIVE_GET_LOCAL(u8_ndx), pi32_val), u8_ndx )
00092 
00102 #define GET_UINT32_ARG(u8_ndx, pu32_val) \
00103     PM_ARG_CHECK_FUNCTION( getUint32(NATIVE_GET_LOCAL(u8_ndx), pu32_val), u8_ndx )
00104 
00114 #define GET_BOOL_ARG(u8_ndx, pb_bool) \
00115     PM_ARG_CHECK_FUNCTION( getBool(NATIVE_GET_LOCAL(u8_ndx), pb_bool), u8_ndx )
00116 
00126 #define GET_FLOAT_ARG(u8_ndx, pf_val) \
00127     PM_ARG_CHECK_FUNCTION( getFloat(NATIVE_GET_LOCAL(u8_ndx), pf_val), u8_ndx )
00128 
00137 #define CHECK_NUM_ARGS(u8_numArgs) \
00138     EXCEPTION_UNLESS(NATIVE_GET_NUM_ARGS() == (u8_numArgs), PM_RET_EX_TYPE, \
00139       "Expected %u arguments, but received %u.", (uint16_t) (u8_numArgs), \
00140       (uint16_t) NATIVE_GET_NUM_ARGS())
00141 
00151 PmReturn_t
00152 getRangedInt(pPmObj_t ppo, 
00153   int32_t i32_min, int32_t i32_max, int32_t* pi32_val);
00154 
00161 PmReturn_t
00162 getUint16(pPmObj_t ppo, uint16_t* pu16_val);
00163 
00170 PmReturn_t
00171 getInt16(pPmObj_t ppo, int16_t* pi16_val);
00172 
00179 PmReturn_t
00180 getInt32(pPmObj_t ppo, int32_t* pi32_val);
00181 
00188 PmReturn_t 
00189 getUint32(pPmObj_t ppo, uint32_t* pu32_val);
00190 
00197 PmReturn_t
00198 getBool(pPmObj_t ppo, bool_t* pb_bool);
00199 
00206 PmReturn_t
00207 getFloat(pPmObj_t ppo, float* pf_val);

Generated on Mon Oct 18 07:40:47 2010 for Python-on-a-chip by  doxygen 1.5.9