]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/C/VfrCompile/VfrError.h
29cccabd297e34676d2b1c83a7e2f5b5522ba645
[mirror_edk2.git] / BaseTools / Source / C / VfrCompile / VfrError.h
1 /** @file
2
3 VfrCompiler Error definition
4
5 Copyright (c) 2004 - 2008, 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_GET_EFIVARSTORE_ERROR,
36 VFR_RETURN_EFIVARSTORE_USE_ERROR,
37 VFR_RETURN_EFIVARSTORE_SIZE_ERROR,
38 VFR_RETURN_GET_NVVARSTORE_ERROR,
39 VFR_RETURN_QVAR_REUSE,
40 VFR_RETURN_FLAGS_UNSUPPORTED,
41 VFR_RETURN_ERROR_ARRARY_NUM,
42 VFR_RETURN_DATA_STRING_ERROR,
43 VFR_RETURN_DEFAULT_VALUE_REDEFINED,
44 VFR_RETURN_CONSTANT_ONLY,
45 VFR_RETURN_CODEUNDEFINED
46 } EFI_VFR_RETURN_CODE;
47
48 typedef struct _SVFR_ERROR_HANDLE {
49 EFI_VFR_RETURN_CODE mErrorCode;
50 CONST CHAR8 *mErrorMsg;
51 } SVFR_ERROR_HANDLE;
52
53 struct SVfrFileScopeRecord {
54 CHAR8 *mFileName;
55 UINT32 mWholeScopeLine;
56 UINT32 mScopeLineStart;
57 SVfrFileScopeRecord *mNext;
58
59 SVfrFileScopeRecord (IN CHAR8 *, IN UINT32);
60 ~SVfrFileScopeRecord();
61 };
62
63 class CVfrErrorHandle {
64 private:
65 CHAR8 *mInputFileName;
66 SVFR_ERROR_HANDLE *mVfrErrorHandleTable;
67 SVfrFileScopeRecord *mScopeRecordListHead;
68 SVfrFileScopeRecord *mScopeRecordListTail;
69
70 public:
71 CVfrErrorHandle (VOID);
72 ~CVfrErrorHandle (VOID);
73
74 VOID SetInputFile (IN CHAR8 *);
75 VOID ParseFileScopeRecord (IN CHAR8 *, IN UINT32);
76 VOID GetFileNameLineNum (IN UINT32, OUT CHAR8 **, OUT UINT32 *);
77 UINT8 HandleError (IN EFI_VFR_RETURN_CODE, IN UINT32 LineNum = 0, IN CHAR8 *TokName = NULL);
78 VOID PrintMsg (IN UINT32 LineNum = 0, IN CHAR8 *TokName = NULL, IN CONST CHAR8 *MsgType = "Error", IN CONST CHAR8 *ErrorMsg = "");
79 };
80
81 #define CHECK_ERROR_RETURN(f, v) do { EFI_VFR_RETURN_CODE r; if ((r = (f)) != (v)) { return r; } } while (0)
82
83 extern CVfrErrorHandle gCVfrErrorHandle;
84
85 #endif