xref: /titanic_41/usr/src/cmd/lms/types.h (revision 617e2443dfc17fe44fd44c0675d6aad2ffc9df42)
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 
44 typedef char                CHAR;
45 typedef signed char         INT8, *PINT8;
46 typedef signed short        INT16, *PINT16;
47 typedef signed int          INT32, *PINT32;
48 typedef unsigned char       UINT8, *PUINT8, UCHAR;
49 typedef unsigned short      UINT16, *PUINT16;
50 typedef unsigned int        UINT32, *PUINT32;
51 
52 #ifndef CONST
53 #define CONST const
54 #endif
55 
56 typedef unsigned long       DWORD;
57 typedef int                 BOOL;
58 typedef unsigned char       BYTE;
59 typedef unsigned short      WORD;
60 typedef float               FLOAT;
61 typedef FLOAT       *PFLOAT;
62 typedef BOOL        *PBOOL;
63 typedef BOOL        *LPBOOL;
64 typedef BYTE        *PBYTE;
65 typedef BYTE        *LPBYTE;
66 typedef int         *PINT;
67 typedef int         *LPINT;
68 typedef WORD        *PWORD;
69 typedef WORD        *LPWORD;
70 typedef long        *LPLONG;
71 typedef DWORD       *PDWORD;
72 typedef DWORD       *LPDWORD;
73 typedef void        *LPVOID;
74 typedef CONST void  *LPCVOID;
75 
76 typedef int                 INT;
77 typedef unsigned int        UINT;
78 typedef unsigned int        *PUINT;
79 
80 //
81 // UNICODE (Wide Character) types
82 //
83 
84 typedef unsigned short WCHAR;
85 
86 typedef WCHAR *PWCHAR, *LPWCH, *PWCH;
87 typedef CONST WCHAR *LPCWCH, *PCWCH;
88 typedef WCHAR *NWPSTR, *LPWSTR, *PWSTR;
89 typedef PWSTR *PZPWSTR;
90 typedef CONST PWSTR *PCZPWSTR;
91 typedef WCHAR *LPUWSTR, *PUWSTR;
92 typedef CONST WCHAR *LPCWSTR, *PCWSTR;
93 typedef PCWSTR *PZPCWSTR;
94 typedef CONST WCHAR *LPCUWSTR, *PCUWSTR;
95 
96 //
97 // ANSI (Multi-byte Character) types
98 //
99 typedef CHAR *PCHAR, *LPCH, *PCH;
100 typedef CONST CHAR *LPCCH, *PCCH;
101 
102 typedef CHAR *NPSTR, *LPSTR, *PSTR;
103 typedef PSTR *PZPSTR;
104 typedef CONST PSTR *PCZPSTR;
105 typedef CONST CHAR *LPCSTR, *PCSTR;
106 typedef PCSTR *PZPCSTR;
107 
108 //
109 // Neutral ANSI/UNICODE types and macros
110 //
111 #ifdef UNICODE
112 
113 #ifndef _TCHAR_DEFINED
114 typedef WCHAR TCHAR, *PTCHAR;
115 typedef WCHAR TBYTE, *PTBYTE;
116 #define _TCHAR_DEFINED
117 #endif /* !_TCHAR_DEFINED */
118 
119 typedef LPWSTR LPTCH, PTCH;
120 typedef LPWSTR PTSTR, LPTSTR;
121 typedef LPCWSTR PCTSTR, LPCTSTR;
122 typedef LPUWSTR PUTSTR, LPUTSTR;
123 typedef LPCUWSTR PCUTSTR, LPCUTSTR;
124 typedef LPWSTR LP;
125 #define __TEXT(quote) L##quote
126 
127 #else   /* UNICODE */
128 
129 #ifndef _TCHAR_DEFINED
130 typedef char TCHAR, *PTCHAR;
131 typedef unsigned char TBYTE , *PTBYTE ;
132 #define _TCHAR_DEFINED
133 #endif /* !_TCHAR_DEFINED */
134 
135 typedef LPSTR LPTCH, PTCH;
136 typedef LPSTR PTSTR, LPTSTR, PUTSTR, LPUTSTR;
137 typedef 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