xref: /netbsd-src/sys/external/bsd/acpica/dist/include/acconvert.h (revision 046a29855e04359424fd074e8313af6b6be8cfb6)
1835858a6Schristos /******************************************************************************
2835858a6Schristos  *
3835858a6Schristos  * Module Name: acapps - common include for ACPI applications/tools
4835858a6Schristos  *
5835858a6Schristos  *****************************************************************************/
6835858a6Schristos 
7835858a6Schristos /*
8*046a2985Schristos  * Copyright (C) 2000 - 2023, Intel Corp.
9835858a6Schristos  * All rights reserved.
10835858a6Schristos  *
11835858a6Schristos  * Redistribution and use in source and binary forms, with or without
12835858a6Schristos  * modification, are permitted provided that the following conditions
13835858a6Schristos  * are met:
14835858a6Schristos  * 1. Redistributions of source code must retain the above copyright
15835858a6Schristos  *    notice, this list of conditions, and the following disclaimer,
16835858a6Schristos  *    without modification.
17835858a6Schristos  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18835858a6Schristos  *    substantially similar to the "NO WARRANTY" disclaimer below
19835858a6Schristos  *    ("Disclaimer") and any redistribution must be conditioned upon
20835858a6Schristos  *    including a substantially similar Disclaimer requirement for further
21835858a6Schristos  *    binary redistribution.
22835858a6Schristos  * 3. Neither the names of the above-listed copyright holders nor the names
23835858a6Schristos  *    of any contributors may be used to endorse or promote products derived
24835858a6Schristos  *    from this software without specific prior written permission.
25835858a6Schristos  *
26835858a6Schristos  * Alternatively, this software may be distributed under the terms of the
27835858a6Schristos  * GNU General Public License ("GPL") version 2 as published by the Free
28835858a6Schristos  * Software Foundation.
29835858a6Schristos  *
30835858a6Schristos  * NO WARRANTY
31835858a6Schristos  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32835858a6Schristos  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3346a330b4Schristos  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34835858a6Schristos  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35835858a6Schristos  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36835858a6Schristos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37835858a6Schristos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38835858a6Schristos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39835858a6Schristos  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40835858a6Schristos  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41835858a6Schristos  * POSSIBILITY OF SUCH DAMAGES.
42835858a6Schristos  */
43835858a6Schristos 
44835858a6Schristos #ifndef _ACCONVERT
45835858a6Schristos #define _ACCONVERT
46835858a6Schristos 
47835858a6Schristos /* Definitions for comment state */
48835858a6Schristos 
49835858a6Schristos #define ASL_COMMENT_STANDARD    1
50835858a6Schristos #define ASLCOMMENT_INLINE       2
51835858a6Schristos #define ASL_COMMENT_OPEN_PAREN  3
52835858a6Schristos #define ASL_COMMENT_CLOSE_PAREN 4
53835858a6Schristos #define ASL_COMMENT_CLOSE_BRACE 5
54835858a6Schristos 
55835858a6Schristos /* Definitions for comment print function*/
56835858a6Schristos 
57835858a6Schristos #define AML_COMMENT_STANDARD    1
58835858a6Schristos #define AMLCOMMENT_INLINE       2
59835858a6Schristos #define AML_COMMENT_END_NODE    3
60835858a6Schristos #define AML_NAMECOMMENT         4
61835858a6Schristos #define AML_COMMENT_CLOSE_BRACE 5
62835858a6Schristos #define AML_COMMENT_ENDBLK      6
63835858a6Schristos #define AML_COMMENT_INCLUDE     7
64835858a6Schristos 
65835858a6Schristos 
66835858a6Schristos #ifdef ACPI_ASL_COMPILER
67835858a6Schristos /*
68835858a6Schristos  * cvcompiler
69835858a6Schristos  */
70835858a6Schristos void
71835858a6Schristos CvProcessComment (
72835858a6Schristos     ASL_COMMENT_STATE       CurrentState,
73835858a6Schristos     char                    *StringBuffer,
74835858a6Schristos     int                     c1);
75835858a6Schristos 
76835858a6Schristos void
77835858a6Schristos CvProcessCommentType2 (
78835858a6Schristos     ASL_COMMENT_STATE       CurrentState,
79835858a6Schristos     char                    *StringBuffer);
80835858a6Schristos 
81835858a6Schristos UINT32
82835858a6Schristos CvCalculateCommentLengths(
83835858a6Schristos    ACPI_PARSE_OBJECT        *Op);
84835858a6Schristos 
85835858a6Schristos void
86835858a6Schristos CvProcessCommentState (
87835858a6Schristos     char                    input);
88835858a6Schristos 
89835858a6Schristos char*
90835858a6Schristos CvAppendInlineComment (
91835858a6Schristos     char                    *InlineComment,
92835858a6Schristos     char                    *ToAdd);
93835858a6Schristos 
94835858a6Schristos void
95835858a6Schristos CvAddToCommentList (
96835858a6Schristos     char*                   ToAdd);
97835858a6Schristos 
98835858a6Schristos void
99835858a6Schristos CvPlaceComment (
100835858a6Schristos     UINT8                   Type,
101835858a6Schristos     char                    *CommentString);
102835858a6Schristos 
103835858a6Schristos UINT32
104835858a6Schristos CvParseOpBlockType (
105835858a6Schristos     ACPI_PARSE_OBJECT       *Op);
106835858a6Schristos 
107835858a6Schristos ACPI_COMMENT_NODE*
108835858a6Schristos CvCommentNodeCalloc (
109835858a6Schristos     void);
110835858a6Schristos 
111835858a6Schristos void
112835858a6Schristos CgWriteAmlDefBlockComment (
113835858a6Schristos     ACPI_PARSE_OBJECT       *Op);
114835858a6Schristos 
115835858a6Schristos void
116835858a6Schristos CgWriteOneAmlComment (
117835858a6Schristos     ACPI_PARSE_OBJECT       *Op,
118835858a6Schristos     char*                   CommentToPrint,
119835858a6Schristos     UINT8                   InputOption);
120835858a6Schristos 
121835858a6Schristos void
122835858a6Schristos CgWriteAmlComment (
123835858a6Schristos     ACPI_PARSE_OBJECT       *Op);
124835858a6Schristos 
125835858a6Schristos 
126835858a6Schristos /*
127835858a6Schristos  * cvparser
128835858a6Schristos  */
129835858a6Schristos void
130835858a6Schristos CvInitFileTree (
131835858a6Schristos     ACPI_TABLE_HEADER       *Table,
1323fd31de5Schristos     FILE                    *RootFile);
133835858a6Schristos 
134835858a6Schristos void
135835858a6Schristos CvClearOpComments (
136835858a6Schristos     ACPI_PARSE_OBJECT       *Op);
137835858a6Schristos 
138835858a6Schristos ACPI_FILE_NODE*
139835858a6Schristos CvFilenameExists (
140835858a6Schristos     char                    *Filename,
141835858a6Schristos     ACPI_FILE_NODE           *Head);
142835858a6Schristos 
143835858a6Schristos void
144835858a6Schristos CvLabelFileNode (
145835858a6Schristos     ACPI_PARSE_OBJECT       *Op);
146835858a6Schristos 
147835858a6Schristos void
148835858a6Schristos CvCaptureListComments (
149835858a6Schristos     ACPI_PARSE_STATE        *ParserState,
150835858a6Schristos     ACPI_COMMENT_NODE       *ListHead,
151835858a6Schristos     ACPI_COMMENT_NODE       *ListTail);
152835858a6Schristos 
153835858a6Schristos void
154835858a6Schristos CvCaptureCommentsOnly (
155835858a6Schristos     ACPI_PARSE_STATE        *ParserState);
156835858a6Schristos 
157835858a6Schristos void
158835858a6Schristos CvCaptureComments (
159835858a6Schristos     ACPI_WALK_STATE         *WalkState);
160835858a6Schristos 
161835858a6Schristos void
162835858a6Schristos CvTransferComments (
163835858a6Schristos     ACPI_PARSE_OBJECT       *Op);
164835858a6Schristos 
165835858a6Schristos /*
166835858a6Schristos  * cvdisasm
167835858a6Schristos  */
168835858a6Schristos void
169835858a6Schristos CvSwitchFiles (
170835858a6Schristos     UINT32                  level,
171835858a6Schristos     ACPI_PARSE_OBJECT       *op);
172835858a6Schristos 
173835858a6Schristos BOOLEAN
174835858a6Schristos CvFileHasSwitched (
175835858a6Schristos     ACPI_PARSE_OBJECT       *Op);
176835858a6Schristos 
177835858a6Schristos 
178835858a6Schristos void
179835858a6Schristos CvCloseParenWriteComment (
180835858a6Schristos     ACPI_PARSE_OBJECT       *Op,
181835858a6Schristos     UINT32                  Level);
182835858a6Schristos 
183835858a6Schristos void
184835858a6Schristos CvCloseBraceWriteComment (
185835858a6Schristos     ACPI_PARSE_OBJECT       *Op,
186835858a6Schristos     UINT32                  Level);
187835858a6Schristos 
188835858a6Schristos void
189835858a6Schristos CvPrintOneCommentList (
190835858a6Schristos     ACPI_COMMENT_NODE       *CommentList,
191835858a6Schristos     UINT32                  Level);
192835858a6Schristos 
193835858a6Schristos void
194835858a6Schristos CvPrintOneCommentType (
195835858a6Schristos     ACPI_PARSE_OBJECT       *Op,
196835858a6Schristos     UINT8                   CommentType,
197835858a6Schristos     char*                   EndStr,
198835858a6Schristos     UINT32                  Level);
199835858a6Schristos 
200835858a6Schristos 
201835858a6Schristos #endif
202835858a6Schristos 
203835858a6Schristos #endif /* _ACCONVERT */
204