00001 #ifndef _RTS_ERR_MSG_H
00002 #define _RTS_ERR_MSG_H
00003 #include "iccp.h"
00004 #include <stdio.h>
00005
00006 #define MSG_ERR(MSGP,STRING,A1,A2,A3,A4,A5) \
00007 MSG_ERR_LOCAL(MSGP, __FILE__, STRING, __LINE__, A1, A2, A3, A4, A5)
00008
00009
00010
00011
00012
00013
00014 #ifdef __linux__
00015 inline void MSG_ERR_LOCAL(ic_msg *msg,
00016 char *file,
00017 char *str,
00018 long line,
00019 long a1,
00020 long a2,
00021 long a3,
00022 long a4,
00023 long a5)
00024 {
00025 char *c = (char *)&msg->ld;
00026 char buff[255];
00027
00028 sprintf(buff, "%ld|%s|",line,file);
00029 int i = strlen(buff);
00030 sprintf(&buff[i], str, a1, a2, a3, a4, a5);
00031
00032 for(int i=0;i<107;i+=4)
00033 {
00034 #ifdef RTS_LITTLE_ENDIAN
00035 c[i] = buff[i+3];
00036 c[i+1] = buff[i+2];
00037 c[i+2] = buff[i+1];
00038 c[i+3] = buff[i];
00039 #else
00040 c[i] = buff[i];
00041 c[i+1] = buff[i+1];
00042 c[i+2] = buff[i+2];
00043 c[i+3] = buff[i+3];
00044 #endif
00045 }
00046 c[108] = 0;
00047
00048 msg->head.valid_words = (strlen(c) + 7) / 4;
00049 }
00050 #else
00051 inline void MSG_ERR_LOCAL(ic_msg *msg,
00052 char *file,
00053 char *str,
00054 int line,
00055 int a1,
00056 int a2,
00057 int a3,
00058 int a4,
00059 int a5)
00060 {
00061 char *c = (char *)&msg->ld;
00062 char buff[255];
00063
00064 sprintf(buff, "%d|%s|",line,file);
00065 int i = strlen(buff);
00066 sprintf(&buff[i], str, a1, a2, a3, a4, a5);
00067
00068 strncpy(c,buff,106);
00069 c[107] = 0;
00070 msg->head.valid_words = (strlen(c) + 7) / 4;
00071 }
00072 #endif
00073
00074 #endif