util.h

来自「unix/linux下串口调试工具」· C头文件 代码 · 共 86 行

H
86
字号
/******************************************************************************  SCT, Serial Communication Tracer  **  CopyRight (C)  Bruce (ZhaoFei), zhaofei@zflogic.com*                         http://www.zflogic.com**  All sources in the package are copyrighted under the the terms of GNU GPL******************************************************************************                                                                         *  This program is free software; you can redistribute it and/or modify*  it under the terms of the GNU General Public License as published by*  the Free Software Foundation; either version 2 of the License, or*  (at your option) any later version.**  This program is distributed in the hope that it will be useful,*  but WITHOUT ANY WARRANTY; without even the implied warranty of*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the*  GNU General Public License for more details.**  You should have received a copy of the GNU General Public License*  along with this program; if not, write to the Free Software*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA**  If you intend to use this pragram commercially on a regular basis you*  must contact the author for an appropriate donation.*                                                                       ***************************************************************************/#ifndef UTIL_H#define UTIL_H#ifndef UTIL_L#define UTIL_L  extern#endif#ifndef uchar #define uchar unsigned char#endif#ifndef uint #define uint unsigned char#endif#ifndef ulong #define ulong unsigned char#endif#ifndef bool#define bool uint#endif#ifndef true#define true 1#endif#ifndef false#define false 0#endif//basic macro#ifndef max#define max(a,b)            (((a) > (b)) ? (a) : (b))#endif#ifndef min#define min(a,b)            (((a) < (b)) ? (a) : (b))#endifUTIL_L void hex2str(char *str, uchar *hex,int len);UTIL_L uchar asc2hex(char asccode);UTIL_L void ascs2hex(uchar *hex,uchar *ascs,int srclen);UTIL_L void str2hex(uchar *hex, int *len, char *str);UTIL_L void noz_str(char *str);	//replace teminate null with ' ' of stringUTIL_L void disp_hexasc(uchar *data, int size);#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?