⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 msc.h

📁 This software performs code conversion of Chinese characters, including GB2312/GBK and BIG5. It a
💻 H
📖 第 1 页 / 共 2 页
字号:


#if defined DEBUG_CONST_STRING && defined __cplusplus && defined _INC_STDLIB     // for debug

#define FUNC_STR_STR_BASE(func,type,data) \
   static inline data func##_ ( const type *s1, const type **s2, int base ) { return func ( s1, (type**) s2, base ) ; } \
   static inline data func##_ (       type *s1,       type **s2, int base ) { return func ( s1,          s2, base ) ; }

#define FUNC_STR_STR(func,type,data)   \
   static inline data func##_ ( const type *s1, const type **s2 ) { return func ( s1, (type**) s2 ) ; } \
   static inline data func##_ (       type *s1,       type **s2 ) { return func ( s1,          s2 ) ; }

FUNC_STR_STR_BASE ( strtol, char, long )
FUNC_STR_STR_BASE ( strtoul, char, unsigned long )
FUNC_STR_STR ( strtod, char, double )
FUNC_STR_STR_BASE ( wcstol, wchar_t, long )
FUNC_STR_STR_BASE ( wcstoul, wchar_t, unsigned long )
FUNC_STR_STR ( wcstod, wchar_t, double )

#undef FUNC_STR_STR_BASE
#undef FUNC_STR_STR

#define strtol strtol_
#define strtoul strtoul_
#define strtod strtod_
#define wcstol wcstol_
#define wcstoul wcstoul_
#define wcstod wcstod_

#else

#define strtol(s,p,b)   strtol(s,(char**)p,b)
#define strtoul(s,p,b)  strtoul(s,(char**)p,b)
#define strtod(s,p)     strtod(s,(char**)p)
#define wcstol(s,p,b)   wcstol(s,(wchar_t**)p,b)
#define wcstoul(s,p,b)  wcstoul(s,(wchar_t**)p,b)
#define wcstod(s,p)     wcstod(s,(wchar_t**)p)

#endif // else of defined DEBUG_CONST_STRING && defined __cplusplus && defined _INC_STDLIB



////////////////////////////////////////////
//                 TIME.H                 //
////////////////////////////////////////////



// clock.cpp

#define clock clock_nt



////////////////////////////////////////////
//                 ERRNO.H                //
////////////////////////////////////////////



#ifdef ERANGE  // errno.h

#ifndef EILSEQ
#define EILSEQ    200
#endif

#endif



////////////////////////////////////////////
//                LIMITS.H                //
////////////////////////////////////////////



#ifdef CHAR_BIT
#define SHORT_BIT    16
#define LONG_BIT     32
#define INT_BIT      32
#endif


#ifdef INT_MAX

#ifndef SIZE_MAX
#define SIZE_MAX        ((size_t)-1)
#endif
#ifndef PTRDIFF_MAX
#define PTRDIFF_MAX     ((ptrdiff_t)(((size_t)-1)>>1))
#endif
#ifndef PTRDIFF_MIN
#define PTRDIFF_MIN     ((ptrdiff_t)(~(((size_t)-1)>>1)))
#endif

#ifndef UINTPTR_MAX
#define UINTPTR_MAX     ((uintptr_t)-1)
#endif
#ifndef INTPTR_MAX
#define INTPTR_MAX      ((intptr_t)(((uintptr_t)-1)>>1))
#endif
#ifndef INTPTR_MIN
#define INTPTR_MIN      ((intptr_t)(~(((uintptr_t)-1)>>1)))
#endif

#endif // INT_MAX



////////////////////////////////////////////
//                 UNICODE                //
////////////////////////////////////////////



typedef wchar_t         wchar16_t ;
typedef unsigned long   wchar32_t ;


#ifdef INT_MAX
#define UTF16_MAX               0x10FFFF
#define UTF32_MAX             0x7FFFFFFF
#endif


#define IsHighSurrogate(x)    ( ( (x) & 0xFFFFFC00 ) == 0xD800 )
#define IsLowSurrogate(x)     ( ( (x) & 0xFFFFFC00 ) == 0xDC00 )
#define IsSurrogate(x)        ( ( (x) & 0xFFFFF800 ) == 0xD800 )


// 僗僇儔乕抣偐傜僒儘僎乕僩抣傪嶌惉
static inline unsigned long MAKE_UNICODE_SURROGATE ( long x ) {
   return ( (unsigned long)( (unsigned)( x - 0x10000 ) / 0x400 + 0xD800 ) << 16 ) + ( (unsigned)( x - 0x10000 ) % 0x400 + 0xDC00 ) ;
}

// 僒儘僎乕僩抣偐傜僗僇儔乕抣傪嶌惉
static inline long MAKE_UNICODE_SCALAR ( unsigned long high, unsigned long low ) {
   return ( high - 0xD800 ) * 0x400 + ( low - 0xDC00 ) + 0x10000 ;
}


#define BYTE_ORDER_MARK          0xFEFF
#define BYTE_ORDER_MARK_BE       0xFFFE
#define REPLACEMENT_CHARACTER    0xFFFD



////////////////////////////////////////////
//                 UTILITY                //
////////////////////////////////////////////



#define NELEMOF(x)      ( sizeof(x) / sizeof(x[0]) )



#ifdef __cplusplus
extern "C" {
#endif

// winmain.cpp
wchar_t *a2wdup ( const char *string ) ;
wchar_t *a2wduplen ( const char *string, int srclen, int *p_dstlen ) ;
char *w2adup ( const wchar_t *string ) ;
char *w2aduplen ( const wchar_t *string, int srclen, int *p_dstlen ) ;

// winmain.cpp
char *strdup_expand ( const char *string, size_t maxlen, size_t addlen ) ;
wchar_t *wcsdup_expand ( const wchar_t *string, size_t maxlen, size_t addlen ) ;
#define strdup_max(string,maxlen)   strdup_expand ( string, maxlen, 0 )
#define wcsdup_max(string,maxlen)   wcsdup_expand ( string, maxlen, 0 )

#ifdef __cplusplus
}
#endif



////////////////////////////////////////////
//             PATH / FILENAME            //
////////////////////////////////////////////



// 僷僗柤嬫愗傝暥帤偐丠
static inline int IsPathSeparator ( int c ) { return c == '\\' || c == '/' ; }

// 僷僗柤嬫愗傝暥帤偍傛傃僪儔僀僽巜帵暥帤偐丠
static inline int IsPathOrDriveSeparator ( int c ) { return c == '\\' || c == ':' || c == '/' ; }


// MAX_PATH 傪挻偊傞僷僗柤
// max len of "\\?\C:\<path>", "\\?\UNC\<server>\<share>"
#ifdef MAX_PATH
#define MAX_LONG_PATH   0x8000
#endif

// URL 偺嵟戝挿
#ifdef MAX_PATH
#define MAX_URL   2084     // INTERNET_MAX_URL_LENGTH (wininet.h)
#endif



////////////////////////////////////////////
//             WINDOWS VERSION            //
////////////////////////////////////////////



#ifdef _WIN64
#define NT_ONLY
#endif

#ifdef NT_ONLY
#define NTFUNC_IMPORT_IMPLICITLY
#endif

#ifdef NT_ONLY
#define IsNT()       1
#else
#define IsNT()       (!( _osver & 0x8000 ))
#endif


#define IsWin95()                ( ! IsNT() && _winver == 0x400 )
#define IsWin98()                ( ! IsNT() && _winver == 0x40A )
#define IsWinME()                ( ! IsNT() && _winver == 0x45A )

#define IsWin95orLater()         ( ! IsNT() && _winver >= 0x400 )
#define IsWin98orLater()         ( ! IsNT() && _winver >= 0x40A )
#define IsWinMEorLater()         ( ! IsNT() && _winver >= 0x45A )

#define IsWinNT31()              ( IsNT() && _winver == 0x30A )
#define IsWinNT35()              ( IsNT() && _winver == 0x332 )
#define IsWinNT351()             ( IsNT() && _winver == 0x333 )
#define IsWinNT40()              ( IsNT() && _winver == 0x400 )
#define IsWin2000()              ( IsNT() && _winver == 0x500 )
#define IsWinXP()                ( IsNT() && _winver == 0x501 )
#define IsWinServer2003()        ( IsNT() && _winver == 0x502 )
#define IsWinVISTA()             ( IsNT() && _winver == 0x600 )

#define IsWinNT31orLater()       ( IsNT() && _winver >= 0x30A )
#define IsWinNT35orLater()       ( IsNT() && _winver >= 0x332 )
#define IsWinNT351orLater()      ( IsNT() && _winver >= 0x333 )
#define IsWinNT40orLater()       ( IsNT() && _winver >= 0x400 )
#define IsWin2000orLater()       ( IsNT() && _winver >= 0x500 )
#define IsWinXPorLater()         ( IsNT() && _winver >= 0x501 )
#define IsWinServer2003orLater() ( IsNT() && _winver >= 0x502 )
#define IsWinVISTAorLater()      ( IsNT() && _winver >= 0x600 )


// winmain.cpp
#if ! defined _MSC_VER || _MSC_VER >= 1500 || defined NOCRT
unsigned int get_osver_winver_ ( int is_get_winver ) ;
#define _osver    get_osver_winver_(0)
#define _winver   get_osver_winver_(1)
#endif



////////////////////////////////////////////
//               WINDOWS API              //
////////////////////////////////////////////



#if defined CreateFile     // windows.h

#include <commctrl.h>

#if ! defined _MSC_VER || _MSC_VER < 1300
#include <shlobj.h>
#else
#include <shtypes.h>
#endif

#if ! defined _MSC_VER || _MSC_VER < 1300
#define InterlockedExchange(Target,Value) InterlockedExchange((long*)(Target),Value)
#endif

#define GETPROCADDRESS(dll,type,function) ( ! dll || ! function && ( function = (type) GetProcAddress ( dll, #function ) ) == NULL )

#endif // defined CreateFile



////////////////////////////////////////////
//               INTSHCUT.H               //
////////////////////////////////////////////



#if defined DECLARE_INTERFACE_ && defined TranslateURL && ! defined IUniformResourceLocator     // intshcut.h

#define IUniformResourceLocatorA IUniformResourceLocator
#define IID_IUniformResourceLocatorA IID_IUniformResourceLocator

#undef INTERFACE
#define INTERFACE IUniformResourceLocatorW
DECLARE_INTERFACE_ ( IUniformResourceLocatorW, IUnknown ) {
   STDMETHOD ( QueryInterface ) ( THIS_ REFIID,PVOID* ) PURE ;
   STDMETHOD_ ( ULONG, AddRef ) ( THIS ) PURE ;
   STDMETHOD_ ( ULONG, Release ) ( THIS ) PURE ;
   STDMETHOD ( SetURL ) ( THIS_ PCWSTR, DWORD ) PURE ;
   STDMETHOD ( GetURL ) ( THIS_ PWSTR* ) PURE ;
   STDMETHOD ( InvokeCommand ) ( THIS_ PURLINVOKECOMMANDINFO ) PURE ;
} ;
#undef INTERFACE

DEFINE_GUID ( IID_IUniformResourceLocatorW, 0xCABB0DA0L, 0xDA57, 0x11CF, 0x99, 0x74, 0x00, 0x20, 0xAF, 0xD7, 0x97, 0x62 ) ;

#endif // defined DECLARE_INTERFACE_ && defined TranslateURL && ! defined IUniformResourceLocator



////////////////////////////////////////////
//                  WIN64                 //
////////////////////////////////////////////



#if defined GetWindowLong     // windows.h


#ifndef GetWindowLongPtr
#define LONG_PTR  LONG
#define ULONG_PTR ULONG
#define INT_PTR   INT
#define UINT_PTR  UINT
#define DWORD_PTR DWORD
#endif


#ifndef _WIN64

#undef GetWindowLongPtrA
#undef GetWindowLongPtrW
#undef SetWindowLongPtrA
#undef SetWindowLongPtrW

#define GetWindowLongPtrA(h,i)      (LONG_PTR) GetWindowLongA ( h, i )
#define GetWindowLongPtrW(h,i)      (LONG_PTR) GetWindowLongW ( h, i )
#define SetWindowLongPtrA(h,i,v)    (LONG_PTR) SetWindowLongA ( h, i, (LONG) v )
#define SetWindowLongPtrW(h,i,v)    (LONG_PTR) SetWindowLongW ( h, i, (LONG) v )

