ReactOS 0.4.15-dev-7659-ga55345b
acclib.h
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Name: acclib.h -- C library support. Prototypes for the (optional) local
4 * implementations of required C library functions.
5 *
6 *****************************************************************************/
7
8/*
9 * Copyright (C) 2000 - 2022, Intel Corp.
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
30 *
31 * NO WARRANTY
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
43 */
44
45#ifndef _ACCLIB_H
46#define _ACCLIB_H
47
48
49/*
50 * Prototypes and macros for local implementations of C library functions
51 */
52
53/* is* functions. The AcpiGbl_Ctypes array is defined in utclib.c */
54
55extern const UINT8 AcpiGbl_Ctypes[];
56
57#define _ACPI_XA 0x00 /* extra alphabetic - not supported */
58#define _ACPI_XS 0x40 /* extra space */
59#define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */
60#define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */
61#define _ACPI_DI 0x04 /* '0'-'9' */
62#define _ACPI_LO 0x02 /* 'a'-'z' */
63#define _ACPI_PU 0x10 /* punctuation */
64#define _ACPI_SP 0x08 /* space, tab, CR, LF, VT, FF */
65#define _ACPI_UP 0x01 /* 'A'-'Z' */
66#define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */
67
68#define isdigit(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_DI))
69#define isspace(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_SP))
70#define isxdigit(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_XD))
71#define isupper(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_UP))
72#define islower(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_LO))
73#define isprint(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU))
74#define isalpha(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
75
76/* Error code */
77
78#define EPERM 1 /* Operation not permitted */
79#define ENOENT 2 /* No such file or directory */
80#define EINTR 4 /* Interrupted system call */
81#define EIO 5 /* I/O error */
82#define EBADF 9 /* Bad file number */
83#define EAGAIN 11 /* Try again */
84#define ENOMEM 12 /* Out of memory */
85#define EACCES 13 /* Permission denied */
86#define EFAULT 14 /* Bad address */
87#define EBUSY 16 /* Device or resource busy */
88#define EEXIST 17 /* File exists */
89#define ENODEV 19 /* No such device */
90#define EINVAL 22 /* Invalid argument */
91#define EPIPE 32 /* Broken pipe */
92#define ERANGE 34 /* Math result not representable */
93
94/* Strings */
95
96char *
97strcat (
98 char *DstString,
99 const char *SrcString);
100
101char *
102strchr (
103 const char *String,
104 int ch);
105
106char *
107strpbrk (
108 const char *String,
109 const char *Delimiters);
110
111char *
112strtok (
113 char *String,
114 const char *Delimiters);
115
116char *
117strcpy (
118 char *DstString,
119 const char *SrcString);
120
121int
122strcmp (
123 const char *String1,
124 const char *String2);
125
126ACPI_SIZE
127strlen (
128 const char *String);
129
130char *
131strncat (
132 char *DstString,
133 const char *SrcString,
134 ACPI_SIZE Count);
135
136int
137strncmp (
138 const char *String1,
139 const char *String2,
140 ACPI_SIZE Count);
141
142char *
143strncpy (
144 char *DstString,
145 const char *SrcString,
146 ACPI_SIZE Count);
147
148char *
149strstr (
150 char *String1,
151 char *String2);
152
153
154/* Conversion */
155
156UINT32
157strtoul (
158 const char *String,
159 char **Terminator,
160 UINT32 Base);
161
162
163/* Memory */
164
165int
166memcmp (
167 void *Buffer1,
168 void *Buffer2,
169 ACPI_SIZE Count);
170
171void *
172memcpy (
173 void *Dest,
174 const void *Src,
175 ACPI_SIZE Count);
176
177void *
178memmove (
179 void *Dest,
180 const void *Src,
181 ACPI_SIZE Count);
182
183void *
184memset (
185 void *Dest,
186 int Value,
187 ACPI_SIZE Count);
188
189
190/* upper/lower case */
191
192int
193tolower (
194 int c);
195
196int
197toupper (
198 int c);
199
200/*
201 * utprint - printf/vprintf output functions
202 */
203const char *
205 const char *String,
206 UINT64 *NumberPtr);
207
208const char *
210 char *String,
211 UINT64 Number);
212
213int
214vsnprintf (
215 char *String,
216 ACPI_SIZE Size,
217 const char *Format,
218 va_list Args);
219
220int
221snprintf (
222 char *String,
223 ACPI_SIZE Size,
224 const char *Format,
225 ...);
226
227int
228sprintf (
229 char *String,
230 const char *Format,
231 ...);
232
233#ifdef ACPI_APPLICATION
234#define SEEK_SET 0
235#define SEEK_CUR 1
236#define SEEK_END 2
237
238/*
239 * NOTE: Currently we only need to update errno for file IOs. Other
240 * Clibrary invocations in ACPICA do not make decisions according to
241 * the errno.
242 */
243extern int errno;
244
245#ifndef EOF
246#define EOF (-1)
247#endif
248
249#define putchar(c) fputc(stdout, c)
250#define getchar(c) fgetc(stdin)
251
252int
253vprintf (
254 const char *Format,
255 va_list Args);
256
257int
258printf (
259 const char *Format,
260 ...);
261
262int
263vfprintf (
264 FILE *File,
265 const char *Format,
266 va_list Args);
267
268int
269fprintf (
270 FILE *File,
271 const char *Format,
272 ...);
273
274FILE *
275fopen (
276 const char *Path,
277 const char *Modes);
278
279void
280fclose (
281 FILE *File);
282
283int
284fread (
285 void *Buffer,
286 ACPI_SIZE Size,
287 ACPI_SIZE Count,
288 FILE *File);
289
290int
291fwrite (
292 void *Buffer,
293 ACPI_SIZE Size,
294 ACPI_SIZE Count,
295 FILE *File);
296
297int
298fseek (
299 FILE *File,
300 long Offset,
301 int From);
302
303long
304ftell (
305 FILE *File);
306
307int
308fgetc (
309 FILE *File);
310
311int
312fputc (
313 FILE *File,
314 char c);
315
316char *
317fgets (
318 char *s,
319 ACPI_SIZE Size,
320 FILE *File);
321#endif
322
323#endif /* _ACCLIB_H */
unsigned long long UINT64
unsigned char UINT8
unsigned int UINT32
PRTL_UNICODE_STRING_BUFFER Path
const char * AcpiUtPrintNumber(char *String, UINT64 Number)
Definition: utprint.c:249
const UINT8 AcpiGbl_Ctypes[]
Definition: utclib.c:918
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
char * strncat(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:605
UINT32 strtoul(const char *String, char **Terminator, UINT32 Base)
Definition: utclib.c:696
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
int toupper(int c)
Definition: utclib.c:881
int tolower(int c)
Definition: utclib.c:902
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
const char * AcpiUtScanNumber(const char *String, UINT64 *NumberPtr)
Definition: utprint.c:217
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
char * strtok(char *String, const char *Delimiters)
Definition: utclib.c:338
char * strchr(const char *String, int ch)
Definition: utclib.c:501
char * strpbrk(const char *String, const char *Delimiters)
Definition: utclib.c:302
char ** Args
Definition: acdebug.h:353
char * va_list
Definition: acmsvcex.h:78
Definition: bufpool.h:45
Definition: File.h:16
#define printf
Definition: freeldr.h:94
GLdouble s
Definition: gl.h:2039
const GLubyte * c
Definition: glext.h:8905
_Check_return_opt_ _CRTIMP int __cdecl fgetc(_Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_opt_ _CRTIMP int __cdecl vfprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
_Check_return_opt_ _CRTIMP size_t __cdecl fread(_Out_writes_bytes_(_ElementSize *_Count) void *_DstBuf, _In_ size_t _ElementSize, _In_ size_t _Count, _Inout_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fputc(_In_ int _Ch, _Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl fseek(_Inout_ FILE *_File, _In_ long _Offset, _In_ int _Origin)
_Check_return_opt_ _CRTIMP char *__cdecl fgets(_Out_writes_z_(_MaxCount) char *_Buf, _In_ int _MaxCount, _Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ _CRTIMP long __cdecl ftell(_Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP size_t __cdecl fwrite(_In_reads_bytes_(_Size *_Count) const void *_Str, _In_ size_t _Size, _In_ size_t _Count, _Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl vprintf(_In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define sprintf(buf, format,...)
Definition: sprintf.c:55
_In_ const STRING * String2
Definition: rtlfuncs.h:2357
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2439
int Count
Definition: noreturn.cpp:7
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
_In_opt_ PENTER_STATE_SYSTEM_HANDLER _In_opt_ PVOID _In_ LONG _In_opt_ LONG volatile * Number
Definition: ntpoapi.h:207
#define errno
Definition: errno.h:18
#define memset(x, y, z)
Definition: compat.h:39
static const VBE_MODE Modes[VBE_MODE_COUNT]
Definition: vbe.c:189
#define vsnprintf
Definition: tif_win32.c:406
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
#define snprintf
Definition: wintirpc.h:48