Home | History | Annotate | Line # | Download | only in compiler
aslsupport.y revision 1.1.1.4
      1      1.1  christos NoEcho('
      2      1.1  christos /******************************************************************************
      3      1.1  christos  *
      4      1.1  christos  * Module Name: aslsupport.y - Bison/Yacc C support functions
      5      1.1  christos  *
      6      1.1  christos  *****************************************************************************/
      7      1.1  christos 
      8      1.1  christos /*
      9  1.1.1.4  christos  * Copyright (C) 2000 - 2017, Intel Corp.
     10      1.1  christos  * All rights reserved.
     11      1.1  christos  *
     12      1.1  christos  * Redistribution and use in source and binary forms, with or without
     13      1.1  christos  * modification, are permitted provided that the following conditions
     14      1.1  christos  * are met:
     15      1.1  christos  * 1. Redistributions of source code must retain the above copyright
     16      1.1  christos  *    notice, this list of conditions, and the following disclaimer,
     17      1.1  christos  *    without modification.
     18      1.1  christos  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     19      1.1  christos  *    substantially similar to the "NO WARRANTY" disclaimer below
     20      1.1  christos  *    ("Disclaimer") and any redistribution must be conditioned upon
     21      1.1  christos  *    including a substantially similar Disclaimer requirement for further
     22      1.1  christos  *    binary redistribution.
     23      1.1  christos  * 3. Neither the names of the above-listed copyright holders nor the names
     24      1.1  christos  *    of any contributors may be used to endorse or promote products derived
     25      1.1  christos  *    from this software without specific prior written permission.
     26      1.1  christos  *
     27      1.1  christos  * Alternatively, this software may be distributed under the terms of the
     28      1.1  christos  * GNU General Public License ("GPL") version 2 as published by the Free
     29      1.1  christos  * Software Foundation.
     30      1.1  christos  *
     31      1.1  christos  * NO WARRANTY
     32      1.1  christos  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     33      1.1  christos  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     34      1.1  christos  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     35      1.1  christos  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     36      1.1  christos  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     37      1.1  christos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     38      1.1  christos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     39      1.1  christos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     40      1.1  christos  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     41      1.1  christos  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     42      1.1  christos  * POSSIBILITY OF SUCH DAMAGES.
     43      1.1  christos  */
     44      1.1  christos 
     45      1.1  christos ')
     46      1.1  christos 
     47      1.1  christos /******************************************************************************
     48      1.1  christos  *
     49      1.1  christos  * Local support functions
     50      1.1  christos  *
     51      1.1  christos  *****************************************************************************/
     52      1.1  christos 
     53      1.1  christos /*! [Begin] no source code translation */
     54      1.1  christos int
     55      1.1  christos AslCompilerwrap(void)
     56      1.1  christos {
     57      1.1  christos   return (1);
     58      1.1  christos }
     59      1.1  christos /*! [End] no source code translation !*/
     60      1.1  christos 
     61      1.1  christos 
     62      1.1  christos void *
     63      1.1  christos AslLocalAllocate (
     64      1.1  christos     unsigned int        Size)
     65      1.1  christos {
     66      1.1  christos     void                *Mem;
     67      1.1  christos 
     68      1.1  christos 
     69      1.1  christos     DbgPrint (ASL_PARSE_OUTPUT,
     70      1.1  christos         "\nAslLocalAllocate: Expanding Stack to %u\n\n", Size);
     71      1.1  christos 
     72      1.1  christos     Mem = ACPI_ALLOCATE_ZEROED (Size);
     73      1.1  christos     if (!Mem)
     74      1.1  christos     {
     75      1.1  christos         AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
     76      1.1  christos             Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
     77      1.1  christos             Gbl_InputByteCount, Gbl_CurrentColumn,
     78      1.1  christos             Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
     79      1.1  christos         exit (1);
     80      1.1  christos     }
     81      1.1  christos 
     82      1.1  christos     return (Mem);
     83      1.1  christos }
     84      1.1  christos 
     85      1.1  christos ACPI_PARSE_OBJECT *
     86      1.1  christos AslDoError (
     87      1.1  christos     void)
     88      1.1  christos {
     89      1.1  christos 
     90      1.1  christos     return (TrCreateLeafNode (PARSEOP_ERRORNODE));
     91      1.1  christos }
     92      1.1  christos 
     93      1.1  christos 
     94      1.1  christos /*******************************************************************************
     95      1.1  christos  *
     96      1.1  christos  * FUNCTION:    UtGetOpName
     97      1.1  christos  *
     98      1.1  christos  * PARAMETERS:  ParseOpcode         - Parser keyword ID
     99      1.1  christos  *
    100      1.1  christos  * RETURN:      Pointer to the opcode name
    101      1.1  christos  *
    102      1.1  christos  * DESCRIPTION: Get the ascii name of the parse opcode
    103      1.1  christos  *
    104      1.1  christos  ******************************************************************************/
    105      1.1  christos 
    106      1.1  christos char *
    107      1.1  christos UtGetOpName (
    108      1.1  christos     UINT32                  ParseOpcode)
    109      1.1  christos {
    110      1.1  christos #ifdef ASL_YYTNAME_START
    111      1.1  christos     /*
    112      1.1  christos      * First entries (ASL_YYTNAME_START) in yytname are special reserved names.
    113      1.1  christos      * Ignore first 8 characters of the name
    114      1.1  christos      */
    115      1.1  christos     return ((char *) yytname
    116      1.1  christos         [(ParseOpcode - ASL_FIRST_PARSE_OPCODE) + ASL_YYTNAME_START] + 8);
    117      1.1  christos #else
    118      1.1  christos     return ("[Unknown parser generator]");
    119      1.1  christos #endif
    120      1.1  christos }
    121