1 /******************************************************************************
2 *
3 * Module Name: psutils - Parser miscellaneous utilities (Parser only)
4 *
5 *****************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2011, 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.
221 *
222 * FUNCTION: Utility functions
223 *
224 * DESCRIPTION: Low level character and object functions
225 *
226 ******************************************************************************/
227
228
229 /*
230 * Is "c" a namestring lead character?
231 */
232 BOOLEAN
233 AcpiPsIsLeadingChar (
234 UINT32 c)
235 {
236 return ((BOOLEAN) (c == '_' || (c >= 'A' && c <= 'Z')));
237 }
238
239
240 /*
241 * Is "c" a namestring prefix character?
242 */
243 BOOLEAN
244 AcpiPsIsPrefixChar (
245 UINT32 c)
246 {
247 return ((BOOLEAN) (c == '\\' || c == '^'));
248 }
249
250
251 /*
252 * Get op's name (4-byte name segment) or 0 if unnamed
253 */
254 UINT32
255 AcpiPsGetName (
256 ACPI_PARSE_OBJECT *Op)
257 {
258
259 /* The "generic" object has no name associated with it */
260
261 if (Op->Common.Flags & ACPI_PARSEOP_GENERIC)
262 {
263 return (0);
264 }
265
266 /* Only the "Extended" parse objects have a name */
267
268 return (Op->Named.Name);
269 }
270
271
272 /*
273 * Set op's name
274 */
275 void
276 AcpiPsSetName (
277 ACPI_PARSE_OBJECT *Op,
278 UINT32 name)
279 {
280
281 /* The "generic" object has no name associated with it */
282
283 if (Op->Common.Flags & ACPI_PARSEOP_GENERIC)
284 {
285 return;
286 }
287
288 Op->Named.Name = name;
289 }
290
|
1 /******************************************************************************
2 *
3 * Module Name: psutils - Parser miscellaneous utilities (Parser only)
4 *
5 *****************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2013, 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.
221 *
222 * FUNCTION: Utility functions
223 *
224 * DESCRIPTION: Low level character and object functions
225 *
226 ******************************************************************************/
227
228
229 /*
230 * Is "c" a namestring lead character?
231 */
232 BOOLEAN
233 AcpiPsIsLeadingChar (
234 UINT32 c)
235 {
236 return ((BOOLEAN) (c == '_' || (c >= 'A' && c <= 'Z')));
237 }
238
239
240 /*
241 * Get op's name (4-byte name segment) or 0 if unnamed
242 */
243 UINT32
244 AcpiPsGetName (
245 ACPI_PARSE_OBJECT *Op)
246 {
247
248 /* The "generic" object has no name associated with it */
249
250 if (Op->Common.Flags & ACPI_PARSEOP_GENERIC)
251 {
252 return (0);
253 }
254
255 /* Only the "Extended" parse objects have a name */
256
257 return (Op->Named.Name);
258 }
259
260
261 /*
262 * Set op's name
263 */
264 void
265 AcpiPsSetName (
266 ACPI_PARSE_OBJECT *Op,
267 UINT32 name)
268 {
269
270 /* The "generic" object has no name associated with it */
271
272 if (Op->Common.Flags & ACPI_PARSEOP_GENERIC)
273 {
274 return;
275 }
276
277 Op->Named.Name = name;
278 }
|