1271440SjkimNoEcho('
2271440Sjkim/******************************************************************************
3271440Sjkim *
4271440Sjkim * Module Name: aslsupport.y - Bison/Yacc C support functions
5271440Sjkim *
6271440Sjkim *****************************************************************************/
7271440Sjkim
8271440Sjkim/*
9306536Sjkim * Copyright (C) 2000 - 2016, Intel Corp.
10271440Sjkim * All rights reserved.
11271440Sjkim *
12271440Sjkim * Redistribution and use in source and binary forms, with or without
13271440Sjkim * modification, are permitted provided that the following conditions
14271440Sjkim * are met:
15271440Sjkim * 1. Redistributions of source code must retain the above copyright
16271440Sjkim *    notice, this list of conditions, and the following disclaimer,
17271440Sjkim *    without modification.
18271440Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19271440Sjkim *    substantially similar to the "NO WARRANTY" disclaimer below
20271440Sjkim *    ("Disclaimer") and any redistribution must be conditioned upon
21271440Sjkim *    including a substantially similar Disclaimer requirement for further
22271440Sjkim *    binary redistribution.
23271440Sjkim * 3. Neither the names of the above-listed copyright holders nor the names
24271440Sjkim *    of any contributors may be used to endorse or promote products derived
25271440Sjkim *    from this software without specific prior written permission.
26271440Sjkim *
27271440Sjkim * Alternatively, this software may be distributed under the terms of the
28271440Sjkim * GNU General Public License ("GPL") version 2 as published by the Free
29271440Sjkim * Software Foundation.
30271440Sjkim *
31271440Sjkim * NO WARRANTY
32271440Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33271440Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34271440Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35271440Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36271440Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37271440Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38271440Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39271440Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40271440Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41271440Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42271440Sjkim * POSSIBILITY OF SUCH DAMAGES.
43271440Sjkim */
44271440Sjkim
45271440Sjkim')
46271440Sjkim
47271440Sjkim/******************************************************************************
48271440Sjkim *
49271440Sjkim * Local support functions
50271440Sjkim *
51271440Sjkim *****************************************************************************/
52271440Sjkim
53271440Sjkim/*! [Begin] no source code translation */
54271440Sjkimint
55271440SjkimAslCompilerwrap(void)
56271440Sjkim{
57271440Sjkim  return (1);
58271440Sjkim}
59271440Sjkim/*! [End] no source code translation !*/
60271440Sjkim
61271440Sjkim
62271440Sjkimvoid *
63272444SjkimAslLocalAllocate (
64272444Sjkim    unsigned int        Size)
65271440Sjkim{
66271440Sjkim    void                *Mem;
67271440Sjkim
68271440Sjkim
69272444Sjkim    DbgPrint (ASL_PARSE_OUTPUT,
70272444Sjkim        "\nAslLocalAllocate: Expanding Stack to %u\n\n", Size);
71271440Sjkim
72272444Sjkim    Mem = ACPI_ALLOCATE_ZEROED (Size);
73271440Sjkim    if (!Mem)
74271440Sjkim    {
75271440Sjkim        AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
76272444Sjkim            Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
77272444Sjkim            Gbl_InputByteCount, Gbl_CurrentColumn,
78272444Sjkim            Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
79271440Sjkim        exit (1);
80271440Sjkim    }
81271440Sjkim
82271440Sjkim    return (Mem);
83271440Sjkim}
84271440Sjkim
85271440SjkimACPI_PARSE_OBJECT *
86272444SjkimAslDoError (
87272444Sjkim    void)
88271440Sjkim{
89271440Sjkim
90271440Sjkim    return (TrCreateLeafNode (PARSEOP_ERRORNODE));
91271440Sjkim}
92271440Sjkim
93271440Sjkim
94271440Sjkim/*******************************************************************************
95271440Sjkim *
96271440Sjkim * FUNCTION:    UtGetOpName
97271440Sjkim *
98271440Sjkim * PARAMETERS:  ParseOpcode         - Parser keyword ID
99271440Sjkim *
100271440Sjkim * RETURN:      Pointer to the opcode name
101271440Sjkim *
102271440Sjkim * DESCRIPTION: Get the ascii name of the parse opcode
103271440Sjkim *
104271440Sjkim ******************************************************************************/
105271440Sjkim
106271440Sjkimchar *
107271440SjkimUtGetOpName (
108271440Sjkim    UINT32                  ParseOpcode)
109271440Sjkim{
110271440Sjkim#ifdef ASL_YYTNAME_START
111271440Sjkim    /*
112271440Sjkim     * First entries (ASL_YYTNAME_START) in yytname are special reserved names.
113271440Sjkim     * Ignore first 8 characters of the name
114271440Sjkim     */
115271440Sjkim    return ((char *) yytname
116271440Sjkim        [(ParseOpcode - ASL_FIRST_PARSE_OPCODE) + ASL_YYTNAME_START] + 8);
117271440Sjkim#else
118271440Sjkim    return ("[Unknown parser generator]");
119271440Sjkim#endif
120271440Sjkim}
121