📄 sul.h
字号:
/******************************************************************************/
/* */
/* Copyright (C) 2005, Coolsand Technologies, Inc. */
/* All Rights Reserved */
/* */
/******************************************************************************/
/* */
/* This source code is property of Coolsand. The information contained in */
/* this file is confidential. Distribution, reproduction, as well as */
/* exploitation,or transmisison of any content of this file is not */
/* allowed except if expressly permitted. */
/* Infringements result in damage claims! */
/* */
/* FILE NAME */
/* sul.h */
/* */
/* DESCRIPTION */
/* System Utility service declarations, constant definitions and macros */
/* */
/******************************************************************************/
#if !defined(__SUL_H__)
#define __SUL_H__
#include <cswtype.h>
#include <errorcode.h>
/******************************************************************************/
/* [begin] Ctype Manipulation */
/******************************************************************************/
#define _U 0x01 // upper
#define _L 0x02 // lower
#define _D 0x04 // digit
#define _C 0x08 // cntrl
#define _P 0x10 // punct
#define _S 0x20 // white space (space/lf/tab)
#define _X 0x40 // hex digit
#define _SP 0x80 // hard space (0x20)
extern unsigned char _SUL_ctype[];
#define _SUL_ismask(x) (_SUL_ctype[(int)(unsigned char)(x)])
#define SUL_isalnum(c) ((_SUL_ismask(c)&(_U|_L|_D)) != 0)
#define SUL_isalpha(c) ((_SUL_ismask(c)&(_U|_L)) != 0)
#define SUL_iscntrl(c) ((_SUL_ismask(c)&(_C)) != 0)
#define SUL_isdigit(c) ((_SUL_ismask(c)&(_D)) != 0)
#define SUL_isgraph(c) ((_SUL_ismask(c)&(_P|_U|_L|_D)) != 0)
#define SUL_islower(c) ((_SUL_ismask(c)&(_L)) != 0)
#define SUL_isprint(c) ((_SUL_ismask(c)&(_P|_U|_L|_D|_SP)) != 0)
#define SUL_ispunct(c) ((_SUL_ismask(c)&(_P)) != 0)
#define SUL_isspace(c) ((_SUL_ismask(c)&(_S)) != 0)
#define SUL_isupper(c) ((_SUL_ismask(c)&(_U)) != 0)
#define SUL_isxdigit(c) ((_SUL_ismask(c)&(_D|_X)) != 0)
#define SUL_isascii(c) (((unsigned char)(c))<=0x7f)
#define SUL_toascii(c) (((unsigned char)(c))&0x7f)
unsigned char SRVAPI _SUL_tolower(unsigned char c);
unsigned char SRVAPI _SUL_toupper(unsigned char c);
#define SUL_tolower(c) _SUL_tolower(c)
#define SUL_toupper(c) _SUL_toupper(c)
#define SUL_mkupper(c) ( (c)-'a'+'A' )
#define SUL_mklower(c) ( (c)-'A'+'a' )
/******************************************************************************/
/* [end] Ctype Manipulation */
/******************************************************************************/
/******************************************************************************/
/* [begin] String Manipulation */
/******************************************************************************/
PTCHAR SRVAPI SUL_StrCat(
TCHAR* strDestination, //string which append one string to.
CONST TCHAR* strSource //string which append the string from.
);
PTCHAR SRVAPI SUL_StrNCat(
TCHAR *dest, //Null-terminated destination string
CONST TCHAR *src, //Null-terminated source string
UINT32 count //Number of characters to append
);
PTCHAR SRVAPI SUL_StrChr(
CONST TCHAR *string, // The string to be searched
TCHAR c // The character to search for
);
INT32 SRVAPI SUL_StrCompare(
CONST TCHAR* stringa,
CONST TCHAR* stringb
);
INT32 SRVAPI SUL_StrCompareAscii(
CONST TCHAR* stringa,
CONST TCHAR* stringb
);
INT32 SRVAPI SUL_StrCaselessCompare(
CONST TCHAR* stringa,
CONST TCHAR* stringb
);
PTCHAR SRVAPI SUL_StrCopy(
TCHAR* strDestination, //the string which copy one string to.
CONST TCHAR* strSource //the string which copy the string from.
);
PTCHAR SRVAPI SUL_StrNCopy(
TCHAR* dest,
CONST TCHAR* src,
INT32 n
);
INT32 SRVAPI SUL_StrIsAscii(
CONST TCHAR* stringa //The string is null terminated to be tested
);
UINT32 SRVAPI SUL_Strlen(
CONST TCHAR * string //The string to be sized
);
INT16 SRVAPI SUL_StrNCompare (
CONST TCHAR* stringa, //One string
CONST TCHAR* stringb, //Another string
INT32 count //Number of characters to compare
);
INT16 SRVAPI SUL_StrNCaselessCompare (
CONST TCHAR* stringa, //One string
CONST TCHAR* stringb, //Another string
UINT32 count //Number of characters to compare
);
PTCHAR SRVAPI SUL_Strtok (
TCHAR* string, // String containing token
CONST TCHAR* control, // Another string
TCHAR** newStr // The new string
);
BOOL SRVAPI SUL_StrTrim (
TCHAR* pszSource, // Pointer to the null-terminated string to be trimmed.
CONST TCHAR* pszTrimChars // Pointer to a null-terminated string containing the characters
);
PTCHAR SRVAPI SUL_StrTrimEx(
TCHAR* pszSource, // Pointer to the null-terminated string to be trimmed.
CONST TCHAR* pszTrimChars // Pointer to a null-terminated string containing the characters
);
PTCHAR SRVAPI SUL_StrTrimLeft (
TCHAR* pString //Pointer to the null-terminated string to be trimmed.
);
BOOL SRVAPI SUL_StrTrimLeftChar(
TCHAR* pszSource, //Pointer to the null-terminated string to be trimmed.
CONST TCHAR* pszTrimChars //Pointer to a null-terminated string containing the characters
);
BOOL SRVAPI SUL_StrTrimRight(
TCHAR* pString //Pointer to the null-terminated string to be trimmed.
);
void SRVAPI SUL_StrTrimRightChar(
TCHAR* pszSource,
const TCHAR* pszTrimChars
);
BOOL SRVAPI SUL_StrTrimSpace(
TCHAR *pString //Pointer to the null-terminated string to be trimmed.
);
PTCHAR SRVAPI SUL_Strrchr (
const TCHAR * string,
INT32 ch
);
UINT32 SRVAPI SUL_Strnlen(
const TCHAR * s,
UINT32 count
);
PSTR SRVAPI SUL_CharLower(
PSTR string
);
PVOID SRVAPI SUL_MemChr(
CONST VOID* pSource, //Pointer to the start of the area.
INT32 c, //The byte to fill the area with
UINT32 count //The size of the area.
);
INT16 SRVAPI SUL_MemCompare(
CONST VOID* buf1, // One area of memory
CONST VOID* buf2, // Another area of memory
UINT16 count // The size of the area.
);
BOOL SRVAPI SUL_MemCopy32(
VOID* dest, //Where to copy to
CONST VOID* src, //Where to copy from
UINT32 count //The size of the area.
);
PVOID SRVAPI SUL_MemCopy8 (
VOID* dest, //Where to copy to
CONST VOID* src, //Where to copy from
UINT32 count //The size of the area.
);
BOOL SRVAPI SUL_MemCopyEx (
VOID* dest, //Where to copy to
CONST VOID* src, //Where to copy from
UINT16 count, //The size of the area.
UINT16 nOption //The size of the area.
);
BOOL SRVAPI SUL_MemDMACopy (
VOID* dest, //Where to copy to
CONST VOID* src, //Where to copy from
UINT16 count, //The size of the area.
UINT16 nOption
);
PVOID SRVAPI SUL_MemMove(
void* dest, //Where to copy to
CONST void *src, //Where to copy from
unsigned int count //The size of the area.
);
BOOL SRVAPI SUL_MemSet32 (
VOID* pSource, //Pointer to the start of the area.
INT32 c, //The bytes to fill the area with
UINT16 count //The size of the area.
);
BOOL SRVAPI SUL_MemSet8(
void* pSource, //Pointer to the start of the area.
INT32 c, //The byte to fill the area with
UINT16 count //The size of the area.
);
BOOL SRVAPI SUL_ZeroMemory32(
VOID* pBuf,
UINT32 count
);
BOOL SRVAPI SUL_ZeroMemory8(
VOID* pBuf,
UINT32 count
);
#define STRING_IS_BLANKS( c ) ((c) == ' ')
#define STRING_IS_SPACE( c ) (((c) == ' ') || ((c) == '\t') || ((c) == '\n'))
/******************************************************************************/
/* [END] String Manipulation */
/******************************************************************************/
/******************************************************************************/
/* [begin] vsprintf Utility */
/******************************************************************************/
INT32 SRVAPI SUL_StrAToI(
const TCHAR *nptr
);
INT32 SRVAPI SUL_StrPrint(
TCHAR* buffer, // Storage location for output
CONST TCHAR* format, // Format-control string
... // Optional arguments
);
INT32 SRVAPI SUL_StrVPrint(
TCHAR* str,
CONST TCHAR* fmtstr,
va_list arg
);
/******************************************************************************/
/* [end] vsprintf Utility */
/******************************************************************************/
/******************************************************************************/
/* [begin] File System Utiltiy */
/******************************************************************************/
INT32 SRVAPI SUL_GetFileName(
const TCHAR* pathname,
TCHAR* out_file_name
);
INT32 SRVAPI SUL_Splitpath(
TCHAR *fullpath,
TCHAR *dir,
TCHAR *filename
);
INT32 SRVAPI SUL_Makepath(
TCHAR *dir,
TCHAR *filename,
TCHAR *fullpath
);
#define getfilename SUL_GetFileName // retrieves the name of the filename, For example, getfilename will return TEXT.DAT for the file \My Documents\Text.dat.
#define splitpath SUL_Splitpath // Break a path name into components
#define makepath SUL_Makepath // Create a path name from components
/******************************************************************************/
/* [END] File System Utiltiy */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -