]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/C/VfrCompile/VfrError.h
Report warning info if an action opcode has text two statement.
[mirror_edk2.git] / BaseTools / Source / C / VfrCompile / VfrError.h
1 /** @file
2
3 VfrCompiler Error definition
4
5 Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 #ifndef _VFRERROR_H_
17 #define _VFRERROR_H_
18
19 #include "Common/UefiBaseTypes.h"
20
21 typedef enum {
22 VFR_RETURN_SUCCESS = 0,
23 VFR_RETURN_ERROR_SKIPED,
24 VFR_RETURN_FATAL_ERROR,
25 VFR_RETURN_MISMATCHED,
26 VFR_RETURN_INVALID_PARAMETER,
27 VFR_RETURN_OUT_FOR_RESOURCES,
28 VFR_RETURN_UNSUPPORTED,
29 VFR_RETURN_REDEFINED,
30 VFR_RETURN_FORMID_REDEFINED,
31 VFR_RETURN_QUESTIONID_REDEFINED,
32 VFR_RETURN_VARSTOREID_REDEFINED,
33 VFR_RETURN_UNDEFINED,
34 VFR_RETURN_VAR_NOTDEFINED_BY_QUESTION,
35 VFR_RETURN_VARSTORE_DATATYPE_REDEFINED_ERROR,
36 VFR_RETURN_GET_EFIVARSTORE_ERROR,
37 VFR_RETURN_EFIVARSTORE_USE_ERROR,
38 VFR_RETURN_EFIVARSTORE_SIZE_ERROR,
39 VFR_RETURN_GET_NVVARSTORE_ERROR,
40 VFR_RETURN_QVAR_REUSE,
41 VFR_RETURN_FLAGS_UNSUPPORTED,
42 VFR_RETURN_ERROR_ARRARY_NUM,
43 VFR_RETURN_DATA_STRING_ERROR,
44 VFR_RETURN_DEFAULT_VALUE_REDEFINED,
45 VFR_RETURN_CONSTANT_ONLY,
46 VFR_RETURN_VARSTORE_NAME_REDEFINED_ERROR,
47 VFR_RETURN_CODEUNDEFINED
48 } EFI_VFR_RETURN_CODE;
49
50 typedef enum {
51 VFR_WARNING_DEFAULT_VALUE_REDEFINED = 0,
52 VFR_WARNING_STRING_TO_UINT_OVERFLOW,
53 VFR_WARNING_ACTION_WITH_TEXT_TWO,
54 VFR_WARNING_CODEUNDEFINED
55 } EFI_VFR_WARNING_CODE;
56
57 typedef struct _SVFR_ERROR_HANDLE {
58 EFI_VFR_RETURN_CODE mErrorCode;
59 CONST CHAR8 *mErrorMsg;
60 } SVFR_ERROR_HANDLE;
61
62 typedef struct _SVFR_WARNING_HANDLE {
63 EFI_VFR_WARNING_CODE mWarningCode;
64 CONST CHAR8 *mWarningMsg;
65 } SVFR_WARNING_HANDLE;
66
67 struct SVfrFileScopeRecord {
68 CHAR8 *mFileName;
69 UINT32 mWholeScopeLine;
70 UINT32 mScopeLineStart;
71 SVfrFileScopeRecord *mNext;
72
73 SVfrFileScopeRecord (IN CHAR8 *, IN UINT32);
74 ~SVfrFileScopeRecord();
75 };
76
77 class CVfrErrorHandle {
78 private:
79 CHAR8 *mInputFileName;
80 SVFR_ERROR_HANDLE *mVfrErrorHandleTable;
81 SVFR_WARNING_HANDLE *mVfrWarningHandleTable;
82 SVfrFileScopeRecord *mScopeRecordListHead;
83 SVfrFileScopeRecord *mScopeRecordListTail;
84 BOOLEAN mWarningAsError;
85
86 public:
87 CVfrErrorHandle (VOID);
88 ~CVfrErrorHandle (VOID);
89
90 VOID SetWarningAsError (IN BOOLEAN);
91 VOID SetInputFile (IN CHAR8 *);
92 VOID ParseFileScopeRecord (IN CHAR8 *, IN UINT32);
93 VOID GetFileNameLineNum (IN UINT32, OUT CHAR8 **, OUT UINT32 *);
94 UINT8 HandleError (IN EFI_VFR_RETURN_CODE, IN UINT32 LineNum = 0, IN CHAR8 *TokName = NULL);
95 UINT8 HandleWarning (IN EFI_VFR_WARNING_CODE, IN UINT32 LineNum = 0, IN CHAR8 *TokName = NULL);
96 VOID PrintMsg (IN UINT32 LineNum = 0, IN CHAR8 *TokName = NULL, IN CONST CHAR8 *MsgType = "Error", IN CONST CHAR8 *ErrorMsg = "");
97 };
98
99 #define CHECK_ERROR_RETURN(f, v) do { EFI_VFR_RETURN_CODE r; if ((r = (f)) != (v)) { return r; } } while (0)
100
101 extern CVfrErrorHandle gCVfrErrorHandle;
102
103 #endif