ReactOS 0.4.15-dev-7934-g1dc8d80
utstring.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
Include dependency graph for utstring.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_UTILITIES
 

Functions

void AcpiUtPrintString (char *String, UINT16 MaxLength)
 
void AcpiUtRepairName (char *Name)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_UTILITIES

Definition at line 49 of file utstring.c.

Function Documentation

◆ AcpiUtPrintString()

void AcpiUtPrintString ( char String,
UINT16  MaxLength 
)

Definition at line 69 of file utstring.c.

72{
73 UINT32 i;
74
75
76 if (!String)
77 {
78 AcpiOsPrintf ("<\"NULL STRING PTR\">");
79 return;
80 }
81
82 AcpiOsPrintf ("\"");
83 for (i = 0; (i < MaxLength) && String[i]; i++)
84 {
85 /* Escape sequences */
86
87 switch (String[i])
88 {
89 case 0x07:
90
91 AcpiOsPrintf ("\\a"); /* BELL */
92 break;
93
94 case 0x08:
95
96 AcpiOsPrintf ("\\b"); /* BACKSPACE */
97 break;
98
99 case 0x0C:
100
101 AcpiOsPrintf ("\\f"); /* FORMFEED */
102 break;
103
104 case 0x0A:
105
106 AcpiOsPrintf ("\\n"); /* LINEFEED */
107 break;
108
109 case 0x0D:
110
111 AcpiOsPrintf ("\\r"); /* CARRIAGE RETURN*/
112 break;
113
114 case 0x09:
115
116 AcpiOsPrintf ("\\t"); /* HORIZONTAL TAB */
117 break;
118
119 case 0x0B:
120
121 AcpiOsPrintf ("\\v"); /* VERTICAL TAB */
122 break;
123
124 case '\'': /* Single Quote */
125 case '\"': /* Double Quote */
126 case '\\': /* Backslash */
127
128 AcpiOsPrintf ("\\%c", (int) String[i]);
129 break;
130
131 default:
132
133 /* Check for printable character or hex escape */
134
135 if (isprint ((int) String[i]))
136 {
137 /* This is a normal character */
138
139 AcpiOsPrintf ("%c", (int) String[i]);
140 }
141 else
142 {
143 /* All others will be Hex escapes */
144
145 AcpiOsPrintf ("\\x%2.2X", (INT32) String[i]);
146 }
147 break;
148 }
149 }
150
151 AcpiOsPrintf ("\"");
152
153 if (i == MaxLength && String[i])
154 {
155 AcpiOsPrintf ("...");
156 }
157}
signed int INT32
unsigned int UINT32
#define isprint(c)
Definition: acclib.h:73
void ACPI_INTERNAL_VAR_XFACE AcpiOsPrintf(const char *Format,...)
Definition: osl.c:851
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433

◆ AcpiUtRepairName()

void AcpiUtRepairName ( char Name)

Definition at line 183 of file utstring.c.

185{
186 UINT32 i;
187 BOOLEAN FoundBadChar = FALSE;
188 UINT32 OriginalName;
189
190
191 ACPI_FUNCTION_NAME (UtRepairName);
192
193
194 /*
195 * Special case for the root node. This can happen if we get an
196 * error during the execution of module-level code.
197 */
199 {
200 return;
201 }
202
203 ACPI_COPY_NAMESEG (&OriginalName, &Name[0]);
204
205 /* Check each character in the name */
206
207 for (i = 0; i < ACPI_NAMESEG_SIZE; i++)
208 {
209 if (AcpiUtValidNameChar (Name[i], i))
210 {
211 continue;
212 }
213
214 /*
215 * Replace a bad character with something printable, yet technically
216 * "odd". This prevents any collisions with existing "good"
217 * names in the namespace.
218 */
219 Name[i] = '_';
220 FoundBadChar = TRUE;
221 }
222
223 if (FoundBadChar)
224 {
225 /* Report warning only if in strict mode or debug mode */
226
227 if (!AcpiGbl_EnableInterpreterSlack)
228 {
230 "Invalid character(s) in name (0x%.8X) %p, repaired: [%4.4s]",
231 OriginalName, Name, &Name[0]));
232 }
233 else
234 {
236 "Invalid character(s) in name (0x%.8X), repaired: [%4.4s]",
237 OriginalName, Name));
238 }
239 }
240}
unsigned char BOOLEAN
#define ACPI_ROOT_PATHNAME
Definition: acnames.h:93
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define ACPI_WARNING(plist)
Definition: acoutput.h:238
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_DB_INFO
Definition: acoutput.h:153
#define ACPI_FUNCTION_NAME(a)
Definition: acoutput.h:479
#define ACPI_COPY_NAMESEG(dest, src)
Definition: actypes.h:565
#define ACPI_COMPARE_NAMESEG(a, b)
Definition: actypes.h:564
#define ACPI_NAMESEG_SIZE
Definition: actypes.h:415
BOOLEAN AcpiUtValidNameChar(char Character, UINT32 Position)
Definition: utascii.c:102
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117

Referenced by AcpiNsExternalizeName(), AcpiNsSearchAndEnter(), and AcpiUtGetNodeName().