1/*******************************************************************************
2 * Copyright (C) 2004-2008 Intel Corp. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 *  - Redistributions of source code must retain the above copyright notice,
8 *    this list of conditions and the following disclaimer.
9 *
10 *  - Redistributions in binary form must reproduce the above copyright notice,
11 *    this list of conditions and the following disclaimer in the documentation
12 *    and/or other materials provided with the distribution.
13 *
14 *  - Neither the name of Intel Corp. nor the names of its
15 *    contributors may be used to endorse or promote products derived from this
16 *    software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corp. OR THE CONTRIBUTORS
22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 *******************************************************************************/
30
31/**********************************************************************
32*                                                                     *
33* Module Name:                                                        *
34*   types.h															  *
35*                                                                     *
36* Abstract:                                                           *
37*   types for each OS are declared here.                              *
38*                                                                     *
39**********************************************************************/
40
41#ifndef _TYPES_H_
42#define _TYPES_H_
43
44typedef char                CHAR;
45typedef signed char         INT8, *PINT8;
46typedef signed short        INT16, *PINT16;
47typedef signed int          INT32, *PINT32;
48typedef unsigned char       UINT8, *PUINT8, UCHAR;
49typedef unsigned short      UINT16, *PUINT16;
50typedef unsigned int        UINT32, *PUINT32;
51
52#ifndef CONST
53#define CONST const
54#endif
55
56typedef unsigned long       DWORD;
57typedef int                 BOOL;
58typedef unsigned char       BYTE;
59typedef unsigned short      WORD;
60typedef float               FLOAT;
61typedef FLOAT       *PFLOAT;
62typedef BOOL        *PBOOL;
63typedef BOOL        *LPBOOL;
64typedef BYTE        *PBYTE;
65typedef BYTE        *LPBYTE;
66typedef int         *PINT;
67typedef int         *LPINT;
68typedef WORD        *PWORD;
69typedef WORD        *LPWORD;
70typedef long        *LPLONG;
71typedef DWORD       *PDWORD;
72typedef DWORD       *LPDWORD;
73typedef void        *LPVOID;
74typedef CONST void  *LPCVOID;
75
76typedef int                 INT;
77typedef unsigned int        UINT;
78typedef unsigned int        *PUINT;
79
80//
81// UNICODE (Wide Character) types
82//
83
84typedef unsigned short WCHAR;
85
86typedef WCHAR *PWCHAR, *LPWCH, *PWCH;
87typedef CONST WCHAR *LPCWCH, *PCWCH;
88typedef WCHAR *NWPSTR, *LPWSTR, *PWSTR;
89typedef PWSTR *PZPWSTR;
90typedef CONST PWSTR *PCZPWSTR;
91typedef WCHAR *LPUWSTR, *PUWSTR;
92typedef CONST WCHAR *LPCWSTR, *PCWSTR;
93typedef PCWSTR *PZPCWSTR;
94typedef CONST WCHAR *LPCUWSTR, *PCUWSTR;
95
96//
97// ANSI (Multi-byte Character) types
98//
99typedef CHAR *PCHAR, *LPCH, *PCH;
100typedef CONST CHAR *LPCCH, *PCCH;
101
102typedef CHAR *NPSTR, *LPSTR, *PSTR;
103typedef PSTR *PZPSTR;
104typedef CONST PSTR *PCZPSTR;
105typedef CONST CHAR *LPCSTR, *PCSTR;
106typedef PCSTR *PZPCSTR;
107
108//
109// Neutral ANSI/UNICODE types and macros
110//
111#ifdef UNICODE
112
113#ifndef _TCHAR_DEFINED
114typedef WCHAR TCHAR, *PTCHAR;
115typedef WCHAR TBYTE, *PTBYTE;
116#define _TCHAR_DEFINED
117#endif /* !_TCHAR_DEFINED */
118
119typedef LPWSTR LPTCH, PTCH;
120typedef LPWSTR PTSTR, LPTSTR;
121typedef LPCWSTR PCTSTR, LPCTSTR;
122typedef LPUWSTR PUTSTR, LPUTSTR;
123typedef LPCUWSTR PCUTSTR, LPCUTSTR;
124typedef LPWSTR LP;
125#define __TEXT(quote) L##quote
126
127#else   /* UNICODE */
128
129#ifndef _TCHAR_DEFINED
130typedef char TCHAR, *PTCHAR;
131typedef unsigned char TBYTE , *PTBYTE ;
132#define _TCHAR_DEFINED
133#endif /* !_TCHAR_DEFINED */
134
135typedef LPSTR LPTCH, PTCH;
136typedef LPSTR PTSTR, LPTSTR, PUTSTR, LPUTSTR;
137typedef LPCSTR PCTSTR, LPCTSTR, PCUTSTR, LPCUTSTR;
138#define __TEXT(quote) quote
139
140#endif /* UNICODE */
141
142#define TEXT(quote) __TEXT(quote)
143
144#if defined(__sun) || defined(_LINUX)
145#define EVENTLOG_ERROR_TYPE             LOG_ERR
146#define EVENTLOG_WARNING_TYPE           LOG_WARNING
147#define EVENTLOG_INFORMATION_TYPE       LOG_INFO
148
149#ifdef DEBUGLOG
150#if defined(__sun)
151#define PRINT(...) printf(__VA_ARGS__)
152#define ERROR(...) fprintf(stderr, __VA_ARGS__)
153#else // _LINUX
154#define PRINT(format, arg...) printf(format, ##arg)
155#define ERROR(format, arg...) fprintf(stderr, format, ##arg)
156#endif // __sun
157#else
158#if defined(__sun)
159#define PRINT(...)
160#define ERROR(...)
161#else // _LINUX
162#define PRINT(format, arg...)
163#define ERROR(format, arg...)
164#endif // __sun
165#endif //DEBUGLOG
166#endif	// __sun || _LINUX
167
168#endif /* _TYPES_H_ */
169