00001 /* 00002 ** 00003 */ 00004 #ifndef _GLOBAL_MSG_H 00005 #define _GLOBAL_MSG_H 00006 00007 #include <earthworm_defs.h> /* amp types */ 00008 #include <transport.h> /* MSG_LOGO */ 00009 00010 #define BUFF_OVERRUN_SIZE 20 00011 00012 00013 typedef int GLOBAL_MSG_STATUS; 00014 00015 /* 00016 ** Ensure that error numbers are negative to avoid 00017 ** collision with some functions that return 0 - n for 00018 ** success 00019 */ 00020 enum GLOBAL_MSG_STATUS_TYPES 00021 { 00022 GLOBAL_MSG_UNKNOWN = 1 /* value is undetermined or not supplied (?) */ 00023 , GLOBAL_MSG_SUCCESS = 0 /* success */ 00024 , GLOBAL_MSG_NULL = -1 /* item pointer is NULL */ 00025 , GLOBAL_MSG_VERSINVALID = -2 /* invalid version */ 00026 , GLOBAL_MSG_FORMATERROR = -3 /* invalid format (while parsing) */ 00027 , GLOBAL_MSG_MAXCHILDREN = -4 /* too many children (applies to global location, phase) */ 00028 , GLOBAL_MSG_BADPARAM = -5 /* parameter error (e.g. string too long, index out of range) */ 00029 , GLOBAL_MSG_TOOSMALL = -6 /* [buffer] too small to contain message */ 00030 , GLOBAL_MSG_BADCHILD = -7 /* invalid child line */ 00031 , GLOBAL_MSG_DEFINESMALL = -9 /* max buffer size too small for normal write */ 00032 , GLOBAL_MSG_BADAMPTYPE = -10 /* amp magtype not defined */ 00033 }; 00034 00035 00036 00037 /* ========================================================================== 00038 ** FUNCTION DECLARATIONS 00039 ** ========================================================================= */ 00040 00041 /* 00042 ** DTStringToTime() 00043 ** 00044 ** "YYYYMMDDHHMMss.sss" --> double (secs since 1/1/1970) 00045 */ 00046 double DTStringToTime( const char * p_datestring ); 00047 00048 /* 00049 ** DTStringToTime() 00050 ** 00051 ** double --> "YYYYMMDDHHMMss.sss" 00052 ** 00053 ** p_buffer must be at least 19 chars long 00054 ** 00055 ** RETURNS 00056 ** GLOBAL_MSG_SUCCESS 00057 ** GLOBAL_MSG_NULL -- p_buffer is null 00058 */ 00059 int TimeToDTString( const double p_time, char * p_buffer ); 00060 00061 00062 /* EncodeAuthor() -- encodes author from logo 00063 ** 00064 ** RETURNS 00065 ** GLOBAL_MSG_SUCCESS 00066 ** GLOBAL_MSG_NULLSTRUCT -- buffer pointer is NULL 00067 */ 00068 GLOBAL_MSG_STATUS EncodeAuthor( MSG_LOGO p_logo 00069 , char * r_buffer 00070 ); 00071 00072 /* DecodeAuthor() -- decodes logo from author 00073 ** 00074 ** RETURNS 00075 ** GLOBAL_MSG_SUCCESS 00076 ** GLOBAL_MSG_NULLSTRUCT -- buffer pointer is NULL 00077 ** GLOBAL_MSG_BADPARAM -- buffer string is invalid length 00078 ** GLOBAL_MSG_FORMATERROR -- number conversion error 00079 */ 00080 GLOBAL_MSG_STATUS DecodeAuthor( MSG_LOGO * p_logo 00081 , char * r_buffer 00082 ); 00083 00084 00085 /* GetGlobalAmpTypeName 00086 ** 00087 ** A little helper function to obtain the character string 00088 ** for the specified type code 00089 */ 00090 const char * GetGlobalAmpTypeName( AMPLITUDE_TYPE p_type ); 00091 00092 00093 #endif