mirror of https://github.com/tongzx/nt5src
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
143 lines
2.5 KiB
143 lines
2.5 KiB
/***
|
|
*stddef.h - definitions/declarations for common constants, types, variables
|
|
*
|
|
* Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
|
|
*
|
|
*Purpose:
|
|
* This file contains definitions and declarations for some commonly
|
|
* used constants, types, and variables.
|
|
* [ANSI]
|
|
*
|
|
* [Public]
|
|
*
|
|
****/
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif
|
|
|
|
#ifndef _INC_STDDEF
|
|
#define _INC_STDDEF
|
|
|
|
#if !defined(_WIN32)
|
|
#error ERROR: Only Win32 target supported!
|
|
#endif
|
|
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
|
|
#if !defined(_W64)
|
|
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
|
|
#define _W64 __w64
|
|
#else
|
|
#define _W64
|
|
#endif
|
|
#endif
|
|
|
|
/* Define _CRTIMP */
|
|
|
|
#ifndef _CRTIMP
|
|
#ifdef _DLL
|
|
#define _CRTIMP __declspec(dllimport)
|
|
#else /* ndef _DLL */
|
|
#define _CRTIMP
|
|
#endif /* _DLL */
|
|
#endif /* _CRTIMP */
|
|
|
|
/* Define __cdecl for non-Microsoft compilers */
|
|
|
|
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
|
|
#define __cdecl
|
|
#endif
|
|
|
|
|
|
/* Define NULL pointer value */
|
|
|
|
#ifndef NULL
|
|
#ifdef __cplusplus
|
|
#define NULL 0
|
|
#else
|
|
#define NULL ((void *)0)
|
|
#endif
|
|
#endif
|
|
|
|
|
|
/* Declare reference to errno */
|
|
|
|
#if defined(_MT) || defined(_DLL)
|
|
_CRTIMP extern int * __cdecl _errno(void);
|
|
#define errno (*_errno())
|
|
#else /* ndef _MT && ndef _DLL */
|
|
_CRTIMP extern int errno;
|
|
#endif /* _MT || _DLL */
|
|
|
|
|
|
/* Define the implementation dependent size types */
|
|
|
|
#ifndef _INTPTR_T_DEFINED
|
|
#ifdef _WIN64
|
|
typedef __int64 intptr_t;
|
|
#else
|
|
typedef _W64 int intptr_t;
|
|
#endif
|
|
#define _INTPTR_T_DEFINED
|
|
#endif
|
|
|
|
#ifndef _UINTPTR_T_DEFINED
|
|
#ifdef _WIN64
|
|
typedef unsigned __int64 uintptr_t;
|
|
#else
|
|
typedef _W64 unsigned int uintptr_t;
|
|
#endif
|
|
#define _UINTPTR_T_DEFINED
|
|
#endif
|
|
|
|
#ifndef _PTRDIFF_T_DEFINED
|
|
#ifdef _WIN64
|
|
typedef __int64 ptrdiff_t;
|
|
#else
|
|
typedef _W64 int ptrdiff_t;
|
|
#endif
|
|
#define _PTRDIFF_T_DEFINED
|
|
#endif
|
|
|
|
|
|
#ifndef _SIZE_T_DEFINED
|
|
#ifdef _WIN64
|
|
typedef unsigned __int64 size_t;
|
|
#else
|
|
typedef _W64 unsigned int size_t;
|
|
#endif
|
|
#define _SIZE_T_DEFINED
|
|
#endif
|
|
|
|
|
|
#ifndef _WCHAR_T_DEFINED
|
|
typedef unsigned short wchar_t;
|
|
#define _WCHAR_T_DEFINED
|
|
#endif
|
|
|
|
/* Define offsetof macro */
|
|
|
|
#ifdef _WIN64
|
|
#define offsetof(s,m) (size_t)( (ptrdiff_t)&(((s *)0)->m) )
|
|
#else
|
|
#define offsetof(s,m) (size_t)&(((s *)0)->m)
|
|
#endif
|
|
|
|
|
|
#ifdef _MT
|
|
_CRTIMP extern unsigned long __cdecl __threadid(void);
|
|
#define _threadid (__threadid())
|
|
_CRTIMP extern uintptr_t __cdecl __threadhandle(void);
|
|
#endif
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* _INC_STDDEF */
|