#ifndef GetWindowLongPtr
#ifdef UNICODE
#define GetWindowLongPtr   GetWindowLongPtrW
#define SetWindowLongPtr   SetWindowLongPtrW
#else
#define GetWindowLongPtr   GetWindowLongPtrA
#define SetWindowLongPtr   SetWindowLongPtrA
#endif
#endif

#endif // ifndef _WIN64


#ifndef GWLP_WNDPROC
#define GWLP_WNDPROC       GWL_WNDPROC
#define GWLP_HINSTANCE     GWL_HINSTANCE
#define GWLP_HWNDPARENT    GWL_HWNDPARENT
#define GWLP_USERDATA      GWL_USERDATA
#define GWLP_ID            GWL_ID
#define DWLP_MSGRESULT     DWL_MSGRESULT
#define DWLP_DLGPROC       DWL_DLGPROC
#define DWLP_USER          DWL_USER
#endif


#ifndef _WIN64

#undef GetClassLongPtrA
#undef GetClassLongPtrW
#undef SetClassLongPtrA
#undef SetClassLongPtrW

#define GetClassLongPtrA(h,i)       (ULONG_PTR) GetClassLongA ( h, i )
#define GetClassLongPtrW(h,i)       (ULONG_PTR) GetClassLongW ( h, i )
#define SetClassLongPtrA(h,i,v)     (ULONG_PTR) SetClassLongA ( h, i, (LONG) v )
#define SetClassLongPtrW(h,i,v)     (ULONG_PTR) SetClassLongW ( h, i, (LONG) v )

#ifndef GetClassLongPtr
#ifdef UNICODE
#define GetClassLongPtr   GetClassLongPtrW
#define SetClassLongPtr   SetClassLongPtrW
#else
#define GetClassLongPtr   GetClassLongPtrA
#define SetClassLongPtr   SetClassLongPtrA
#endif
#endif

#endif // ifndef _WIN64


#ifndef GCLP_MENUNAME
#define GCLP_MENUNAME      GCLP_MENUNAME
#define GCLP_HBRBACKGROUND GCLP_HBRBACKGROUND
#define GCLP_HCURSOR       GCLP_HCURSOR
#define GCLP_HICON         GCLP_HICON
#define GCLP_HMODULE       GCLP_HMODULE
#define GCLP_WNDPROC       GCLP_WNDPROC
#define GCLP_HICONSM       GCLP_HICONSM
#endif


#undef MAKEINTRESOURCEW
#undef MAKEINTRESOURCEA
#define MAKEINTRESOURCEW(x)   (wchar_t*) ( ( (LONG_PTR) (x) ) & 0xFFFF )
#define MAKEINTRESOURCEA(x)   (char*)    ( ( (LONG_PTR) (x) ) & 0xFFFF )


#endif // defined GetWindowLong



////////////////////////////////////////////
//          PLATFORM SDK VERSION          //
////////////////////////////////////////////



#ifdef _MSC_VER

#if defined WINVER && WINVER > 0x0400
#error Error: Not defined WINVER 0x0400
#endif

#if defined _WIN32_WINNT && _WIN32_WINNT > 0x0400
#error Error: Not defined _WIN32_WINNT 0x0400
#endif

#if defined _WIN32_WINDOWS && _WIN32_WINDOWS > 0x0400
#error Error: Not defined _WIN32_WINDOWS 0x0400
#endif

#if defined _WIN32_IE && _WIN32_IE > 0x0200
#error Error: Not defined _WIN32_IE 0x0200
#endif

#endif // _MSC_VER



////////////////////////////////////////////
//              STRING LOCALE             //
////////////////////////////////////////////



#pragma setlocale ("japanese")



////////////////////////////////////////////
//               CONFORMANCE              //
////////////////////////////////////////////



#ifdef _MSC_VER

#if _MSC_VER >= 1400
#pragma warning ( disable: 4996 )   // function was declared deprecated
#endif

#if _MSC_VER >= 1300
#pragma conform ( forScope, on )
#else
#define for if (0) {} else for
#endif

#if ! defined __STDC__
#error Error: Not defined __STDC__
#endif

#endif // _MSC_VER



////////////////////////////////////////////
//                 THE END                //
////////////////////////////////////////////



#endif // MSC_H


⌨️ 快捷键说明

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