📄 util.hpp
字号:
/* ======================================================================== *\ | | | JOYIT Communication Technology | Copyright (C) 2003-2004, All Right Reserved. | | System: Programmable Signaling Gateway | Sub-system: MTP3 | Filename: util.hpp | Environment: LINUX -- Red Hat 7.2 & GNU C/C++ Compiler 2.96 | vxWorks -- Tornado 2.0 & vxWorks 5.4 | Function description: Declare the general function. | |\* ======================================================================== */#ifndef _UTIL_HPP#define _UTIL_HPP#define MIN(x, y) ( (x) > (y) ? (y) : (x) )#define MAX(x, y) ( (x) < (y) ? (y) : (x) )#ifndef _DATATYPE_HPP#include "datatype.hpp"#endif#ifndef _OBJECTS_HPP#include "objects.hpp"#endif#ifndef _IPCCLNT_HPP#include "ipcclnt.hpp"#endifextern "C"{#ifndef _STDARG_H#include <stdarg.h>#endif};#define NO_TIMER 0xFFFFstruct TimerOption{ UINT8 precision : 1; UINT8 runMode : 1; UINT8 reserved : 6;};char * pc14str(UINT32 spc); // Convert the signaling point code (14bits) to string.char * pc24str(UINT32 spc); // Convert the signaling point code (24bits) to string.void * SendMessage(WObject *, WEvent&);// Send the event to the OBJECT directly, and the // event will be handled immediatly.void * PostMessage(WObject *, WEvent&);// Post the event to the OBJECT's event queue.void * PostMessage(WEvent&); // Post the event to the system event queue.#ifdef __VXWORKS__timerid_t StartTimer(TimerEvent& tmrev, ushort evCode, UINT32 lasttime, struct TimerOption tmropt);void StopTimer(timerid_t tmrid);void StopTimer(TimerEvent& tmrev, ushort evCode);#elif __LINUX__ // __VXWORKS__int StartTimer(const WEvent& event, int timeval, char flag = 0, char pre = 2);int StopTimer(const WEvent& event);#ifdef __PSG_REDUNDANT // Add 2006-8-22, by Wu jianjin.// #ifdef __MARCONI__int VerifyTimer(const WEvent& event, int timeval, char flag = 0, char pre = 2); // Add 2005-01-11, by Wujianjin.// #endif // __MARCONI__#endif // ifndef __PSG_REDUNDANT#endif // __LINUX__// void Print(char * msg, uchar ps=0); // printStyle default value is zero.void Print(const char *f, ...); // Add 2005-10-27, by Wujianjin.int Send2Icp(WEvent& event, int directout = 0);/*RealModuleId * GetRealId(rmi_t& id); // Get self read module ID.int IfPrimary( ); // Get the module primary/secondary status. 0: Primary; 1: Secondary; 2: Standalone.*/void display(unsigned char * buf, int len, unsigned char flag, unsigned short p1, unsigned char p2=0, unsigned short mType=0);extern char isDisplay; // Display detail message. 0: No; 1: Yes.extern char isLog; // Log detail message to LOG. 0: No; 1: Yes.// ### The following line adding for SAP project. 2007-07-26//externextern int gDebugLevel;//#define DEFAULT_DEBUG_LEVEL 1//#define DEBUG(message_level) if (gDebugLevel <= message_level) Print#if 1#define DEBUG(message_level) \if (message_level >= gDebugLevel)\ printf("[FILENAME:%s][LINENO:%d]", __FILE__, __LINE__);\if (message_level >= gDebugLevel)\ Print#else#define DEBUG(message_level) //#endif // if 1// 打印等级enum DebugPrintLevel{ EN_PRINT_LEVEL_DEBUG = 0, EN_PRINT_LEVEL_INFO, EN_PRINT_LEVEL_WARNING, EN_PRINT_LEVEL_EMERGENT, EN_PRINT_LEVEL_ERR,};//print color#define COLOREND printf("\033[0m") // 终端默认颜色#define RED printf("\033[0;31;40m")#define GREEN printf("\033[0;32;40m")#define YELLOW printf("\033[0;33;40m")#define BLUE printf("\033[0;34;40m")#define VIOLETRED printf("\033[0;35;40m")#define SKYBULE printf("\033[0;36;40m")// ### End 2007-07-26#endif// ------------------------------------------------------------------------//// Revision list.// ==============//// 1.0, 2003-06-08, Wu jianjin// Initial version.// 1.1, 2004-11-14, Wu jianjin// Add dual node control.// ------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -