acclib.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. * Copyright (C) 2000 - 2015, Intel Corp.
  9. * All rights reserved.
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions
  13. * are met:
  14. * 1. Redistributions of source code must retain the above copyright
  15. * notice, this list of conditions, and the following disclaimer,
  16. * without modification.
  17. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18. * substantially similar to the "NO WARRANTY" disclaimer below
  19. * ("Disclaimer") and any redistribution must be conditioned upon
  20. * including a substantially similar Disclaimer requirement for further
  21. * binary redistribution.
  22. * 3. Neither the names of the above-listed copyright holders nor the names
  23. * of any contributors may be used to endorse or promote products derived
  24. * from this software without specific prior written permission.
  25. *
  26. * Alternatively, this software may be distributed under the terms of the
  27. * GNU General Public License ("GPL") version 2 as published by the Free
  28. * Software Foundation.
  29. *
  30. * NO WARRANTY
  31. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  32. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  33. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  34. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  35. * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  36. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  37. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  38. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  39. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  40. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  41. * POSSIBILITY OF SUCH DAMAGES.
  42. */
  43. #ifndef _ACCLIB_H
  44. #define _ACCLIB_H
  45. /*
  46. * Prototypes and macros for local implementations of C library functions
  47. */
  48. /* is* functions. The AcpiGbl_Ctypes array is defined in utclib.c */
  49. extern const UINT8 AcpiGbl_Ctypes[];
  50. #define _ACPI_XA 0x00 /* extra alphabetic - not supported */
  51. #define _ACPI_XS 0x40 /* extra space */
  52. #define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */
  53. #define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */
  54. #define _ACPI_DI 0x04 /* '0'-'9' */
  55. #define _ACPI_LO 0x02 /* 'a'-'z' */
  56. #define _ACPI_PU 0x10 /* punctuation */
  57. #define _ACPI_SP 0x08 /* space, tab, CR, LF, VT, FF */
  58. #define _ACPI_UP 0x01 /* 'A'-'Z' */
  59. #define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */
  60. #define isdigit(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_DI))
  61. #define isspace(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_SP))
  62. #define isxdigit(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_XD))
  63. #define isupper(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_UP))
  64. #define islower(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_LO))
  65. #define isprint(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU))
  66. #define isalpha(c) (AcpiGbl_Ctypes[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
  67. /* Strings */
  68. char *
  69. strcat (
  70. char *DstString,
  71. const char *SrcString);
  72. char *
  73. strchr (
  74. const char *String,
  75. int ch);
  76. char *
  77. strcpy (
  78. char *DstString,
  79. const char *SrcString);
  80. int
  81. strcmp (
  82. const char *String1,
  83. const char *String2);
  84. ACPI_SIZE
  85. strlen (
  86. const char *String);
  87. char *
  88. strncat (
  89. char *DstString,
  90. const char *SrcString,
  91. ACPI_SIZE Count);
  92. int
  93. strncmp (
  94. const char *String1,
  95. const char *String2,
  96. ACPI_SIZE Count);
  97. char *
  98. strncpy (
  99. char *DstString,
  100. const char *SrcString,
  101. ACPI_SIZE Count);
  102. char *
  103. strstr (
  104. char *String1,
  105. char *String2);
  106. /* Conversion */
  107. UINT32
  108. strtoul (
  109. const char *String,
  110. char **Terminator,
  111. UINT32 Base);
  112. /* Memory */
  113. int
  114. memcmp (
  115. void *Buffer1,
  116. void *Buffer2,
  117. ACPI_SIZE Count);
  118. void *
  119. memcpy (
  120. void *Dest,
  121. const void *Src,
  122. ACPI_SIZE Count);
  123. void *
  124. memset (
  125. void *Dest,
  126. int Value,
  127. ACPI_SIZE Count);
  128. /* upper/lower case */
  129. int
  130. tolower (
  131. int c);
  132. int
  133. toupper (
  134. int c);
  135. #endif /* _ACCLIB_H */