00001 #ifndef PHPLAYER_H 00002 #define PHPLAYER_H 00003 00004 #include <phbase.h> 00005 00006 #define PLAYER_ERROR_PRINT(pmsg,fmt,...) \ 00007 {\ 00008 fprintf(stderr, "(pid:%ld %s:%d @ %s)\t" fmt, \ 00009 phProcessId(),__FILE__,__LINE__,function, \ 00010 ## __VA_ARGS__); \ 00011 fflush(stderr); \ 00012 if (pmsg != NULL) fprintf(stderr,"%s: %s\n",pmsg,playerc_error_str()); \ 00013 } 00014 00015 /* ---------------------------------------------------------------------- */ 00016 #define PLAYER_ERR_PRINT(fmt,...) phERROR_PRINT(NULL,fmt,##__VA_ARGS__); 00017 00018 /* ---------------------------------------------------------------------- */ 00019 #define PLAYER_PRINT_RC(rc,pmsg,fmt,...) \ 00020 {\ 00021 if (rc != 0) \ 00022 PLAYER_ERROR_PRINT(pmsg,"*** ERROR (rc:%d)*** " fmt "\n",\ 00023 rc,## __VA_ARGS__); \ 00024 } 00025 00026 /* ---------------------------------------------------------------------- */ 00027 #define PLAYER_CONT_RC(rc,pmsg,fmt,...) \ 00028 {\ 00029 if (rc != 0) {\ 00030 PLAYER_ERROR_PRINT(pmsg,"*** ERROR (rc:%d)*** " fmt "\n",\ 00031 rc,## __VA_ARGS__); \ 00032 continue; \ 00033 } \ 00034 } 00035 00036 /* ---------------------------------------------------------------------- */ 00037 #define PLAYER_CHECK_RC(rc,pmsg,fmt,...) \ 00038 {\ 00039 if (rc != 0) {\ 00040 phERROR_PRINT(pmsg,"*** ERROR (rc:%d)*** " fmt "\n",\ 00041 rc,## __VA_ARGS__); \ 00042 goto error; \ 00043 }\ 00044 } 00045 00046 /* ---------------------------------------------------------------------- */ 00047 #define PLAYER_CHECK_NULLPTR(ptr,pmsg,fmt,...) \ 00048 {\ 00049 if (ptr == NULL) {\ 00050 phERROR_PRINT(pmsg,"*** ERROR (ptr:%p)*** " fmt "\n",\ 00051 ptr,## __VA_ARGS__); \ 00052 goto error; \ 00053 }\ 00054 } 00055 00056 /* ---------------------------------------------------------------------- */ 00057 #define PLAYER_PRINT_PTR(ptr,pmsg,fmt,...) \ 00058 {\ 00059 if (ptr == NULL) {\ 00060 phERROR_PRINT(pmsg,"*** ERROR (ptr:%p)*** " fmt "\n",\ 00061 ptr,## __VA_ARGS__); \ 00062 }\ 00063 } 00064 00065 /* ---------------------------------------------------------------------- */ 00066 #define PLAYER_CONT_NULLPTR(ptr,pmsg,fmt,...) \ 00067 {\ 00068 if (ptr == NULL) {\ 00069 phERROR_PRINT(pmsg,"*** ERROR (ptr:%p)*** " fmt "\n",\ 00070 ptr,## __VA_ARGS__); \ 00071 continue; \ 00072 }\ 00073 } 00074 00075 /* ---------------------------------------------------------------------- */ 00076 #define PLAYER_PRINT_NULLPTR(ptr,pmsg,fmt,...) \ 00077 {\ 00078 if (ptr == NULL) {\ 00079 phERROR_PRINT(pmsg,"*** ERROR (ptr:%p)*** " fmt "\n", \ 00080 ptr,## __VA_ARGS__); \ 00081 }\ 00082 } 00083 00084 #endif
Copyright (C) 2002 - 2007 |
Philip D.S. Thoren ( pthoren@users.sourceforge.net ) University Of Massachusetts at Lowell Robotics Lab |