1c2c66affSColin Finck /******************************************************************************
2c2c66affSColin Finck  *
3c2c66affSColin Finck  * Module Name: acapps - common include for ACPI applications/tools
4c2c66affSColin Finck  *
5c2c66affSColin Finck  *****************************************************************************/
6c2c66affSColin Finck 
7c2c66affSColin Finck /*
8*03b24380SThomas Faber  * Copyright (C) 2000 - 2022, Intel Corp.
9c2c66affSColin Finck  * All rights reserved.
10c2c66affSColin Finck  *
11c2c66affSColin Finck  * Redistribution and use in source and binary forms, with or without
12c2c66affSColin Finck  * modification, are permitted provided that the following conditions
13c2c66affSColin Finck  * are met:
14c2c66affSColin Finck  * 1. Redistributions of source code must retain the above copyright
15c2c66affSColin Finck  *    notice, this list of conditions, and the following disclaimer,
16c2c66affSColin Finck  *    without modification.
17c2c66affSColin Finck  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18c2c66affSColin Finck  *    substantially similar to the "NO WARRANTY" disclaimer below
19c2c66affSColin Finck  *    ("Disclaimer") and any redistribution must be conditioned upon
20c2c66affSColin Finck  *    including a substantially similar Disclaimer requirement for further
21c2c66affSColin Finck  *    binary redistribution.
22c2c66affSColin Finck  * 3. Neither the names of the above-listed copyright holders nor the names
23c2c66affSColin Finck  *    of any contributors may be used to endorse or promote products derived
24c2c66affSColin Finck  *    from this software without specific prior written permission.
25c2c66affSColin Finck  *
26c2c66affSColin Finck  * Alternatively, this software may be distributed under the terms of the
27c2c66affSColin Finck  * GNU General Public License ("GPL") version 2 as published by the Free
28c2c66affSColin Finck  * Software Foundation.
29c2c66affSColin Finck  *
30c2c66affSColin Finck  * NO WARRANTY
31c2c66affSColin Finck  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32c2c66affSColin Finck  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
336eb8cc49SThomas Faber  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34c2c66affSColin Finck  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35c2c66affSColin Finck  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36c2c66affSColin Finck  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37c2c66affSColin Finck  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38c2c66affSColin Finck  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39c2c66affSColin Finck  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40c2c66affSColin Finck  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41c2c66affSColin Finck  * POSSIBILITY OF SUCH DAMAGES.
42c2c66affSColin Finck  */
43c2c66affSColin Finck 
44c2c66affSColin Finck #ifndef _ACCONVERT
45c2c66affSColin Finck #define _ACCONVERT
46c2c66affSColin Finck 
47c2c66affSColin Finck /* Definitions for comment state */
48c2c66affSColin Finck 
49c2c66affSColin Finck #define ASL_COMMENT_STANDARD    1
50c2c66affSColin Finck #define ASLCOMMENT_INLINE       2
51c2c66affSColin Finck #define ASL_COMMENT_OPEN_PAREN  3
52c2c66affSColin Finck #define ASL_COMMENT_CLOSE_PAREN 4
53c2c66affSColin Finck #define ASL_COMMENT_CLOSE_BRACE 5
54c2c66affSColin Finck 
55c2c66affSColin Finck /* Definitions for comment print function*/
56c2c66affSColin Finck 
57c2c66affSColin Finck #define AML_COMMENT_STANDARD    1
58c2c66affSColin Finck #define AMLCOMMENT_INLINE       2
59c2c66affSColin Finck #define AML_COMMENT_END_NODE    3
60c2c66affSColin Finck #define AML_NAMECOMMENT         4
61c2c66affSColin Finck #define AML_COMMENT_CLOSE_BRACE 5
62c2c66affSColin Finck #define AML_COMMENT_ENDBLK      6
63c2c66affSColin Finck #define AML_COMMENT_INCLUDE     7
64c2c66affSColin Finck 
65c2c66affSColin Finck 
66c2c66affSColin Finck #ifdef ACPI_ASL_COMPILER
67c2c66affSColin Finck /*
68c2c66affSColin Finck  * cvcompiler
69c2c66affSColin Finck  */
70c2c66affSColin Finck void
71c2c66affSColin Finck CvProcessComment (
72c2c66affSColin Finck     ASL_COMMENT_STATE       CurrentState,
73c2c66affSColin Finck     char                    *StringBuffer,
74c2c66affSColin Finck     int                     c1);
75c2c66affSColin Finck 
76c2c66affSColin Finck void
77c2c66affSColin Finck CvProcessCommentType2 (
78c2c66affSColin Finck     ASL_COMMENT_STATE       CurrentState,
79c2c66affSColin Finck     char                    *StringBuffer);
80c2c66affSColin Finck 
81c2c66affSColin Finck UINT32
82c2c66affSColin Finck CvCalculateCommentLengths(
83c2c66affSColin Finck    ACPI_PARSE_OBJECT        *Op);
84c2c66affSColin Finck 
85c2c66affSColin Finck void
86c2c66affSColin Finck CvProcessCommentState (
87c2c66affSColin Finck     char                    input);
88c2c66affSColin Finck 
89c2c66affSColin Finck char*
90c2c66affSColin Finck CvAppendInlineComment (
91c2c66affSColin Finck     char                    *InlineComment,
92c2c66affSColin Finck     char                    *ToAdd);
93c2c66affSColin Finck 
94c2c66affSColin Finck void
95c2c66affSColin Finck CvAddToCommentList (
96c2c66affSColin Finck     char*                   ToAdd);
97c2c66affSColin Finck 
98c2c66affSColin Finck void
99c2c66affSColin Finck CvPlaceComment (
100c2c66affSColin Finck     UINT8                   Type,
101c2c66affSColin Finck     char                    *CommentString);
102c2c66affSColin Finck 
103c2c66affSColin Finck UINT32
104c2c66affSColin Finck CvParseOpBlockType (
105c2c66affSColin Finck     ACPI_PARSE_OBJECT       *Op);
106c2c66affSColin Finck 
107c2c66affSColin Finck ACPI_COMMENT_NODE*
108c2c66affSColin Finck CvCommentNodeCalloc (
109c2c66affSColin Finck     void);
110c2c66affSColin Finck 
111c2c66affSColin Finck void
112c2c66affSColin Finck CgWriteAmlDefBlockComment (
113c2c66affSColin Finck     ACPI_PARSE_OBJECT       *Op);
114c2c66affSColin Finck 
115c2c66affSColin Finck void
116c2c66affSColin Finck CgWriteOneAmlComment (
117c2c66affSColin Finck     ACPI_PARSE_OBJECT       *Op,
118c2c66affSColin Finck     char*                   CommentToPrint,
119c2c66affSColin Finck     UINT8                   InputOption);
120c2c66affSColin Finck 
121c2c66affSColin Finck void
122c2c66affSColin Finck CgWriteAmlComment (
123c2c66affSColin Finck     ACPI_PARSE_OBJECT       *Op);
124c2c66affSColin Finck 
125c2c66affSColin Finck 
126c2c66affSColin Finck /*
127c2c66affSColin Finck  * cvparser
128c2c66affSColin Finck  */
129c2c66affSColin Finck void
130c2c66affSColin Finck CvInitFileTree (
131c2c66affSColin Finck     ACPI_TABLE_HEADER       *Table,
132696cdc63SThomas Faber     FILE                    *RootFile);
133c2c66affSColin Finck 
134c2c66affSColin Finck void
135c2c66affSColin Finck CvClearOpComments (
136c2c66affSColin Finck     ACPI_PARSE_OBJECT       *Op);
137c2c66affSColin Finck 
138c2c66affSColin Finck ACPI_FILE_NODE*
139c2c66affSColin Finck CvFilenameExists (
140c2c66affSColin Finck     char                    *Filename,
141c2c66affSColin Finck     ACPI_FILE_NODE           *Head);
142c2c66affSColin Finck 
143c2c66affSColin Finck void
144c2c66affSColin Finck CvLabelFileNode (
145c2c66affSColin Finck     ACPI_PARSE_OBJECT       *Op);
146c2c66affSColin Finck 
147c2c66affSColin Finck void
148c2c66affSColin Finck CvCaptureListComments (
149c2c66affSColin Finck     ACPI_PARSE_STATE        *ParserState,
150c2c66affSColin Finck     ACPI_COMMENT_NODE       *ListHead,
151c2c66affSColin Finck     ACPI_COMMENT_NODE       *ListTail);
152c2c66affSColin Finck 
153c2c66affSColin Finck void
154c2c66affSColin Finck CvCaptureCommentsOnly (
155c2c66affSColin Finck     ACPI_PARSE_STATE        *ParserState);
156c2c66affSColin Finck 
157c2c66affSColin Finck void
158c2c66affSColin Finck CvCaptureComments (
159c2c66affSColin Finck     ACPI_WALK_STATE         *WalkState);
160c2c66affSColin Finck 
161c2c66affSColin Finck void
162c2c66affSColin Finck CvTransferComments (
163c2c66affSColin Finck     ACPI_PARSE_OBJECT       *Op);
164c2c66affSColin Finck 
165c2c66affSColin Finck /*
166c2c66affSColin Finck  * cvdisasm
167c2c66affSColin Finck  */
168c2c66affSColin Finck void
169c2c66affSColin Finck CvSwitchFiles (
170c2c66affSColin Finck     UINT32                  level,
171c2c66affSColin Finck     ACPI_PARSE_OBJECT       *op);
172c2c66affSColin Finck 
173c2c66affSColin Finck BOOLEAN
174c2c66affSColin Finck CvFileHasSwitched (
175c2c66affSColin Finck     ACPI_PARSE_OBJECT       *Op);
176c2c66affSColin Finck 
177c2c66affSColin Finck 
178c2c66affSColin Finck void
179c2c66affSColin Finck CvCloseParenWriteComment (
180c2c66affSColin Finck     ACPI_PARSE_OBJECT       *Op,
181c2c66affSColin Finck     UINT32                  Level);
182c2c66affSColin Finck 
183c2c66affSColin Finck void
184c2c66affSColin Finck CvCloseBraceWriteComment (
185c2c66affSColin Finck     ACPI_PARSE_OBJECT       *Op,
186c2c66affSColin Finck     UINT32                  Level);
187c2c66affSColin Finck 
188c2c66affSColin Finck void
189c2c66affSColin Finck CvPrintOneCommentList (
190c2c66affSColin Finck     ACPI_COMMENT_NODE       *CommentList,
191c2c66affSColin Finck     UINT32                  Level);
192c2c66affSColin Finck 
193c2c66affSColin Finck void
194c2c66affSColin Finck CvPrintOneCommentType (
195c2c66affSColin Finck     ACPI_PARSE_OBJECT       *Op,
196c2c66affSColin Finck     UINT8                   CommentType,
197c2c66affSColin Finck     char*                   EndStr,
198c2c66affSColin Finck     UINT32                  Level);
199c2c66affSColin Finck 
200c2c66affSColin Finck 
201c2c66affSColin Finck #endif
202c2c66affSColin Finck 
203c2c66affSColin Finck #endif /* _ACCONVERT */
204