Home | History | Annotate | Line # | Download | only in utilities
utclib.c revision 1.1.1.9
      1 /******************************************************************************
      2  *
      3  * Module Name: utclib - ACPICA implementations of C library functions
      4  *
      5  *****************************************************************************/
      6 
      7 /*
      8  * Copyright (C) 2000 - 2017, 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 
     44 #define ACPI_CLIBRARY
     45 #include "acpi.h"
     46 #include "accommon.h"
     47 
     48 /*
     49  * This module contains implementations of the standard C library functions
     50  * that are required by the ACPICA code at both application level and kernel
     51  * level.
     52  *
     53  * The module is an optional feature that can be used if a local/system
     54  * C library is not available. Some operating system kernels may not have
     55  * an internal C library.
     56  *
     57  * In general, these functions are less efficient than an inline or assembly
     58  * code implementation.
     59  *
     60  * These C functions and the associated prototypes are enabled by default
     61  * unless the ACPI_USE_SYSTEM_CLIBRARY symbol is defined. This is usually
     62  * automatically defined for the ACPICA applications such as iASL and
     63  * AcpiExec, so that these user-level applications use the local C library
     64  * instead of the functions in this module.
     65  */
     66 
     67 /*******************************************************************************
     68  *
     69  * Functions implemented in this module:
     70  *
     71  * FUNCTION:    memcmp
     72  * FUNCTION:    memcpy
     73  * FUNCTION:    memset
     74  * FUNCTION:    strlen
     75  * FUNCTION:    strcpy
     76  * FUNCTION:    strncpy
     77  * FUNCTION:    strcmp
     78  * FUNCTION:    strchr
     79  * FUNCTION:    strncmp
     80  * FUNCTION:    strcat
     81  * FUNCTION:    strncat
     82  * FUNCTION:    strstr
     83  * FUNCTION:    strtoul
     84  * FUNCTION:    toupper
     85  * FUNCTION:    tolower
     86  * FUNCTION:    is* functions
     87  *
     88  ******************************************************************************/
     89 
     90 #define _COMPONENT          ACPI_UTILITIES
     91         ACPI_MODULE_NAME    ("utclib")
     92 
     93 
     94 #ifndef ACPI_USE_SYSTEM_CLIBRARY    /* Entire module */
     95 
     96 
     97 /*******************************************************************************
     98  *
     99  * FUNCTION:    memcmp
    100  *
    101  * PARAMETERS:  Buffer1         - First Buffer
    102  *              Buffer2         - Second Buffer
    103  *              Count           - Maximum # of bytes to compare
    104  *
    105  * RETURN:      Index where Buffers mismatched, or 0 if Buffers matched
    106  *
    107  * DESCRIPTION: Compare two Buffers, with a maximum length
    108  *
    109  ******************************************************************************/
    110 
    111 int
    112 memcmp (
    113     void                    *VBuffer1,
    114     void                    *VBuffer2,
    115     ACPI_SIZE               Count)
    116 {
    117     char                    *Buffer1 = (char *) VBuffer1;
    118     char                    *Buffer2 = (char *) VBuffer2;
    119 
    120 
    121     for ( ; Count-- && (*Buffer1 == *Buffer2); Buffer1++, Buffer2++)
    122     {
    123     }
    124 
    125     return ((Count == ACPI_SIZE_MAX) ? 0 : ((unsigned char) *Buffer1 -
    126         (unsigned char) *Buffer2));
    127 }
    128 
    129 
    130 /*******************************************************************************
    131  *
    132  * FUNCTION:    memmove
    133  *
    134  * PARAMETERS:  Dest        - Target of the copy
    135  *              Src         - Source buffer to copy
    136  *              Count       - Number of bytes to copy
    137  *
    138  * RETURN:      Dest
    139  *
    140  * DESCRIPTION: Copy arbitrary bytes of memory with respect to the overlapping
    141  *
    142  ******************************************************************************/
    143 
    144 void *
    145 memmove (
    146     void                    *Dest,
    147     const void              *Src,
    148     ACPI_SIZE               Count)
    149 {
    150     char                    *New = (char *) Dest;
    151     char                    *Old = (char *) Src;
    152 
    153 
    154     if (Old > New)
    155     {
    156         /* Copy from the beginning */
    157 
    158         while (Count)
    159         {
    160             *New = *Old;
    161             New++;
    162             Old++;
    163             Count--;
    164         }
    165     }
    166     else if (Old < New)
    167     {
    168         /* Copy from the end */
    169 
    170         New = New + Count - 1;
    171         Old = Old + Count - 1;
    172         while (Count)
    173         {
    174             *New = *Old;
    175             New--;
    176             Old--;
    177             Count--;
    178         }
    179     }
    180 
    181     return (Dest);
    182 }
    183 
    184 
    185 /*******************************************************************************
    186  *
    187  * FUNCTION:    memcpy
    188  *
    189  * PARAMETERS:  Dest        - Target of the copy
    190  *              Src         - Source buffer to copy
    191  *              Count       - Number of bytes to copy
    192  *
    193  * RETURN:      Dest
    194  *
    195  * DESCRIPTION: Copy arbitrary bytes of memory
    196  *
    197  ******************************************************************************/
    198 
    199 void *
    200 memcpy (
    201     void                    *Dest,
    202     const void              *Src,
    203     ACPI_SIZE               Count)
    204 {
    205     char                    *New = (char *) Dest;
    206     char                    *Old = (char *) Src;
    207 
    208 
    209     while (Count)
    210     {
    211         *New = *Old;
    212         New++;
    213         Old++;
    214         Count--;
    215     }
    216 
    217     return (Dest);
    218 }
    219 
    220 
    221 /*******************************************************************************
    222  *
    223  * FUNCTION:    memset
    224  *
    225  * PARAMETERS:  Dest        - Buffer to set
    226  *              Value       - Value to set each byte of memory
    227  *              Count       - Number of bytes to set
    228  *
    229  * RETURN:      Dest
    230  *
    231  * DESCRIPTION: Initialize a buffer to a known value.
    232  *
    233  ******************************************************************************/
    234 
    235 void *
    236 memset (
    237     void                    *Dest,
    238     int                     Value,
    239     ACPI_SIZE               Count)
    240 {
    241     char                    *New = (char *) Dest;
    242 
    243 
    244     while (Count)
    245     {
    246         *New = (char) Value;
    247         New++;
    248         Count--;
    249     }
    250 
    251     return (Dest);
    252 }
    253 
    254 
    255 /*******************************************************************************
    256  *
    257  * FUNCTION:    strlen
    258  *
    259  * PARAMETERS:  String              - Null terminated string
    260  *
    261  * RETURN:      Length
    262  *
    263  * DESCRIPTION: Returns the length of the input string
    264  *
    265  ******************************************************************************/
    266 
    267 
    268 ACPI_SIZE
    269 strlen (
    270     const char              *String)
    271 {
    272     UINT32                  Length = 0;
    273 
    274 
    275     /* Count the string until a null is encountered */
    276 
    277     while (*String)
    278     {
    279         Length++;
    280         String++;
    281     }
    282 
    283     return (Length);
    284 }
    285 
    286 
    287 /*******************************************************************************
    288  *
    289  * FUNCTION:    strpbrk
    290  *
    291  * PARAMETERS:  String              - Null terminated string
    292  *              Delimiters          - Delimiters to match
    293  *
    294  * RETURN:      The first occurance in the string of any of the bytes in the
    295  *              delimiters
    296  *
    297  * DESCRIPTION: Search a string for any of a set of the delimiters
    298  *
    299  ******************************************************************************/
    300 
    301 char *
    302 strpbrk (
    303     const char              *String,
    304     const char              *Delimiters)
    305 {
    306     const char              *Delimiter;
    307 
    308 
    309     for ( ; *String != '\0'; ++String)
    310     {
    311         for (Delimiter = Delimiters; *Delimiter != '\0'; Delimiter++)
    312         {
    313             if (*String == *Delimiter)
    314             {
    315                 return (ACPI_CAST_PTR (char, String));
    316             }
    317         }
    318     }
    319 
    320     return (NULL);
    321 }
    322 
    323 
    324 /*******************************************************************************
    325  *
    326  * FUNCTION:    strtok
    327  *
    328  * PARAMETERS:  String              - Null terminated string
    329  *              Delimiters          - Delimiters to match
    330  *
    331  * RETURN:      Pointer to the next token
    332  *
    333  * DESCRIPTION: Split string into tokens
    334  *
    335  ******************************************************************************/
    336 
    337 char*
    338 strtok (
    339     char                    *String,
    340     const char              *Delimiters)
    341 {
    342     char                    *Begin = String;
    343     static char             *SavedPtr;
    344 
    345 
    346     if (Begin == NULL)
    347     {
    348         if (SavedPtr == NULL)
    349         {
    350             return (NULL);
    351         }
    352         Begin = SavedPtr;
    353     }
    354 
    355     SavedPtr = strpbrk (Begin, Delimiters);
    356     while (SavedPtr == Begin)
    357     {
    358         *Begin++ = '\0';
    359         SavedPtr = strpbrk (Begin, Delimiters);
    360     }
    361 
    362     if (SavedPtr)
    363     {
    364         *SavedPtr++ = '\0';
    365         return (Begin);
    366     }
    367     else
    368     {
    369         return (NULL);
    370     }
    371 }
    372 
    373 
    374 /*******************************************************************************
    375  *
    376  * FUNCTION:    strcpy
    377  *
    378  * PARAMETERS:  DstString       - Target of the copy
    379  *              SrcString       - The source string to copy
    380  *
    381  * RETURN:      DstString
    382  *
    383  * DESCRIPTION: Copy a null terminated string
    384  *
    385  ******************************************************************************/
    386 
    387 char *
    388 strcpy (
    389     char                    *DstString,
    390     const char              *SrcString)
    391 {
    392     char                    *String = DstString;
    393 
    394 
    395     /* Move bytes brute force */
    396 
    397     while (*SrcString)
    398     {
    399         *String = *SrcString;
    400 
    401         String++;
    402         SrcString++;
    403     }
    404 
    405     /* Null terminate */
    406 
    407     *String = 0;
    408     return (DstString);
    409 }
    410 
    411 
    412 /*******************************************************************************
    413  *
    414  * FUNCTION:    strncpy
    415  *
    416  * PARAMETERS:  DstString       - Target of the copy
    417  *              SrcString       - The source string to copy
    418  *              Count           - Maximum # of bytes to copy
    419  *
    420  * RETURN:      DstString
    421  *
    422  * DESCRIPTION: Copy a null terminated string, with a maximum length
    423  *
    424  ******************************************************************************/
    425 
    426 char *
    427 strncpy (
    428     char                    *DstString,
    429     const char              *SrcString,
    430     ACPI_SIZE               Count)
    431 {
    432     char                    *String = DstString;
    433 
    434 
    435     /* Copy the string */
    436 
    437     for (String = DstString;
    438         Count && (Count--, (*String++ = *SrcString++)); )
    439     {;}
    440 
    441     /* Pad with nulls if necessary */
    442 
    443     while (Count--)
    444     {
    445         *String = 0;
    446         String++;
    447     }
    448 
    449     /* Return original pointer */
    450 
    451     return (DstString);
    452 }
    453 
    454 
    455 /*******************************************************************************
    456  *
    457  * FUNCTION:    strcmp
    458  *
    459  * PARAMETERS:  String1         - First string
    460  *              String2         - Second string
    461  *
    462  * RETURN:      Index where strings mismatched, or 0 if strings matched
    463  *
    464  * DESCRIPTION: Compare two null terminated strings
    465  *
    466  ******************************************************************************/
    467 
    468 int
    469 strcmp (
    470     const char              *String1,
    471     const char              *String2)
    472 {
    473 
    474 
    475     for ( ; (*String1 == *String2); String2++)
    476     {
    477         if (!*String1++)
    478         {
    479             return (0);
    480         }
    481     }
    482 
    483     return ((unsigned char) *String1 - (unsigned char) *String2);
    484 }
    485 
    486 
    487 /*******************************************************************************
    488  *
    489  * FUNCTION:    strchr
    490  *
    491  * PARAMETERS:  String          - Search string
    492  *              ch              - character to search for
    493  *
    494  * RETURN:      Ptr to char or NULL if not found
    495  *
    496  * DESCRIPTION: Search a string for a character
    497  *
    498  ******************************************************************************/
    499 
    500 char *
    501 strchr (
    502     const char              *String,
    503     int                     ch)
    504 {
    505 
    506 
    507     for ( ; (*String); String++)
    508     {
    509         if ((*String) == (char) ch)
    510         {
    511             return ((char *) String);
    512         }
    513     }
    514 
    515     return (NULL);
    516 }
    517 
    518 
    519 /*******************************************************************************
    520  *
    521  * FUNCTION:    strncmp
    522  *
    523  * PARAMETERS:  String1         - First string
    524  *              String2         - Second string
    525  *              Count           - Maximum # of bytes to compare
    526  *
    527  * RETURN:      Index where strings mismatched, or 0 if strings matched
    528  *
    529  * DESCRIPTION: Compare two null terminated strings, with a maximum length
    530  *
    531  ******************************************************************************/
    532 
    533 int
    534 strncmp (
    535     const char              *String1,
    536     const char              *String2,
    537     ACPI_SIZE               Count)
    538 {
    539 
    540 
    541     for ( ; Count-- && (*String1 == *String2); String2++)
    542     {
    543         if (!*String1++)
    544         {
    545             return (0);
    546         }
    547     }
    548 
    549     return ((Count == ACPI_SIZE_MAX) ? 0 : ((unsigned char) *String1 -
    550         (unsigned char) *String2));
    551 }
    552 
    553 
    554 /*******************************************************************************
    555  *
    556  * FUNCTION:    strcat
    557  *
    558  * PARAMETERS:  DstString       - Target of the copy
    559  *              SrcString       - The source string to copy
    560  *
    561  * RETURN:      DstString
    562  *
    563  * DESCRIPTION: Append a null terminated string to a null terminated string
    564  *
    565  ******************************************************************************/
    566 
    567 char *
    568 strcat (
    569     char                    *DstString,
    570     const char              *SrcString)
    571 {
    572     char                    *String;
    573 
    574 
    575     /* Find end of the destination string */
    576 
    577     for (String = DstString; *String++; )
    578     { ; }
    579 
    580     /* Concatenate the string */
    581 
    582     for (--String; (*String++ = *SrcString++); )
    583     { ; }
    584 
    585     return (DstString);
    586 }
    587 
    588 
    589 /*******************************************************************************
    590  *
    591  * FUNCTION:    strncat
    592  *
    593  * PARAMETERS:  DstString       - Target of the copy
    594  *              SrcString       - The source string to copy
    595  *              Count           - Maximum # of bytes to copy
    596  *
    597  * RETURN:      DstString
    598  *
    599  * DESCRIPTION: Append a null terminated string to a null terminated string,
    600  *              with a maximum count.
    601  *
    602  ******************************************************************************/
    603 
    604 char *
    605 strncat (
    606     char                    *DstString,
    607     const char              *SrcString,
    608     ACPI_SIZE               Count)
    609 {
    610     char                    *String;
    611 
    612 
    613     if (Count)
    614     {
    615         /* Find end of the destination string */
    616 
    617         for (String = DstString; *String++; )
    618         { ; }
    619 
    620         /* Concatenate the string */
    621 
    622         for (--String; (*String++ = *SrcString++) && --Count; )
    623         { ; }
    624 
    625         /* Null terminate if necessary */
    626 
    627         if (!Count)
    628         {
    629             *String = 0;
    630         }
    631     }
    632 
    633     return (DstString);
    634 }
    635 
    636 
    637 /*******************************************************************************
    638  *
    639  * FUNCTION:    strstr
    640  *
    641  * PARAMETERS:  String1         - Target string
    642  *              String2         - Substring to search for
    643  *
    644  * RETURN:      Where substring match starts, Null if no match found
    645  *
    646  * DESCRIPTION: Checks if String2 occurs in String1. This is not really a
    647  *              full implementation of strstr, only sufficient for command
    648  *              matching
    649  *
    650  ******************************************************************************/
    651 
    652 char *
    653 strstr (
    654     char                    *String1,
    655     char                    *String2)
    656 {
    657     ACPI_SIZE               Length;
    658 
    659 
    660     Length = strlen (String2);
    661     if (!Length)
    662     {
    663         return (String1);
    664     }
    665 
    666     while (strlen (String1) >= Length)
    667     {
    668         if (memcmp (String1, String2, Length) == 0)
    669         {
    670             return (String1);
    671         }
    672         String1++;
    673     }
    674 
    675     return (NULL);
    676 }
    677 
    678 
    679 /*******************************************************************************
    680  *
    681  * FUNCTION:    strtoul
    682  *
    683  * PARAMETERS:  String          - Null terminated string
    684  *              Terminater      - Where a pointer to the terminating byte is
    685  *                                returned
    686  *              Base            - Radix of the string
    687  *
    688  * RETURN:      Converted value
    689  *
    690  * DESCRIPTION: Convert a string into a 32-bit unsigned value.
    691  *              Note: use strtoul64 for 64-bit integers.
    692  *
    693  ******************************************************************************/
    694 
    695 UINT32
    696 strtoul (
    697     const char              *String,
    698     char                    **Terminator,
    699     UINT32                  Base)
    700 {
    701     UINT32                  converted = 0;
    702     UINT32                  index;
    703     UINT32                  sign;
    704     const char              *StringStart;
    705     UINT32                  ReturnValue = 0;
    706     ACPI_STATUS             Status = AE_OK;
    707 
    708 
    709     /*
    710      * Save the value of the pointer to the buffer's first
    711      * character, save the current errno value, and then
    712      * skip over any white space in the buffer:
    713      */
    714     StringStart = String;
    715     while (isspace (*String) || *String == '\t')
    716     {
    717         ++String;
    718     }
    719 
    720     /*
    721      * The buffer may contain an optional plus or minus sign.
    722      * If it does, then skip over it but remember what is was:
    723      */
    724     if (*String == '-')
    725     {
    726         sign = ACPI_SIGN_NEGATIVE;
    727         ++String;
    728     }
    729     else if (*String == '+')
    730     {
    731         ++String;
    732         sign = ACPI_SIGN_POSITIVE;
    733     }
    734     else
    735     {
    736         sign = ACPI_SIGN_POSITIVE;
    737     }
    738 
    739     /*
    740      * If the input parameter Base is zero, then we need to
    741      * determine if it is octal, decimal, or hexadecimal:
    742      */
    743     if (Base == 0)
    744     {
    745         if (*String == '0')
    746         {
    747             if (tolower (*(++String)) == 'x')
    748             {
    749                 Base = 16;
    750                 ++String;
    751             }
    752             else
    753             {
    754                 Base = 8;
    755             }
    756         }
    757         else
    758         {
    759             Base = 10;
    760         }
    761     }
    762     else if (Base < 2 || Base > 36)
    763     {
    764         /*
    765          * The specified Base parameter is not in the domain of
    766          * this function:
    767          */
    768         goto done;
    769     }
    770 
    771     /*
    772      * For octal and hexadecimal bases, skip over the leading
    773      * 0 or 0x, if they are present.
    774      */
    775     if (Base == 8 && *String == '0')
    776     {
    777         String++;
    778     }
    779 
    780     if (Base == 16 &&
    781         *String == '0' &&
    782         tolower (*(++String)) == 'x')
    783     {
    784         String++;
    785     }
    786 
    787     /*
    788      * Main loop: convert the string to an unsigned long:
    789      */
    790     while (*String)
    791     {
    792         if (isdigit (*String))
    793         {
    794             index = (UINT32) ((UINT8) *String - '0');
    795         }
    796         else
    797         {
    798             index = (UINT32) toupper (*String);
    799             if (isupper (index))
    800             {
    801                 index = index - 'A' + 10;
    802             }
    803             else
    804             {
    805                 goto done;
    806             }
    807         }
    808 
    809         if (index >= Base)
    810         {
    811             goto done;
    812         }
    813 
    814         /*
    815          * Check to see if value is out of range:
    816          */
    817 
    818         if (ReturnValue > ((ACPI_UINT32_MAX - (UINT32) index) /
    819                             (UINT32) Base))
    820         {
    821             Status = AE_ERROR;
    822             ReturnValue = 0;           /* reset */
    823         }
    824         else
    825         {
    826             ReturnValue *= Base;
    827             ReturnValue += index;
    828             converted = 1;
    829         }
    830 
    831         ++String;
    832     }
    833 
    834 done:
    835     /*
    836      * If appropriate, update the caller's pointer to the next
    837      * unconverted character in the buffer.
    838      */
    839     if (Terminator)
    840     {
    841         if (converted == 0 && ReturnValue == 0 && String != NULL)
    842         {
    843             *Terminator = (char *) StringStart;
    844         }
    845         else
    846         {
    847             *Terminator = (char *) String;
    848         }
    849     }
    850 
    851     if (Status == AE_ERROR)
    852     {
    853         ReturnValue = ACPI_UINT32_MAX;
    854     }
    855 
    856     /*
    857      * If a minus sign was present, then "the conversion is negated":
    858      */
    859     if (sign == ACPI_SIGN_NEGATIVE)
    860     {
    861         ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1;
    862     }
    863 
    864     return (ReturnValue);
    865 }
    866 
    867 
    868 /*******************************************************************************
    869  *
    870  * FUNCTION:    toupper
    871  *
    872  * PARAMETERS:  c           - Character to convert
    873  *
    874  * RETURN:      Converted character as an int
    875  *
    876  * DESCRIPTION: Convert character to uppercase
    877  *
    878  ******************************************************************************/
    879 
    880 int
    881 toupper (
    882     int                     c)
    883 {
    884 
    885     return (islower(c) ? ((c)-0x20) : (c));
    886 }
    887 
    888 
    889 /*******************************************************************************
    890  *
    891  * FUNCTION:    tolower
    892  *
    893  * PARAMETERS:  c           - Character to convert
    894  *
    895  * RETURN:      Converted character as an int
    896  *
    897  * DESCRIPTION: Convert character to lowercase
    898  *
    899  ******************************************************************************/
    900 
    901 int
    902 tolower (
    903     int                     c)
    904 {
    905 
    906     return (isupper(c) ? ((c)+0x20) : (c));
    907 }
    908 
    909 
    910 /*******************************************************************************
    911  *
    912  * FUNCTION:    is* function array
    913  *
    914  * DESCRIPTION: is* functions use the ctype table below
    915  *
    916  ******************************************************************************/
    917 
    918 const UINT8 AcpiGbl_Ctypes[257] = {
    919     _ACPI_CN,            /* 0x00     0 NUL */
    920     _ACPI_CN,            /* 0x01     1 SOH */
    921     _ACPI_CN,            /* 0x02     2 STX */
    922     _ACPI_CN,            /* 0x03     3 ETX */
    923     _ACPI_CN,            /* 0x04     4 EOT */
    924     _ACPI_CN,            /* 0x05     5 ENQ */
    925     _ACPI_CN,            /* 0x06     6 ACK */
    926     _ACPI_CN,            /* 0x07     7 BEL */
    927     _ACPI_CN,            /* 0x08     8 BS  */
    928     _ACPI_CN|_ACPI_SP,   /* 0x09     9 TAB */
    929     _ACPI_CN|_ACPI_SP,   /* 0x0A    10 LF  */
    930     _ACPI_CN|_ACPI_SP,   /* 0x0B    11 VT  */
    931     _ACPI_CN|_ACPI_SP,   /* 0x0C    12 FF  */
    932     _ACPI_CN|_ACPI_SP,   /* 0x0D    13 CR  */
    933     _ACPI_CN,            /* 0x0E    14 SO  */
    934     _ACPI_CN,            /* 0x0F    15 SI  */
    935     _ACPI_CN,            /* 0x10    16 DLE */
    936     _ACPI_CN,            /* 0x11    17 DC1 */
    937     _ACPI_CN,            /* 0x12    18 DC2 */
    938     _ACPI_CN,            /* 0x13    19 DC3 */
    939     _ACPI_CN,            /* 0x14    20 DC4 */
    940     _ACPI_CN,            /* 0x15    21 NAK */
    941     _ACPI_CN,            /* 0x16    22 SYN */
    942     _ACPI_CN,            /* 0x17    23 ETB */
    943     _ACPI_CN,            /* 0x18    24 CAN */
    944     _ACPI_CN,            /* 0x19    25 EM  */
    945     _ACPI_CN,            /* 0x1A    26 SUB */
    946     _ACPI_CN,            /* 0x1B    27 ESC */
    947     _ACPI_CN,            /* 0x1C    28 FS  */
    948     _ACPI_CN,            /* 0x1D    29 GS  */
    949     _ACPI_CN,            /* 0x1E    30 RS  */
    950     _ACPI_CN,            /* 0x1F    31 US  */
    951     _ACPI_XS|_ACPI_SP,   /* 0x20    32 ' ' */
    952     _ACPI_PU,            /* 0x21    33 '!' */
    953     _ACPI_PU,            /* 0x22    34 '"' */
    954     _ACPI_PU,            /* 0x23    35 '#' */
    955     _ACPI_PU,            /* 0x24    36 '$' */
    956     _ACPI_PU,            /* 0x25    37 '%' */
    957     _ACPI_PU,            /* 0x26    38 '&' */
    958     _ACPI_PU,            /* 0x27    39 ''' */
    959     _ACPI_PU,            /* 0x28    40 '(' */
    960     _ACPI_PU,            /* 0x29    41 ')' */
    961     _ACPI_PU,            /* 0x2A    42 '*' */
    962     _ACPI_PU,            /* 0x2B    43 '+' */
    963     _ACPI_PU,            /* 0x2C    44 ',' */
    964     _ACPI_PU,            /* 0x2D    45 '-' */
    965     _ACPI_PU,            /* 0x2E    46 '.' */
    966     _ACPI_PU,            /* 0x2F    47 '/' */
    967     _ACPI_XD|_ACPI_DI,   /* 0x30    48 '0' */
    968     _ACPI_XD|_ACPI_DI,   /* 0x31    49 '1' */
    969     _ACPI_XD|_ACPI_DI,   /* 0x32    50 '2' */
    970     _ACPI_XD|_ACPI_DI,   /* 0x33    51 '3' */
    971     _ACPI_XD|_ACPI_DI,   /* 0x34    52 '4' */
    972     _ACPI_XD|_ACPI_DI,   /* 0x35    53 '5' */
    973     _ACPI_XD|_ACPI_DI,   /* 0x36    54 '6' */
    974     _ACPI_XD|_ACPI_DI,   /* 0x37    55 '7' */
    975     _ACPI_XD|_ACPI_DI,   /* 0x38    56 '8' */
    976     _ACPI_XD|_ACPI_DI,   /* 0x39    57 '9' */
    977     _ACPI_PU,            /* 0x3A    58 ':' */
    978     _ACPI_PU,            /* 0x3B    59 ';' */
    979     _ACPI_PU,            /* 0x3C    60 '<' */
    980     _ACPI_PU,            /* 0x3D    61 '=' */
    981     _ACPI_PU,            /* 0x3E    62 '>' */
    982     _ACPI_PU,            /* 0x3F    63 '?' */
    983     _ACPI_PU,            /* 0x40    64 '@' */
    984     _ACPI_XD|_ACPI_UP,   /* 0x41    65 'A' */
    985     _ACPI_XD|_ACPI_UP,   /* 0x42    66 'B' */
    986     _ACPI_XD|_ACPI_UP,   /* 0x43    67 'C' */
    987     _ACPI_XD|_ACPI_UP,   /* 0x44    68 'D' */
    988     _ACPI_XD|_ACPI_UP,   /* 0x45    69 'E' */
    989     _ACPI_XD|_ACPI_UP,   /* 0x46    70 'F' */
    990     _ACPI_UP,            /* 0x47    71 'G' */
    991     _ACPI_UP,            /* 0x48    72 'H' */
    992     _ACPI_UP,            /* 0x49    73 'I' */
    993     _ACPI_UP,            /* 0x4A    74 'J' */
    994     _ACPI_UP,            /* 0x4B    75 'K' */
    995     _ACPI_UP,            /* 0x4C    76 'L' */
    996     _ACPI_UP,            /* 0x4D    77 'M' */
    997     _ACPI_UP,            /* 0x4E    78 'N' */
    998     _ACPI_UP,            /* 0x4F    79 'O' */
    999     _ACPI_UP,            /* 0x50    80 'P' */
   1000     _ACPI_UP,            /* 0x51    81 'Q' */
   1001     _ACPI_UP,            /* 0x52    82 'R' */
   1002     _ACPI_UP,            /* 0x53    83 'S' */
   1003     _ACPI_UP,            /* 0x54    84 'T' */
   1004     _ACPI_UP,            /* 0x55    85 'U' */
   1005     _ACPI_UP,            /* 0x56    86 'V' */
   1006     _ACPI_UP,            /* 0x57    87 'W' */
   1007     _ACPI_UP,            /* 0x58    88 'X' */
   1008     _ACPI_UP,            /* 0x59    89 'Y' */
   1009     _ACPI_UP,            /* 0x5A    90 'Z' */
   1010     _ACPI_PU,            /* 0x5B    91 '[' */
   1011     _ACPI_PU,            /* 0x5C    92 '\' */
   1012     _ACPI_PU,            /* 0x5D    93 ']' */
   1013     _ACPI_PU,            /* 0x5E    94 '^' */
   1014     _ACPI_PU,            /* 0x5F    95 '_' */
   1015     _ACPI_PU,            /* 0x60    96 '`' */
   1016     _ACPI_XD|_ACPI_LO,   /* 0x61    97 'a' */
   1017     _ACPI_XD|_ACPI_LO,   /* 0x62    98 'b' */
   1018     _ACPI_XD|_ACPI_LO,   /* 0x63    99 'c' */
   1019     _ACPI_XD|_ACPI_LO,   /* 0x64   100 'd' */
   1020     _ACPI_XD|_ACPI_LO,   /* 0x65   101 'e' */
   1021     _ACPI_XD|_ACPI_LO,   /* 0x66   102 'f' */
   1022     _ACPI_LO,            /* 0x67   103 'g' */
   1023     _ACPI_LO,            /* 0x68   104 'h' */
   1024     _ACPI_LO,            /* 0x69   105 'i' */
   1025     _ACPI_LO,            /* 0x6A   106 'j' */
   1026     _ACPI_LO,            /* 0x6B   107 'k' */
   1027     _ACPI_LO,            /* 0x6C   108 'l' */
   1028     _ACPI_LO,            /* 0x6D   109 'm' */
   1029     _ACPI_LO,            /* 0x6E   110 'n' */
   1030     _ACPI_LO,            /* 0x6F   111 'o' */
   1031     _ACPI_LO,            /* 0x70   112 'p' */
   1032     _ACPI_LO,            /* 0x71   113 'q' */
   1033     _ACPI_LO,            /* 0x72   114 'r' */
   1034     _ACPI_LO,            /* 0x73   115 's' */
   1035     _ACPI_LO,            /* 0x74   116 't' */
   1036     _ACPI_LO,            /* 0x75   117 'u' */
   1037     _ACPI_LO,            /* 0x76   118 'v' */
   1038     _ACPI_LO,            /* 0x77   119 'w' */
   1039     _ACPI_LO,            /* 0x78   120 'x' */
   1040     _ACPI_LO,            /* 0x79   121 'y' */
   1041     _ACPI_LO,            /* 0x7A   122 'z' */
   1042     _ACPI_PU,            /* 0x7B   123 '{' */
   1043     _ACPI_PU,            /* 0x7C   124 '|' */
   1044     _ACPI_PU,            /* 0x7D   125 '}' */
   1045     _ACPI_PU,            /* 0x7E   126 '~' */
   1046     _ACPI_CN,            /* 0x7F   127 DEL */
   1047 
   1048     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0x80 to 0x8F    */
   1049     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0x90 to 0x9F    */
   1050     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xA0 to 0xAF    */
   1051     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xB0 to 0xBF    */
   1052     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xC0 to 0xCF    */
   1053     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xD0 to 0xDF    */
   1054     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xE0 to 0xEF    */
   1055     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xF0 to 0xFF    */
   1056     0                                 /* 0x100 */
   1057 };
   1058 
   1059 
   1060 #endif /* ACPI_USE_SYSTEM_CLIBRARY */
   1061